]> git.sesse.net Git - ffmpeg/commitdiff
dca: handle errors from dca_decode_block()
authorJustin Ruggles <justin.ruggles@gmail.com>
Thu, 27 Oct 2011 15:45:50 +0000 (11:45 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Sat, 29 Oct 2011 20:04:07 +0000 (16:04 -0400)
Return error if core block decoding fails.
Do not enable XCh if XCh extension block decoding fails.

libavcodec/dca.c

index deb7245256d44ecec4514be645a8f0cab6889222..7f7bcf9cfd077ac9d52c7d80c6f9906db13f1d1f 100644 (file)
@@ -1668,7 +1668,10 @@ static int dca_decode_frame(AVCodecContext * avctx,
     s->profile = FF_PROFILE_DTS;
 
     for (i = 0; i < (s->sample_blocks / 8); i++) {
-        dca_decode_block(s, 0, i);
+        if ((ret = dca_decode_block(s, 0, i))) {
+            av_log(avctx, AV_LOG_ERROR, "error decoding block\n");
+            return ret;
+        }
     }
 
     /* record number of core channels incase less than max channels are requested */
@@ -1724,7 +1727,10 @@ static int dca_decode_frame(AVCodecContext * avctx,
             dca_parse_audio_coding_header(s, s->xch_base_channel);
 
             for (i = 0; i < (s->sample_blocks / 8); i++) {
-                dca_decode_block(s, s->xch_base_channel, i);
+                if ((ret = dca_decode_block(s, s->xch_base_channel, i))) {
+                    av_log(avctx, AV_LOG_ERROR, "error decoding XCh extension\n");
+                    continue;
+                }
             }
 
             s->xch_present = 1;