[FFmpeg-devel] [PATCH 1/3] ffmpeg: do not pass possibly undefined subtitles to sub2video_update

Marton Balint cus at passwd.hu
Sat Nov 23 20:37:00 CET 2013



On Sat, 23 Nov 2013, Nicolas George wrote:

> Le tridi 3 frimaire, an CCXXII, Marton Balint a écrit :
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>>  ffmpeg.c | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/ffmpeg.c b/ffmpeg.c
>> index 26cbbe3..ff39fe0 100644
>> --- a/ffmpeg.c
>> +++ b/ffmpeg.c
>> @@ -1816,9 +1816,12 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
>>          FFSWAP(AVSubtitle, subtitle,    ist->prev_sub.subtitle);
>>      }
>>
>> +    if (!*got_output)
>> +        return ret;
>> +
>>      sub2video_update(ist, &subtitle);
>>
>> -    if (!*got_output || !subtitle.num_rects)
>> +    if (!subtitle.num_rects)
>>          return ret;
>>
>>      for (i = 0; i < nb_output_streams; i++) {
>
> I do not object to the patch, but I believe this is completely unnecessary:
> apart in case of ridiculous invalid API uses (that, of course, does not
> happen in ffmpeg.c), the AVSubtitle structure is initialized to something
> consistent, and the code guarantees that testing num_rects will not give a
> false positive.

Yes, you're probably right, and it does not matter a lot, it just felt 
cleaner this way.

Regards,
Marton


More information about the ffmpeg-devel mailing list