diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-23 16:23:52 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-23 16:37:16 +0200 |
commit | 4ae15605f6298d8369a1f1374596b52a3839c703 (patch) | |
tree | 4798b77757f7babf894468aad1f5f6778ca6be5d | |
parent | 40a3e1e9c54997e4dfc7802b5a758b68ceb64982 (diff) | |
download | ffmpeg-4ae15605f6298d8369a1f1374596b52a3839c703.tar.gz |
avcodec/dcadec: Search and decode frame in case it starts later in a packet
This fixes decoding the first frame of some dts files
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/dcadec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index 91db893c56..3ea1bcfc9d 100644 --- a/libavcodec/dcadec.c +++ b/libavcodec/dcadec.c @@ -1487,8 +1487,11 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, s->exss_ext_mask = 0; s->xch_present = 0; - s->dca_buffer_size = avpriv_dca_convert_bitstream(buf, buf_size, s->dca_buffer, - DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE); + s->dca_buffer_size = AVERROR_INVALIDDATA; + for (i = 0; i < buf_size - 3 && s->dca_buffer_size == AVERROR_INVALIDDATA; i++) + s->dca_buffer_size = avpriv_dca_convert_bitstream(buf + i, buf_size - i, s->dca_buffer, + DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE); + if (s->dca_buffer_size == AVERROR_INVALIDDATA) { av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n"); return AVERROR_INVALIDDATA; |