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

Thomas Guillem git at videolan.org
Fri Jan 18 17:53:59 CET 2019


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

sout: chromecast: remove unused pause_delay hack

Not needed anymore since timestamps are reset by the muxer.

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

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

 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 a83d1f7898..c85b3d8db4 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -318,12 +318,6 @@ static int ProxySend(sout_stream_t *p_stream, sout_stream_id_sys_t *id,
             }
         }
 
-        mtime_t pause_delay = p_sys->p_intf->getPauseDelay();
-        if( p_buffer->i_pts != VLC_TS_INVALID )
-            p_buffer->i_pts -= pause_delay;
-        if( p_buffer->i_dts != VLC_TS_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 a9ecee9c33..7781708fcd 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -198,7 +198,7 @@ private:
     bool processMessage(const castchannel::CastMessage &msg);
     void queueMessage( QueueableMessages msg );
 
-    void setPauseState(bool paused, mtime_t delay);
+    void setPauseState(bool paused);
     bool isFinishedPlaying();
     bool isStateError() const;
     bool isStatePlaying() const;
@@ -233,7 +233,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, mtime_t delay);
+    static void set_pause_state(void*, bool paused);
 
     static void set_meta(void*, vlc_meta_t *p_meta);
 
@@ -298,7 +298,6 @@ private:
     mtime_t           m_cc_time_last_request_date;
     mtime_t           m_cc_time_date;
     mtime_t           m_cc_time;
-    mtime_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 f5a378812d..32a399c36b 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, mtime_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 3c752cf20d..6f086842ed 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -115,7 +115,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_TS_INVALID )
  , m_cc_time( VLC_TS_INVALID )
- , m_pause_delay( VLC_TS_INVALID )
  , m_pingRetriesLeft( PING_WAIT_RETRIES )
 {
     m_communication = new ChromecastCommunication( p_this,
@@ -409,7 +408,6 @@ void intf_sys_t::setHasInput( const std::string mime_type )
     m_cc_time_last_request_date = VLC_TS_INVALID;
     m_cc_time_date = VLC_TS_INVALID;
     m_cc_time = VLC_TS_INVALID;
-    m_pause_delay = VLC_TS_INVALID;
     m_mediaSessionId = 0;
 
     tryLoad();
@@ -1119,7 +1117,7 @@ void intf_sys_t::setDemuxEnabled(bool enabled,
     }
 }
 
-void intf_sys_t::setPauseState(bool paused, mtime_t delay)
+void intf_sys_t::setPauseState(bool paused)
 {
     vlc_mutex_locker locker( &m_lock );
     if ( m_mediaSessionId == 0 || paused == m_paused || !m_communication )
@@ -1128,22 +1126,13 @@ void intf_sys_t::setPauseState(bool paused, mtime_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 );
 }
 
-mtime_t intf_sys_t::getPauseDelay()
-{
-    vlc_mutex_locker locker( &m_lock );
-    return m_pause_delay;
-}
-
 unsigned int intf_sys_t::getHttpStreamPort() const
 {
     return m_httpd.m_port;
@@ -1257,10 +1246,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, mtime_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 68c46a050f..d8fde46272 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_TS_INVALID )
-        ,m_pause_delay( VLC_TS_INVALID )
     {
         init();
     }
@@ -179,9 +177,9 @@ struct demux_cc
                                          cc_input_arg { false } );
     }
 
-    void setPauseState(bool paused, mtime_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 );
     }
 
     mtime_t getCCTime()
@@ -348,8 +346,6 @@ struct demux_cc
 
         case DEMUX_SET_POSITION:
         {
-            m_pause_delay = m_pause_date = VLC_TS_INVALID;
-
             double pos = va_arg( args, double );
             /* Force unprecise seek */
             int ret = demux_Control( p_demux->p_next, DEMUX_SET_POSITION, pos, false );
@@ -362,8 +358,6 @@ struct demux_cc
         }
         case DEMUX_SET_TIME:
         {
-            m_pause_delay = m_pause_date = VLC_TS_INVALID;
-
             mtime_t time = va_arg( args, int64_t );
             /* Force unprecise seek */
             int ret = demux_Control( p_demux->p_next, DEMUX_SET_TIME, time, false );
@@ -382,21 +376,7 @@ struct demux_cc
             int paused = va_arg( ap, int );
             va_end( ap );
 
-            if (paused)
-            {
-                if (m_pause_date == VLC_TS_INVALID)
-                    m_pause_date = mdate();
-            }
-            else
-            {
-                if (m_pause_date != VLC_TS_INVALID)
-                {
-                    m_pause_delay += mdate() - m_pause_date;
-                    m_pause_date = VLC_TS_INVALID;
-                }
-            }
-
-            setPauseState( paused != 0, m_pause_delay );
+            setPauseState( paused != 0 );
             break;
         }
         case DEMUX_SET_ES:
@@ -469,8 +449,6 @@ protected:
     double        m_last_pos;
     mtime_t       m_start_time;
     mtime_t       m_last_time;
-    mtime_t       m_pause_date;
-    mtime_t       m_pause_delay;
 };
 
 static void on_paused_changed_cb( void *data, bool paused )



More information about the vlc-commits mailing list