summaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegaudiodec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-09-27 10:39:54 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-10-27 22:06:31 -0400
commit4be1e1dfa7233380171da98586c42505a26655d1 (patch)
treef49992cddbebfa3c43729b571a566326cdbb4a32 /libavcodec/mpegaudiodec.c
parent15946eb8a940416d9792c65900273d674f9c152a (diff)
downloadffmpeg-streaming-4be1e1dfa7233380171da98586c42505a26655d1.zip
ffmpeg-streaming-4be1e1dfa7233380171da98586c42505a26655d1.tar.gz
mpegaudiodec: Skip only bad frames instead of the whole packet.
On frame decoding failure, return an error if the frame is the same size as the whole packet, otherwise just log an error message and return the number of bytes consumed.
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r--libavcodec/mpegaudiodec.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index e3d19c0..004048c 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1819,8 +1819,15 @@ static int decode_frame(AVCodecContext * avctx,
*data_size = out_size;
avctx->sample_rate = s->sample_rate;
//FIXME maybe move the other codec info stuff from above here too
- }else
- av_log(avctx, AV_LOG_DEBUG, "Error while decoding MPEG audio frame.\n"); //FIXME return -1 / but also return the number of bytes consumed
+ } 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.
+ If there is more data in the packet, just consume the bad frame
+ instead of returning an error, which would discard the whole
+ packet. */
+ if (buf_size == avpkt->size)
+ return out_size;
+ }
s->frame_size = 0;
return buf_size;
}
OpenPOWER on IntegriCloud