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

Thomas Guillem git at videolan.org
Thu Feb 22 18:00:59 CET 2018


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

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

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

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

 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 cac33bc5a9..efe77c3ec2 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -137,7 +137,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()
@@ -261,9 +267,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;
         }
@@ -352,7 +359,7 @@ struct demux_sys_t
             if( ret != VLC_SUCCESS )
                 return ret;
 
-            initTimes();
+            resetTimes();
             resetDemuxEof();
             return VLC_SUCCESS;
         }
@@ -366,7 +373,7 @@ struct demux_sys_t
             if( ret != VLC_SUCCESS )
                 return ret;
 
-            initTimes();
+            resetTimes();
             resetDemuxEof();
             return VLC_SUCCESS;
         }
@@ -400,7 +407,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