[FFmpeg-devel] [PATCH 3/3] avcodec/cbs_vp9: discard empty fragments

James Almer jamrial at gmail.com
Wed Oct 31 01:45:19 EET 2018


On 10/30/2018 8:19 PM, Mark Thompson wrote:
> On 30/10/18 19:21, James Almer wrote:
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>  libavcodec/cbs_vp9.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c
>> index 7498be4b73..812be4ddd5 100644
>> --- a/libavcodec/cbs_vp9.c
>> +++ b/libavcodec/cbs_vp9.c
>> @@ -403,6 +403,9 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
>>      uint8_t superframe_header;
>>      int err;
>>  
>> +    if (frag->data_size <= 0)
>> +        return 0;
>> +
>>      // Last byte in the packet.
>>      superframe_header = frag->data[frag->data_size - 1];
>>  
>>
> 
> Seems fine, but why would an empty fragment appear here?

I noticed this when i tried to reimplement the vp9 parser using cbs_vp9.
Libavformat passed dummy zero sized packets that resulted in cbs errors
trying to read the frame header.

> 
> (Given that H.26[45] has pretty much the same check, maybe it should be in the generic code.)

And AV1 has a while (size > 0), so yeah, it may be a good idea.

> 
> Thanks,
> 
> - Mark
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 



More information about the ffmpeg-devel mailing list