[vlc-commits] chromecast: queue stop only when needed

2018-02-22 Thread Thomas Guillem
vlc/vlc-3.0 | branch: master | Thomas Guillem  | Tue Feb 20 
17:01:53 2018 +0100| [d351ec7c5e81aac83bc613e63d37b8dff24f87ce] | committer: 
Thomas Guillem

chromecast: queue stop only when needed

(cherry picked from commit 4eca90c1b8acab4cc219235c44a220c49e442be9)
Signed-off-by: Thomas Guillem 

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

 modules/stream_out/chromecast/chromecast.h|  1 +
 modules/stream_out/chromecast/chromecast_ctrl.cpp | 40 +++
 2 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast.h 
b/modules/stream_out/chromecast/chromecast.h
index 3b8df10768..232d72202b 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -199,6 +199,7 @@ private:
 bool isStatePlaying() const;
 bool isStateReady() const;
 void tryLoad();
+void doStop();
 
 void setMeta( vlc_meta_t *p_meta );
 
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp 
b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 9ebb6e55a2..e98b171300 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -496,16 +496,7 @@ void intf_sys_t::mainLoop()
 switch ( msg )
 {
 case Stop:
-if( isStatePlaying() )
-{
-if ( m_mediaSessionId == 0 )
-m_request_stop = true;
-else
-{
-m_communication.msgPlayerStop( m_appTransportId, 
m_mediaSessionId );
-setState( Stopping );
-}
-}
+doStop();
 break;
 }
 m_msgQueue.pop();
@@ -909,16 +900,37 @@ bool intf_sys_t::handleMessages()
 return true;
 }
 
+void intf_sys_t::doStop()
+{
+if( !isStatePlaying() )
+return;
+
+if ( m_mediaSessionId == 0 )
+m_request_stop = true;
+else
+{
+m_communication.msgPlayerStop( m_appTransportId, m_mediaSessionId );
+setState( Stopping );
+}
+}
+
 void intf_sys_t::requestPlayerStop()
 {
 vlc_mutex_locker locker(&m_lock);
 
-m_request_load = false;
+std::queue empty;
+std::swap(m_msgQueue, empty);
 
-if( !isStatePlaying() )
-return;
+m_request_load = false;
 
-queueMessage( Stop );
+if( vlc_killed() )
+{
+if( !isStatePlaying() )
+return;
+queueMessage( Stop );
+}
+else
+doStop();
 }
 
 States intf_sys_t::state() const

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] chromecast: queue stop only when needed

2018-02-22 Thread Thomas Guillem
vlc | branch: master | Thomas Guillem  | Tue Feb 20 17:01:53 
2018 +0100| [4eca90c1b8acab4cc219235c44a220c49e442be9] | committer: Thomas 
Guillem

chromecast: queue stop only when needed

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

 modules/stream_out/chromecast/chromecast.h|  1 +
 modules/stream_out/chromecast/chromecast_ctrl.cpp | 40 +++
 2 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast.h 
b/modules/stream_out/chromecast/chromecast.h
index 3b8df10768..232d72202b 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -199,6 +199,7 @@ private:
 bool isStatePlaying() const;
 bool isStateReady() const;
 void tryLoad();
+void doStop();
 
 void setMeta( vlc_meta_t *p_meta );
 
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp 
b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 9ebb6e55a2..e98b171300 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -496,16 +496,7 @@ void intf_sys_t::mainLoop()
 switch ( msg )
 {
 case Stop:
-if( isStatePlaying() )
-{
-if ( m_mediaSessionId == 0 )
-m_request_stop = true;
-else
-{
-m_communication.msgPlayerStop( m_appTransportId, 
m_mediaSessionId );
-setState( Stopping );
-}
-}
+doStop();
 break;
 }
 m_msgQueue.pop();
@@ -909,16 +900,37 @@ bool intf_sys_t::handleMessages()
 return true;
 }
 
+void intf_sys_t::doStop()
+{
+if( !isStatePlaying() )
+return;
+
+if ( m_mediaSessionId == 0 )
+m_request_stop = true;
+else
+{
+m_communication.msgPlayerStop( m_appTransportId, m_mediaSessionId );
+setState( Stopping );
+}
+}
+
 void intf_sys_t::requestPlayerStop()
 {
 vlc_mutex_locker locker(&m_lock);
 
-m_request_load = false;
+std::queue empty;
+std::swap(m_msgQueue, empty);
 
-if( !isStatePlaying() )
-return;
+m_request_load = false;
 
-queueMessage( Stop );
+if( vlc_killed() )
+{
+if( !isStatePlaying() )
+return;
+queueMessage( Stop );
+}
+else
+doStop();
 }
 
 States intf_sys_t::state() const

___
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits