[vlc-devel] [PATCH 07/19] fps: implement draining of extra pictures
Steve Lhomme
robux4 at ycbcr.xyz
Tue Oct 13 15:51:50 CEST 2020
We no longer return pictures chained using vlc_picture_chain_AppendChain().
p_previous_pic is the picture being filtered.
drain_pic holds a reference on the picture that was previously returned and is
released once all the draining for that picture is done.
---
modules/video_filter/fps.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/modules/video_filter/fps.c b/modules/video_filter/fps.c
index 64dd1c1fdc4..418fd9aee9a 100644
--- a/modules/video_filter/fps.c
+++ b/modules/video_filter/fps.c
@@ -110,24 +110,28 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_picture)
date_Increment( &p_sys->next_output_pts, 1 );
picture_t *last_pic = p_sys->p_previous_pic;
+ p_sys->p_previous_pic = p_picture;
+ return last_pic;
+}
+
+static picture_t *Drain( filter_t *p_filter )
+{
+ filter_sys_t *p_sys = p_filter->p_sys;
+ picture_t *p_picture = p_sys->p_previous_pic;
+
/* Duplicating pictures are not that effective and framerate increase
should be avoided, it's only here as filter should work in that direction too*/
- while( unlikely( (date_Get( &p_sys->next_output_pts ) + p_sys->i_output_frame_interval ) < p_picture->date ) )
+ if( unlikely( (date_Get( &p_sys->next_output_pts ) + p_sys->i_output_frame_interval ) < p_picture->date ) )
{
picture_t *p_tmp = NULL;
p_tmp = picture_NewFromFormat( &p_filter->fmt_out.video );
picture_Copy( p_tmp, p_sys->p_previous_pic);
p_tmp->date = date_Get( &p_sys->next_output_pts );
-
- vlc_picture_chain_AppendChain( last_pic, p_tmp );
- last_pic = p_tmp;
date_Increment( &p_sys->next_output_pts, 1 );
+ return p_tmp;
}
-
- last_pic = p_sys->p_previous_pic;
- p_sys->p_previous_pic = p_picture;
- return last_pic;
+ return NULL;
}
static void Close( filter_t *p_filter )
@@ -153,7 +157,7 @@ static void Flush( filter_t *p_filter )
static const struct vlc_filter_operations filter_ops =
{
- .filter_video = Filter, .close = Close,
+ .filter_video = Filter, .drain_video = Drain, .close = Close,
.flush = Flush,
};
--
2.26.2
More information about the vlc-devel
mailing list