[FFmpeg-cvslog] avcodec/aacdec: Skip processing channel elements which have not been present

Michael Niedermayer git at videolan.org
Sun Nov 9 12:06:00 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Nov  9 04:25:12 2014 +0100| [55d592f7d9847a22b594ebe413508d1f77a13ed6] | committer: Michael Niedermayer

avcodec/aacdec: Skip processing channel elements which have not been present

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/aac.h    |    1 +
 libavcodec/aacdec.c |    7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index 387e103..e8de1e8 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -245,6 +245,7 @@ typedef struct SingleChannelElement {
  * channel element - generic struct for SCE/CPE/CCE/LFE
  */
 typedef struct ChannelElement {
+    int present;
     // CPE specific
     int common_window;        ///< Set if channels share a common 'IndividualChannelStream' in bitstream.
     int     ms_mode;          ///< Signals mid/side stereo flags coding mode (used by encoder)
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index d08d87d..2793881 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -2744,7 +2744,7 @@ static void spectral_to_sample(AACContext *ac)
     for (type = 3; type >= 0; type--) {
         for (i = 0; i < MAX_ELEM_ID; i++) {
             ChannelElement *che = ac->che[type][i];
-            if (che) {
+            if (che && che->present) {
                 if (type <= TYPE_CPE)
                     apply_channel_coupling(ac, che, type, i, BEFORE_TNS, apply_dependent_coupling);
                 if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) {
@@ -2776,6 +2776,9 @@ static void spectral_to_sample(AACContext *ac)
                 }
                 if (type <= TYPE_CCE)
                     apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, apply_independent_coupling);
+                che->present = 0;
+            } else if (che) {
+                av_log(ac->avctx, AV_LOG_WARNING, "ChannelElement %d.%d missing \n", type, i);
             }
         }
     }
@@ -2880,6 +2883,7 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
                    elem_type, elem_id);
             return AVERROR_INVALIDDATA;
         }
+        che->present = 1;
         if (aot != AOT_ER_AAC_ELD)
             skip_bits(gb, 4);
         switch (elem_type) {
@@ -2954,6 +2958,7 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
                 goto fail;
             }
             samples = 1024;
+            che->present = 1;
         }
 
         switch (elem_type) {



More information about the ffmpeg-cvslog mailing list