[FFmpeg-devel] [PATCH V4 2/4] libavfilter/buffersink.c: unref private_ref when frame leaves libavfilter

Guo, Yejun yejun.guo at intel.com
Mon Mar 1 16:13:03 EET 2021



> -----Original Message-----
> From: Nicolas George <george at nsup.org>
> Sent: 2021年3月1日 21:36
> To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
> Cc: Guo, Yejun <yejun.guo at intel.com>
> Subject: Re: [FFmpeg-devel] [PATCH V4 2/4] libavfilter/buffersink.c: unref
> private_ref when frame leaves libavfilter
> 
> Guo, Yejun (12021-03-01):
> > private_ref is for internal use by a single libav* library.
> > It has to be NULL when ownership of the frame leaves the respective
> > library,
> >
> > buffersink is the last step when the frame leaves libavfilter, so add unref here.
> >
> > Signed-off-by: Guo, Yejun <yejun.guo at intel.com>
> > ---
> >  libavfilter/buffersink.c | 1 +
> >  1 file changed, 1 insertion(+)
> 
> NAK. buffersink did not take ownership of that reference, therefore it does not
> own it and cannot unref it.
> 
> If this change actually fixes something, i.e. if there is a ref at this point, then we
> need to find who put it there, because they are responsible for freeing it.
> 

Thanks for the review, as we talked at http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276728.html,
private_ref is allocated in filter vf_dnn_detect.c for detected results, and other
filters such as vf_drawbox/text (in plan) will read it.

Since private_ref is for a single libav* library, it has to be NULL when it leaves libavfilter,
so I have to unref it at the last step of libavfilter, that's in buffersink. Any other suggestion? thanks.



More information about the ffmpeg-devel mailing list