[FFmpeg-devel] [PATCH] libdcadec: search for frames that start late in a packet

James Almer jamrial at gmail.com
Sun May 24 18:18:05 CEST 2015


On 24/05/15 6:47 AM, Hendrik Leppkes wrote:
> On Sun, May 24, 2015 at 6:27 AM, James Almer <jamrial at gmail.com> wrote:
>> Based on commit 4ae15605f6298d8369a1f1374596b52a3839c703
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>  libavcodec/libdcadec.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavcodec/libdcadec.c b/libavcodec/libdcadec.c
>> index 9ea61fa..890d270 100644
>> --- a/libavcodec/libdcadec.c
>> +++ b/libavcodec/libdcadec.c
>> @@ -58,7 +58,10 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
>>          if (!s->buffer)
>>              return AVERROR(ENOMEM);
>>
>> -        if ((ret = avpriv_dca_convert_bitstream(avpkt->data, avpkt->size, s->buffer, s->buffer_size)) < 0)
>> +        for (i = 0, ret = AVERROR_INVALIDDATA; i < input_size - 3 && ret < 0; i++)
>> +            ret = avpriv_dca_convert_bitstream(input + i, input_size - i, s->buffer, s->buffer_size);
>> +
>> +        if (ret < 0)
>>              return ret;
>>
>>          input      = s->buffer;
> 
> LGTM if tested.

Tested it with the sample from 9f5769437aaab30a359cde254f39d9a28b1ce657.
With this patch the first packet is decoded correctly and the output is bitexact
to the one from dcadec cli.

Pushed, thanks.


More information about the ffmpeg-devel mailing list