[FFmpeg-devel] [PATCH] vf_overlay: clear cur_buf only in end_frame.
nicolas.george at normalesup.org
Fri Jul 27 17:35:55 CEST 2012
Le decadi 10 thermidor, an CCXX, Michael Niedermayer a écrit :
> this looks fragile, implicating from the value of out_buf if
> cur_buf has been copied
> it might make more sense to create a new reference so the original
> can saftely be freed or add a seperate flag that indicates if cur_buf
> has to be set to NULL before returning
I am afraid the flag solution would be fragile too, especially with merges
from the fork bringing similar problems.
As for creating a new reference for the copy, this is robust, but it is also
somewhat expensive, in a part of the code that is starting to be
speed-critical. I believe it is too high a price to pay for for letting the
programmer be sloppy.
It is not hard to be sure cur_buf was cleared in end_frame and not in
start_frame, once the problem is clearly understood. A checklist in the docs
and a few well-placed av_asserts would, IMHO, be enough to make sure
everything is fine.
More information about the ffmpeg-devel