[vlc-commits] input: input: always DEMUX_GET_TIME before --stop-time check
Filip Roséen
git at videolan.org
Sun Jul 22 03:53:51 CEST 2018
vlc | branch: master | Filip Roséen <filip at atch.se> | Sat Jul 21 19:00:19 2018 +0200| [1f51babddb8644d1f1db0d1438e3357eae4f7019] | committer: Rémi Denis-Courmont
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>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1f51babddb8644d1f1db0d1438e3357eae4f7019
---
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 994a05b941..e84b024c24 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -582,15 +582,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