[FFmpeg-cvslog] aacdec: set AVFrame sample_rate

John Stebbins git at videolan.org
Wed Feb 12 15:17:58 CET 2014


ffmpeg | branch: master | John Stebbins <stebbins at jetheaddev.com> | Sun Feb  9 01:19:30 2014 +0000| [462d5e8e6c050eae7cbb1f2d5c34628088bd0eb6] | committer: Janne Grunau

aacdec: set AVFrame sample_rate

AVFrame.sample_rate is set in ff_get_buffer, but aacdec calls
ff_get_buffer before the samplerate is known. So it needs to be
set again before returning the frame.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=462d5e8e6c050eae7cbb1f2d5c34628088bd0eb6
---

 libavcodec/aacdec.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 70fbb53..a365209 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -2753,6 +2753,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
     spectral_to_sample(ac);
 
     ac->frame->nb_samples = samples;
+    ac->frame->sample_rate = avctx->sample_rate;
     *got_frame_ptr = 1;
 
     skip_bits_long(gb, get_bits_left(gb));
@@ -2885,16 +2886,18 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
     multiplier = (ac->oc[1].m4ac.sbr == 1) ? ac->oc[1].m4ac.ext_sample_rate > ac->oc[1].m4ac.sample_rate : 0;
     samples <<= multiplier;
 
-    if (samples)
-        ac->frame->nb_samples = samples;
-    *got_frame_ptr = !!samples;
-
     if (ac->oc[1].status && audio_found) {
         avctx->sample_rate = ac->oc[1].m4ac.sample_rate << multiplier;
         avctx->frame_size = samples;
         ac->oc[1].status = OC_LOCKED;
     }
 
+    if (samples) {
+        ac->frame->nb_samples = samples;
+        ac->frame->sample_rate = avctx->sample_rate;
+    }
+    *got_frame_ptr = !!samples;
+
     return 0;
 fail:
     pop_output_configuration(ac);



More information about the ffmpeg-cvslog mailing list