[vlc-commits] [Git][videolan/vlc][master] avcodec: audio: fix decoding opus packets
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Mon Jul 6 14:54:40 UTC 2026
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
04f65f58 by Alexandre Janniaux at 2026-07-06T16:11:58+02:00
avcodec: audio: fix decoding opus packets
Extract the first Xiph header via xiph_SplitHeaders() and feed only that
to libavcodec, just like it's done in the opus.c decoder.
This fixes the playback when the opus decoder is not built and only
avcodec is present in the build.
- - - - -
1 changed file:
- modules/codec/avcodec/audio.c
Changes:
=====================================
modules/codec/avcodec/audio.c
=====================================
@@ -36,6 +36,7 @@
#include <vlc_avcodec.h>
#include "avcodec.h"
+#include "../../demux/xiph.h"
#include <libavcodec/avcodec.h>
#include <libavutil/mem.h>
@@ -99,6 +100,20 @@ static void InitDecoderConfig( decoder_t *p_dec, AVCodecContext *p_context )
if( i_size < 36 )
i_size = 0;
}
+ else if( p_dec->fmt_in->i_codec == VLC_CODEC_OPUS &&
+ i_size > 21 && !memcmp( &p_src[2], "OpusHead", 8 ) )
+ {
+ /* see opus.c decoder */
+ size_t hdr_size[XIPH_MAX_HEADER_COUNT];
+ const void *hdr[XIPH_MAX_HEADER_COUNT];
+ size_t i_count;
+ if( !xiph_SplitHeaders( hdr_size, hdr, &i_count,
+ i_size, p_src ) && i_count >= 1 )
+ {
+ i_offset = (const uint8_t *)hdr[0] - p_src;
+ i_size = hdr_size[0];
+ }
+ }
if( i_size > 0 )
{
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/04f65f5853eb8ea8cd6985d37db5e83f1b969123
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/04f65f5853eb8ea8cd6985d37db5e83f1b969123
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list