[vlc-commits] sout: chromecast: remove unused pause_delay hack

Thomas Guillem git at videolan.org
Thu Jan 17 11:42:13 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jan 17 11:41:13 2019 +0100| [628a7d3a3f71604ae3e47192b65232049cc9267a] | committer: Thomas Guillem

sout: chromecast: remove unused pause_delay hack

Not needed anymore since timestamps are reset by the muxer.

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

 modules/stream_out/chromecast/cast.cpp             |  6 -----
 modules/stream_out/chromecast/chromecast.h         |  5 ++--
 modules/stream_out/chromecast/chromecast_common.h  |  2 +-
 modules/stream_out/chromecast/chromecast_ctrl.cpp  | 17 +++----------
 modules/stream_out/chromecast/chromecast_demux.cpp | 28 +++-------------------
 5 files changed, 9 insertions(+), 49 deletions(-)

diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index fbcd33ac0e..627397894e 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -292,12 +292,6 @@ static int ProxySend(sout_stream_t *p_stream, void *_id, block_t *p_buffer)
             }
         }
 
-        vlc_tick_t pause_delay = p_sys->p_intf->getPauseDelay();
-        if( p_buffer->i_pts != VLC_TICK_INVALID )
-            p_buffer->i_pts -= pause_delay;
-        if( p_buffer->i_dts != VLC_TICK_INVALID )
-            p_buffer->i_dts -= pause_delay;
-
         int ret = sout_StreamIdSend(p_stream->p_next, id, p_buffer);
         if (ret == VLC_SUCCESS && !p_sys->cc_has_input)
         {
diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index 144212f4ee..e7724bed1c 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -200,7 +200,7 @@ private:
     bool processMessage(const castchannel::CastMessage &msg);
     void queueMessage( QueueableMessages msg );
 
-    void setPauseState(bool paused, vlc_tick_t delay);
+    void setPauseState(bool paused);
     bool isFinishedPlaying();
     bool isStateError() const;
     bool isStatePlaying() const;
@@ -235,7 +235,7 @@ private:
     static void send_input_event(void *, enum cc_input_event event, union cc_input_arg arg);
     static void set_demux_enabled(void *, bool, on_paused_changed_itf, void *);
 
-    static void set_pause_state(void*, bool paused, vlc_tick_t delay);
+    static void set_pause_state(void*, bool paused);
 
     static void set_meta(void*, vlc_meta_t *p_meta);
 
@@ -301,7 +301,6 @@ private:
     vlc_tick_t        m_cc_time_last_request_date;
     vlc_tick_t        m_cc_time_date;
     vlc_tick_t        m_cc_time;
-    vlc_tick_t        m_pause_delay;
 
     /* shared structure with the demux-filter */
     chromecast_common      m_common;
diff --git a/modules/stream_out/chromecast/chromecast_common.h b/modules/stream_out/chromecast/chromecast_common.h
index fb0c9ddac1..35abdd00a4 100644
--- a/modules/stream_out/chromecast/chromecast_common.h
+++ b/modules/stream_out/chromecast/chromecast_common.h
@@ -66,7 +66,7 @@ typedef struct
 
     void (*pf_send_input_event)(void*, enum cc_input_event, union cc_input_arg);
 
-    void (*pf_set_pause_state)(void*, bool paused, vlc_tick_t delay);
+    void (*pf_set_pause_state)(void*, bool paused);
 
     void (*pf_set_meta)(void*, vlc_meta_t *p_meta);
 
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 78d6945be4..7d816d0491 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -116,7 +116,6 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device
  , m_art_idx(0)
  , m_cc_time_date( VLC_TICK_INVALID )
  , m_cc_time( VLC_TICK_INVALID )
- , m_pause_delay( VLC_TICK_INVALID )
  , m_pingRetriesLeft( PING_WAIT_RETRIES )
 {
     m_communication = new ChromecastCommunication( p_this,
@@ -402,7 +401,6 @@ void intf_sys_t::setHasInput( const std::string mime_type )
     m_cc_time_last_request_date = VLC_TICK_INVALID;
     m_cc_time_date = VLC_TICK_INVALID;
     m_cc_time = VLC_TICK_INVALID;
-    m_pause_delay = VLC_TICK_INVALID;
     m_mediaSessionId = 0;
 
     tryLoad();
@@ -1114,7 +1112,7 @@ void intf_sys_t::setDemuxEnabled(bool enabled,
     }
 }
 
-void intf_sys_t::setPauseState(bool paused, vlc_tick_t delay)
+void intf_sys_t::setPauseState(bool paused)
 {
     vlc::threads::mutex_locker lock( m_lock );
     if ( m_mediaSessionId == 0 || paused == m_paused || !m_communication )
@@ -1123,22 +1121,13 @@ void intf_sys_t::setPauseState(bool paused, vlc_tick_t delay)
     m_paused = paused;
     msg_Info( m_module, "%s state", paused ? "paused" : "playing" );
     if ( !paused )
-    {
         m_last_request_id =
             m_communication->msgPlayerPlay( m_appTransportId, m_mediaSessionId );
-        m_pause_delay = delay;
-    }
     else if ( m_state != Paused )
         m_last_request_id =
             m_communication->msgPlayerPause( m_appTransportId, m_mediaSessionId );
 }
 
-vlc_tick_t intf_sys_t::getPauseDelay()
-{
-    vlc::threads::mutex_locker lock( m_lock );
-    return m_pause_delay;
-}
-
 unsigned int intf_sys_t::getHttpStreamPort() const
 {
     return m_httpd.m_port;
@@ -1253,10 +1242,10 @@ void intf_sys_t::send_input_event(void *pt, enum cc_input_event event, union cc_
     return p_this->sendInputEvent(event, arg);
 }
 
-void intf_sys_t::set_pause_state(void *pt, bool paused, vlc_tick_t delay)
+void intf_sys_t::set_pause_state(void *pt, bool paused)
 {
     intf_sys_t *p_this = static_cast<intf_sys_t*>(pt);
-    p_this->setPauseState( paused, delay );
+    p_this->setPauseState( paused );
 }
 
 void intf_sys_t::set_meta(void *pt, vlc_meta_t *p_meta)
diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index bc1e2f9a17..0fe3be6179 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -45,8 +45,6 @@ struct demux_cc
         :p_demux(demux)
         ,p_renderer(renderer)
         ,m_enabled( true )
-        ,m_pause_date( VLC_TICK_INVALID )
-        ,m_pause_delay( VLC_TICK_INVALID )
     {
         init();
     }
@@ -177,9 +175,9 @@ struct demux_cc
                                          cc_input_arg { false } );
     }
 
-    void setPauseState(bool paused, vlc_tick_t delay)
+    void setPauseState(bool paused)
     {
-        p_renderer->pf_set_pause_state( p_renderer->p_opaque, paused, delay );
+        p_renderer->pf_set_pause_state( p_renderer->p_opaque, paused );
     }
 
     vlc_tick_t getCCTime()
@@ -346,8 +344,6 @@ struct demux_cc
 
         case DEMUX_SET_POSITION:
         {
-            m_pause_delay = m_pause_date = VLC_TICK_INVALID;
-
             double pos = va_arg( args, double );
             /* Force unprecise seek */
             int ret = demux_Control( p_demux->p_next, DEMUX_SET_POSITION, pos, false );
@@ -360,8 +356,6 @@ struct demux_cc
         }
         case DEMUX_SET_TIME:
         {
-            m_pause_delay = m_pause_date = VLC_TICK_INVALID;
-
             vlc_tick_t time = va_arg( args, vlc_tick_t );
             /* Force unprecise seek */
             int ret = demux_Control( p_demux->p_next, DEMUX_SET_TIME, time, false );
@@ -380,21 +374,7 @@ struct demux_cc
             int paused = va_arg( ap, int );
             va_end( ap );
 
-            if (paused)
-            {
-                if (m_pause_date == VLC_TICK_INVALID)
-                    m_pause_date = vlc_tick_now();
-            }
-            else
-            {
-                if (m_pause_date != VLC_TICK_INVALID)
-                {
-                    m_pause_delay += vlc_tick_now() - m_pause_date;
-                    m_pause_date = VLC_TICK_INVALID;
-                }
-            }
-
-            setPauseState( paused != 0, m_pause_delay );
+            setPauseState( paused != 0 );
             break;
         }
         case DEMUX_SET_ES:
@@ -442,8 +422,6 @@ protected:
     double        m_last_pos;
     vlc_tick_t    m_start_time;
     vlc_tick_t    m_last_time;
-    vlc_tick_t    m_pause_date;
-    vlc_tick_t    m_pause_delay;
 };
 
 static void on_paused_changed_cb( void *data, bool paused )



More information about the vlc-commits mailing list