[vlc-commits] video_filter: fps: reset timestamp if time jumps far ahead

Ilkka Ollakka git at videolan.org
Sat Sep 24 18:15:33 CEST 2016


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sat Sep 24 16:46:43 2016 +0300| [6c519d9c2e5424d19b9a18394bc7078b9c7c8774] | committer: Ilkka Ollakka

video_filter: fps: reset timestamp if time jumps far ahead

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6c519d9c2e5424d19b9a18394bc7078b9c7c8774
---

 modules/video_filter/fps.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/fps.c b/modules/video_filter/fps.c
index 91dd758..0f0c568 100644
--- a/modules/video_filter/fps.c
+++ b/modules/video_filter/fps.c
@@ -78,11 +78,17 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_picture)
         picture_Release( p_picture );
         return NULL;
     }
-    /* First time we get some valid timestamp, we'll take it as base for output*/
-    if( unlikely( date_Get( &p_sys->next_output_pts ) == VLC_TS_INVALID ) )
+
+    /* First time we get some valid timestamp, we'll take it as base for output
+        later on we retake new timestamp if it has jumped too much */
+    if( unlikely( ( date_Get( &p_sys->next_output_pts ) == VLC_TS_INVALID ) ||
+                   ( p_picture->date > ( date_Get( &p_sys->next_output_pts ) + (mtime_t)p_sys->i_output_frame_interval ) )
+                ) )
     {
         msg_Dbg( p_filter, "Resetting timestamps" );
         date_Set( &p_sys->next_output_pts, p_picture->date );
+        if( p_sys->p_previous_pic )
+            picture_Release( p_sys->p_previous_pic );
         p_sys->p_previous_pic = picture_Hold( p_picture );
         date_Increment( &p_sys->next_output_pts, p_filter->fmt_out.video.i_frame_rate_base );
         return p_picture;
@@ -160,6 +166,7 @@ static int Open( vlc_object_t *p_this)
                p_filter->fmt_out.video.i_frame_rate, 1);
 
     date_Set( &p_sys->next_output_pts, VLC_TS_INVALID );
+    p_sys->p_previous_pic = NULL;
 
     p_filter->pf_video_filter = Filter;
     return VLC_SUCCESS;



More information about the vlc-commits mailing list