This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 0834db516348d253b2c51f969188501d324c698d Author: Romain Beauxis <[email protected]> AuthorDate: Thu Nov 12 21:39:25 2026 -0600 Commit: Romain Beauxis <[email protected]> CommitDate: Sun Nov 15 15:37:13 2026 +0000 avcodec/mpegaudiodec: set the sample rate before allocating the frame decode_frame() sets the sample rate from the parsed header along with the channel layout, before mp_decode_frame() allocates the output frame, as decode_frame_adu() does. The first frame after a mid-stream sample rate change carries its own rate, as the updated mpegaudiodec-sample-rate-change reference shows. --- libavcodec/mpegaudiodec_template.c | 5 ++--- tests/ref/fate/mpegaudiodec-sample-rate-change | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c index b146307dd9..cb86ea170d 100644 --- a/libavcodec/mpegaudiodec_template.c +++ b/libavcodec/mpegaudiodec_template.c @@ -1592,6 +1592,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, return AVERROR_INVALIDDATA; } /* update codec info */ + if (avctx->codec_id != AV_CODEC_ID_AHX) + avctx->sample_rate = s->hdr.sample_rate; av_channel_layout_uninit(&avctx->ch_layout); avctx->ch_layout = s->hdr.nb_channels == 1 ? (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO : (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; @@ -1612,9 +1614,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, if (ret >= 0) { s->frame->nb_samples = avctx->frame_size; *got_frame_ptr = 1; - if (avctx->codec_id != AV_CODEC_ID_AHX) - avctx->sample_rate = s->hdr.sample_rate; - //FIXME maybe move the other codec info stuff from above here too } else { av_log(avctx, AV_LOG_ERROR, "Error while decoding MPEG audio frame.\n"); /* Only return an error if the bad frame makes up the whole packet or diff --git a/tests/ref/fate/mpegaudiodec-sample-rate-change b/tests/ref/fate/mpegaudiodec-sample-rate-change index b7d84f4651..08e2caafbc 100644 --- a/tests/ref/fate/mpegaudiodec-sample-rate-change +++ b/tests/ref/fate/mpegaudiodec-sample-rate-change @@ -1,6 +1,6 @@ 44100 44100 44100 -44100 +48000 48000 48000 -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
