Commit f944cad81e for ffmpeg
commit f944cad81ea624ae453893002e0823a74d2d8c28
Author: Romain Beauxis <romain.beauxis@gmail.com>
Date: Sun Nov 1 08:44:45 2026 -0600
avformat/oggparseopus: pass a later link's header to the decoder
When a chained stream moves to a new link, the decoder is still set
up from the first link's header.
Attach the new link's header to its first packet as
AV_PKT_DATA_NEW_EXTRADATA, as the vorbis and flac parsers do.
All three chained tests now decode exactly as their links decoded
one by one.
diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c
index f01580878f..6dde828abf 100644
--- a/libavformat/oggparseopus.c
+++ b/libavformat/oggparseopus.c
@@ -150,6 +150,13 @@ static int opus_packet(AVFormatContext *avf, int idx)
if (ret < 0)
return ret;
+ /* A later link's header: the decoder is still set up for the previous one. */
+ av_freep(&os->new_extradata);
+ os->new_extradata = av_memdup(packet, os->psize);
+ if (!os->new_extradata)
+ return AVERROR(ENOMEM);
+ os->new_extradata_size = os->psize;
+
return 1;
}
diff --git a/tests/fate/ogg-opus.mak b/tests/fate/ogg-opus.mak
index ec415535a5..59e2794b29 100644
--- a/tests/fate/ogg-opus.mak
+++ b/tests/fate/ogg-opus.mak
@@ -34,8 +34,8 @@ fate-ogg-opus-chained-reset: CMD = $(call OGG_OPUS_CHAINED,$(OGG_OPUS_CHAINED_RE
fate-ogg-opus-chained-reset: REF = $(OGG_OPUS_CHAINED_RESET_LINKS).pcm
fate-ogg-opus-chained-reset: CLEANFILES = $(addprefix $(OGG_OPUS_CHAINED_RESET_LINKS),.1.ogg .2.ogg .pcm)
fate-ogg-opus-chained-reset: CMP = stddev
-fate-ogg-opus-chained-reset: CMP_TARGET = 95
-fate-ogg-opus-chained-reset: FUZZ = 5
+fate-ogg-opus-chained-reset: CMP_TARGET = 0
+fate-ogg-opus-chained-reset: FUZZ = 0
# The second link sets an output gain of -6 dB, which the first one does not.
OGG_OPUS_CHAINED_GAIN_LINKS = tests/data/fate/ogg-opus-chained-gain.links
@@ -44,8 +44,8 @@ fate-ogg-opus-chained-gain: CMD = $(call OGG_OPUS_CHAINED,$(OGG_OPUS_CHAINED_GAI
fate-ogg-opus-chained-gain: REF = $(OGG_OPUS_CHAINED_GAIN_LINKS).pcm
fate-ogg-opus-chained-gain: CLEANFILES = $(addprefix $(OGG_OPUS_CHAINED_GAIN_LINKS),.1.ogg .2.ogg .pcm)
fate-ogg-opus-chained-gain: CMP = stddev
-fate-ogg-opus-chained-gain: CMP_TARGET = 1040
-fate-ogg-opus-chained-gain: FUZZ = 10
+fate-ogg-opus-chained-gain: CMP_TARGET = 0
+fate-ogg-opus-chained-gain: FUZZ = 0
# Two SILK test vectors chained: the first link ends with samples still
# buffered in the decoder.
@@ -60,7 +60,7 @@ fate-ogg-opus-chained-silk: REF = $(OGG_OPUS_CHAINED_SILK_LINKS).pcm
fate-ogg-opus-chained-silk: CLEANFILES = $(addprefix $(OGG_OPUS_CHAINED_SILK_LINKS),.1.ogg .2.ogg .pcm)
fate-ogg-opus-chained-silk: CMP = stddev
fate-ogg-opus-chained-silk: CMP_TARGET = 0
-fate-ogg-opus-chained-silk: FUZZ = 1
+fate-ogg-opus-chained-silk: FUZZ = 0
FATE_OGG_OPUS-$(call DEMDEC, OGG, OPUS) += $(FATE_OGG_OPUS)