Message ID | 20210222073045.16070-2-yejun.guo@intel.com |
---|---|
State | Superseded |
Headers | show |
Series | [FFmpeg-devel,V3,1/3] libavfilter/bbox.h: add BoundingBoxHeader and BoundingBox | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
Guo, Yejun (12021-02-22): > --- > libavfilter/buffersink.c | 1 + > 1 file changed, 1 insertion(+) This does not seem correct: the ref count is not raised by buffersink, it probably should not lower it. What circumstances are you trying to fix exactly? Regards,
> -----Original Message----- > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Nicolas > George > Sent: 2021年2月23日 0:05 > To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> > Cc: Guo, Yejun <yejun.guo@intel.com> > Subject: Re: [FFmpeg-devel] [PATCH V3 2/3] libavfilter/buffersink.c: unref > private_ref when frame leaves libavfilter > > Guo, Yejun (12021-02-22): > > --- > > libavfilter/buffersink.c | 1 + > > 1 file changed, 1 insertion(+) > > This does not seem correct: the ref count is not raised by buffersink, it > probably should not lower it. > > What circumstances are you trying to fix exactly? The purpose is to support filter object detection. We need a place within AVFrame to save bounding boxes (the result of object detection, where are the objects, and what are the objects). And we plan to use AVFrame->private_ref as now, see more discussion at http://ffmpeg.org/pipermail/ffmpeg-devel/2021-February/276641.html As at https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/frame.h#L683, 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 I add unref here. In the patch 3 of this patch set, private_ref is allocated in filter vf_dnn_detect.c to save the detected bounding boxes. Other filters such as classify, bbox_to_roi (both in plan) will need the bounding boxes, and we also plan to update vf_drawbox/text to visualize the bounding boxes. > > Regards, > > -- > Nicolas George
diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c index 58848941d4..837a6e9e82 100644 --- a/libavfilter/buffersink.c +++ b/libavfilter/buffersink.c @@ -98,6 +98,7 @@ static int return_or_keep_frame(BufferSinkContext *buf, AVFrame *out, AVFrame *i } else { av_assert1(out); buf->peeked_frame = NULL; + av_buffer_unref(&in->private_ref); av_frame_move_ref(out, in); av_frame_free(&in); return 0;