[vlc-commits] chromecast: init first time/position after first demux() call

Thomas Guillem git at videolan.org
Fri Feb 23 08:29:53 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Feb 22 17:50:25 2018 +0100| [7a66401a0c3e8d94bdc78117d3c7c6f45eb63f99] | committer: Thomas Guillem

chromecast: init first time/position after first demux() call

Some demuxers give invalid results (0) just after a seek.

(cherry picked from commit ba48fe638ab3592aefb45945222a455b0dcde316)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/stream_out/chromecast/chromecast_demux.cpp | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index b923cb1272..f71ec8e9fd 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -138,7 +138,13 @@ struct demux_sys_t
         p_renderer->pf_set_on_paused_changed_cb(p_renderer->p_opaque,
                                                 on_paused_changed_cb, p_demux);
 
-        initTimes();
+        resetTimes();
+    }
+
+    void resetTimes()
+    {
+        m_start_time = m_last_time = -1;
+        m_start_pos = m_last_pos = -1.0f;
     }
 
     void initTimes()
@@ -262,9 +268,10 @@ struct demux_sys_t
         int ret = VLC_DEMUXER_SUCCESS;
         if( !m_demux_eof )
         {
-            if( m_start_time < 0 || m_start_pos < 0.0f )
-                initTimes();
             ret = demux_Demux( p_demux->p_next );
+            if( ret != VLC_DEMUXER_EGENERIC
+             && ( m_start_time < 0 || m_start_pos < 0.0f ) )
+                initTimes();
             if( ret == VLC_DEMUXER_EOF )
                 m_demux_eof = true;
         }
@@ -353,7 +360,7 @@ struct demux_sys_t
             if( ret != VLC_SUCCESS )
                 return ret;
 
-            initTimes();
+            resetTimes();
             resetDemuxEof();
             return VLC_SUCCESS;
         }
@@ -367,7 +374,7 @@ struct demux_sys_t
             if( ret != VLC_SUCCESS )
                 return ret;
 
-            initTimes();
+            resetTimes();
             resetDemuxEof();
             return VLC_SUCCESS;
         }
@@ -401,7 +408,7 @@ struct demux_sys_t
              * flush sout streams, make sout del/add called right away and
              * clear CC buffers. */
             seekBack(m_last_time, m_last_pos);
-            initTimes();
+            resetTimes();
             resetDemuxEof();
             break;
         case DEMUX_FILTER_ENABLE:



More information about the vlc-commits mailing list