[vlc-commits] chromecast: don't load input while stopping

Thomas Guillem git at videolan.org
Fri Jan 26 14:27:16 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Jan 26 11:07:20 2018 +0100| [e4e41ab27137d3ca3cbbc7f6ab633010a16394fd] | committer: Jean-Baptiste Kempf

chromecast: don't load input while stopping

But wait for the stop command to be processed.

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

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

 modules/stream_out/chromecast/chromecast.h        |  1 +
 modules/stream_out/chromecast/chromecast_ctrl.cpp | 11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index b1b1e8510a..2555ea7c34 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -86,6 +86,7 @@ enum States
     Playing,
     Paused,
     Seeking,
+    Stopping,
     // Something went wrong and the connection is dead.
     Dead,
 };
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 83a9142419..9602c6369d 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -70,6 +70,8 @@ static const char* StateToStr( States s )
         return "Paused";
     case Seeking:
         return "Seeking";
+    case Stopping:
+        return "Stopping";
     case Dead:
         return "Dead";
     }
@@ -129,6 +131,7 @@ intf_sys_t::~intf_sys_t()
     case Playing:
     case Paused:
     case Seeking:
+    case Stopping:
         // Generate the close messages.
         m_communication.msgReceiverClose( m_appTransportId );
         /* fallthrough */
@@ -158,6 +161,10 @@ void intf_sys_t::setHasInput( const std::string mime_type )
 
     this->m_mime = mime_type;
 
+    /* new input: clear message queue */
+    std::queue<QueueableMessages> empty;
+    std::swap(m_msgQueue, empty);
+
     waitAppStarted();
     if ( m_state == Dead )
     {
@@ -242,6 +249,7 @@ void intf_sys_t::mainLoop()
             {
                 case Stop:
                     m_communication.msgPlayerStop( m_appTransportId, m_mediaSessionId );
+                    setState( Stopping );
                     break;
                 case Seek:
                 {
@@ -675,7 +683,8 @@ void intf_sys_t::setPauseState(bool paused)
 void intf_sys_t::waitAppStarted()
 {
     while ( m_state == Connected || m_state == Launching ||
-            m_state == Authenticating || m_state == Connecting )
+            m_state == Authenticating || m_state == Connecting ||
+            m_state == Stopping )
     {
         if ( m_state == Connected )
         {



More information about the vlc-commits mailing list