[vlc-commits] input: input: always DEMUX_GET_TIME before --stop-time check

Filip Roséen git at videolan.org
Sun Jul 22 11:52:50 CEST 2018


vlc/vlc-3.0 | branch: master | Filip Roséen <filip at atch.se> | Sat Jul 21 19:00:19 2018 +0200| [fd40560a02a81a346e9fbe755c67c794c5a2ed58] | committer: Jean-Baptiste Kempf

input: input: always DEMUX_GET_TIME before --stop-time check

In order for --stop-time to work as it is intended, we must compare
the threshold to where the demuxer says it is. By introducing an
explicit DEMUX_GET_TIME before said logic we have some good
guarantees, such as:

 - Jumps due to --input-repeat does not result in premature EOF
   of playback because input_priv(i_time)->i_time not yet having
   received an update between the jump and our stop-check.

 - The --stop-time value is correct respected even if we have not yet
   reached the update threshold introduced in 7adcf5f7c6.

fixes: #20833
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
(cherry picked from commit 1f51babddb8644d1f1db0d1438e3357eae4f7019)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 src/input/input.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 4de864717a..0cb2729a40 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -558,15 +558,22 @@ bool input_Stopped( input_thread_t *input )
  */
 static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed )
 {
-    int i_ret;
     input_thread_private_t* p_priv = input_priv(p_input);
     demux_t *p_demux = p_priv->master->p_demux;
+    int i_ret = VLC_DEMUXER_SUCCESS;
 
     *pb_changed = false;
 
-    if( p_priv->i_stop > 0 && p_priv->i_time >= p_priv->i_stop )
-        i_ret = VLC_DEMUXER_EOF;
-    else
+    if( p_priv->i_stop > 0 )
+    {
+        if( demux_Control( p_demux, DEMUX_GET_TIME, &p_priv->i_time ) )
+            p_priv->i_time = 0;
+
+        if( p_priv->i_stop <= p_priv->i_time )
+            i_ret = VLC_DEMUXER_EOF;
+    }
+
+    if( i_ret == VLC_DEMUXER_SUCCESS )
         i_ret = demux_Demux( p_demux );
 
     i_ret = i_ret > 0 ? VLC_DEMUXER_SUCCESS : ( i_ret < 0 ? VLC_DEMUXER_EGENERIC : VLC_DEMUXER_EOF);



More information about the vlc-commits mailing list