[vlc-commits] chromecast: don't queue Seek messages

Thomas Guillem git at videolan.org
Wed Feb 7 23:45:52 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb  7 16:19:42 2018 +0100| [2a252aa3005c9bd65ea772948bd9261c02ea33ed] | committer: Jean-Baptiste Kempf

chromecast: don't queue Seek messages

In order to allow finer handling of seek errors.

Partial revert of commit 58921590a200ab8cfbdbd6d9ef56995908f9c323.

(cherry picked from commit 91376817885fa673f50e51286655e707c428d371)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/stream_out/chromecast/chromecast.h        |  2 --
 modules/stream_out/chromecast/chromecast_ctrl.cpp | 32 ++++++-----------------
 2 files changed, 8 insertions(+), 26 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index 41f8b61f2e..46c8bddcdd 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -158,7 +158,6 @@ struct intf_sys_t
     enum QueueableMessages
     {
         Stop,
-        Seek
     };
     intf_sys_t(vlc_object_t * const p_this, int local_port, std::string device_addr,
                int device_port, vlc_interrupt_t *, httpd_host_t *);
@@ -272,7 +271,6 @@ private:
     mtime_t           m_time_playback_started;
     /* local playback time of the input when playback started/resumed */
     mtime_t           m_ts_local_start;
-    mtime_t           m_ts_seek;
     mtime_t           m_length;
 
     /* shared structure with the demux-filter */
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 70a9a1ccef..ea6da6f734 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -110,7 +110,6 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device
  , m_art_idx(0)
  , m_time_playback_started( VLC_TS_INVALID )
  , m_ts_local_start( VLC_TS_INVALID )
- , m_ts_seek( VLC_TS_INVALID )
  , m_length( VLC_TS_INVALID )
  , m_pingRetriesLeft( PING_WAIT_RETRIES )
 {
@@ -455,8 +454,6 @@ void intf_sys_t::queueMessage( QueueableMessages msg )
     vlc_interrupt_raise( m_ctl_thread_interrupt );
 }
 
-
-
 /*****************************************************************************
  * Chromecast thread
  *****************************************************************************/
@@ -500,23 +497,6 @@ void intf_sys_t::mainLoop()
                         }
                     }
                     break;
-                case Seek:
-                {
-                    if( !isStatePlaying() || m_mediaSessionId == 0 || m_ts_seek == VLC_TS_INVALID )
-                        break;
-                    char current_time[32];
-                    if( snprintf( current_time, sizeof(current_time), "%.3f",
-                                  double( m_ts_seek ) / 1000000.0 ) >= (int)sizeof(current_time) )
-                    {
-                        msg_Err( m_module, "snprintf() truncated string for mediaSessionId" );
-                        current_time[sizeof(current_time) - 1] = '\0';
-                    }
-                    m_ts_seek = VLC_TS_INVALID;
-                    /* send a fake time to seek to, to make sure the device flushes its buffers */
-                    m_communication.msgPlayerSeek( m_appTransportId, m_mediaSessionId, current_time );
-                    setState( Seeking );
-                    break;
-                }
             }
             m_msgQueue.pop();
         }
@@ -924,7 +904,6 @@ void intf_sys_t::requestPlayerStop()
     vlc_mutex_locker locker(&m_lock);
 
     m_request_load = false;
-    m_ts_seek = VLC_TS_INVALID;
 
     if( !isStatePlaying() )
         return;
@@ -943,8 +922,14 @@ bool intf_sys_t::requestPlayerSeek(mtime_t pos)
     vlc_mutex_locker locker(&m_lock);
     if( !isStatePlaying() || m_mediaSessionId == 0 )
         return false;
-    m_ts_seek = pos;
-    queueMessage( Seek );
+
+    char current_time[32];
+    if( snprintf( current_time, sizeof(current_time), "%.3f",
+                  double( pos ) / 1000000.0 ) >= (int)sizeof(current_time) )
+        return false;
+
+    m_communication.msgPlayerSeek( m_appTransportId, m_mediaSessionId, current_time );
+    setState( Seeking );
 
     return true;
 }
@@ -1038,7 +1023,6 @@ void intf_sys_t::setState( States state )
             if (m_on_seek_done != NULL)
                 m_on_seek_done(m_on_seek_done_data);
 
-        States old_state = m_state;
         m_state = state;
 
         switch( m_state )



More information about the vlc-commits mailing list