[vlc-commits] chromecast: lock when sending a message
Thomas Guillem
git at videolan.org
Fri Feb 23 08:29:28 CET 2018
vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Feb 20 16:58:15 2018 +0100| [d7e4c677926bc835b881617e412a02bb87805c3a] | committer: Thomas Guillem
chromecast: lock when sending a message
(cherry picked from commit 39d6bca48e0cca42bedb26d9549a9b4c1328b40e)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=d7e4c677926bc835b881617e412a02bb87805c3a
---
modules/stream_out/chromecast/chromecast_ctrl.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index b33462e5e8..9ebb6e55a2 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -667,6 +667,8 @@ void intf_sys_t::processMediaMessage( const castchannel::CastMessage& msg )
json_value *p_data = json_parse(msg.payload_utf8().c_str());
std::string type((*p_data)["type"]);
+ vlc_mutex_locker locker( &m_lock );
+
if (type == "MEDIA_STATUS")
{
json_value status = (*p_data)["status"];
@@ -686,7 +688,6 @@ void intf_sys_t::processMediaMessage( const castchannel::CastMessage& msg )
std::string newPlayerState = (const char*)status[0]["playerState"];
std::string idleReason = (const char*)status[0]["idleReason"];
- vlc_mutex_locker locker( &m_lock );
if (newPlayerState == "IDLE" || newPlayerState.empty() == true )
{
@@ -797,7 +798,6 @@ void intf_sys_t::processMediaMessage( const castchannel::CastMessage& msg )
else if (type == "LOAD_FAILED")
{
msg_Err( m_module, "Media load failed");
- vlc_mutex_locker locker(&m_lock);
setState( LoadFailed );
}
else if (type == "LOAD_CANCELLED")
@@ -873,9 +873,9 @@ bool intf_sys_t::handleMessages()
else if ( b_timeout == true )
{
// If no commands were queued to be sent, we timed out. Let's ping the chromecast
+ vlc_mutex_locker locker(&m_lock);
if ( m_pingRetriesLeft == 0 )
{
- vlc_mutex_locker locker(&m_lock);
m_state = Dead;
msg_Warn( m_module, "No PING response from the chromecast" );
return false;
More information about the vlc-commits
mailing list