[vlc-commits] chromecast: fix pause at startup with music tracks

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


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb  7 15:52:12 2018 +0100| [de032b0178e9a467e34f6e31bfa5e7b726f080b2] | committer: Jean-Baptiste Kempf

chromecast: fix pause at startup with music tracks

State goes from Buffering to Paused then to Playing when loading a music track.

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

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

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

diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index 1b84543cf3..41f8b61f2e 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -251,6 +251,7 @@ private:
     ChromecastCommunication m_communication;
     std::queue<QueueableMessages> m_msgQueue;
     States m_state;
+    bool m_played_once;
     bool m_request_stop;
     bool m_request_load;
     bool m_eof;
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 2fc56f52ac..70a9a1ccef 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -97,6 +97,7 @@ intf_sys_t::intf_sys_t(vlc_object_t * const p_this, int port, std::string device
  , m_on_paused_changed_data( NULL )
  , m_communication( p_this, device_addr.c_str(), device_port )
  , m_state( Authenticating )
+ , m_played_once( false )
  , m_request_stop( false )
  , m_request_load( false )
  , m_eof( false )
@@ -334,6 +335,7 @@ void intf_sys_t::setHasInput( const std::string mime_type )
 
     prepareHttpArtwork();
 
+    m_played_once = false;
     m_eof = false;
     m_mediaSessionId = 0;
     m_request_load = true;
@@ -1046,12 +1048,13 @@ void intf_sys_t::setState( States state )
                 tryLoad();
                 break;
             case Paused:
-                if (m_on_paused_changed != NULL)
+                if (m_played_once && m_on_paused_changed != NULL)
                     m_on_paused_changed(m_on_paused_changed_data, true);
                 break;
             case Playing:
-                if (m_on_paused_changed != NULL && old_state == Paused)
+                if (m_played_once && m_on_paused_changed != NULL)
                     m_on_paused_changed(m_on_paused_changed_data, false);
+                m_played_once = true;
                 break;
             default:
                 break;



More information about the vlc-commits mailing list