opus-openipc: bake HiSilicon ot_opus_* shim into libopus (cv6xx)#2174
Merged
Conversation
The Hi3516CV6xx vendor MPP audio adapter libss_mpi_audio_adp.so calls
6 ot_opus_* wrapper functions (ot_opusenc_create/_destroy/_process_frame
and ot_opusdec_* counterparts) that ship only inside the closed vendor
libopus.so. Without those symbols majestic fails at relocation time
with "ot_opusdec_create: symbol not found" on cv6xx boards.
This adds an open-source equivalent of the wrappers (src/ot_opus_shim.c)
built into buildroot's libopus, gated behind a new opt-in option
BR2_PACKAGE_OPUS_OPENIPC_HISI_SHIM so SoCs that don't need the
ot_opus_* surface neither pay 6 dead symbols nor pull host autotools
deps. Enables the option in hi3516cv6xx_ultimate_defconfig so the
single open libopus satisfies both the standard libopus.so.0 SONAME
path and the vendor binary's unversioned libopus.so DT_NEEDED entry —
the vendor blob can stay out of the install set.
The shim wrappers map the public ot_opus* signatures from the
Hi3516CV610 SDK V1.0.2.0 headers (out/include/ot_opus{enc,dec}.h) onto
upstream Opus's standard API, including error-code translation to
OT_ERR_OPUS{ENC,DEC}_*. opus_*_create + OPUS_SET_BITRATE on the
encoder side; opus_*_create + opus_decode treating each call as one
self-contained packet on the decoder side (matching the consumer in
mpp/cbb/audio/adp/src/ot_audio_opus_adp.c).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ot_opusenc_*,ot_opusdec_*) to libopus so the Hi3516CV6xx vendor MPP audio adapter (libss_mpi_audio_adp.so) can resolve them at runtime against the open opus build instead of the closed vendor libopus blob.BR2_PACKAGE_OPUS_OPENIPC_HISI_SHIMso other SoCs don't pay 6 dead symbols + host autotools deps.hi3516cv6xx_ultimate_defconfig.Background
After PR #2172 landed the cv6xx ultimate variant, sysupgrade onto live CV608 hardware boots fine (35 modules load, mmz hang gone), but majestic fails at relocation with:
libss_mpi_audio_adp.so(closed) needs 6 HiSilicon-onlyot_opus_*wrappers whose source isn't shipped — vendor only ships them inside its prebuiltlibopus.so. The osdrv .mk previously excluded that vendor blob on the assumption thatBR2_PACKAGE_OPUS_OPENIPCcovered the surface, but buildroot opus is upstream Opus and doesn't have the vendor wrappers.Implementation
general/package/opus-openipc/src/ot_opus_shim.c— 6 thin shims against the public Opus API, error-code mapped toOT_ERR_OPUS{ENC,DEC}_*. Marked with__attribute__((visibility("default")))because upstream Opus builds with-fvisibility=hidden.general/package/opus-openipc/Config.in— newBR2_PACKAGE_OPUS_OPENIPC_HISI_SHIMswitch, off by default.general/package/opus-openipc/opus-openipc.mk— gatedPOST_EXTRACT_HOOKScopies the shim intosrc/and sedsMakefile.amto add it tolibopus_la_SOURCES; gatedAUTORECONF=YESso Makefile.in is regenerated from .am. Untouched for SoCs that don't enable the switch.br-ext-chip-hisilicon/configs/hi3516cv6xx_ultimate_defconfig— turns the switch on.general/package/hisilicon-osdrv-hi3516cv6xx/hisilicon-osdrv-hi3516cv6xx.mk— comment updated; libopus.so stays out of the vendor install set, now legitimately covered by the open opus build.Signatures (from Hi3516CV610 SDK V1.0.2.0 public headers)
The shim implements:
ot_opus_encoder ot_opusenc_create(const ot_opusenc_config *)void ot_opusenc_destroy(ot_opus_encoder)int ot_opusenc_process_frame(ot_opus_encoder, short *, int, unsigned char *, unsigned int *)ot_opus_decoder ot_opusdec_create(const ot_opusdec_config *)void ot_opusdec_destroy(ot_opus_decoder)int ot_opusdec_process_frame(ot_opus_decoder, unsigned char **, int *, short *, unsigned int *)ot_opusdec_process_frametreats each call as one self-contained Opus packet (matching the consumer pattern inmpp/cbb/audio/adp/src/ot_audio_opus_adp.c) and advances*in_buf/*in_left_byteaccordingly.Test plan
make BOARD=hi3516cv6xx_ultimate br-opus-openipc-dirclean && br-opus-openipc— autoreconf runs, build cleanreadelf --dyn-syms output/per-package/opus-openipc/target/usr/lib/libopus.so.0.8.0 | grep ot_opus— all 6 exported GLOBAL DEFAULTunsquashfs output/images/rootfs.squashfs usr/lib/libopus.so.0.8.0 && readelf --dyn-syms ... | grep ot_opus— symbols present in the firmware image artifact🤖 Generated with Claude Code