[vlc-commits] chromecast: always quit thread in Dead state
Thomas Guillem
git at videolan.org
Thu Mar 29 10:23:07 CEST 2018
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Mar 29 10:12:23 2018 +0200| [f8040cd87db949e8bb708b2d80b4ca1fb12cf680] | committer: Thomas Guillem
chromecast: always quit thread in Dead state
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f8040cd87db949e8bb708b2d80b4ca1fb12cf680
---
modules/stream_out/chromecast/chromecast.h | 4 ++--
modules/stream_out/chromecast/chromecast_ctrl.cpp | 14 +++++++++-----
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/modules/stream_out/chromecast/chromecast.h b/modules/stream_out/chromecast/chromecast.h
index 5e93c70e18..0a550136ee 100644
--- a/modules/stream_out/chromecast/chromecast.h
+++ b/modules/stream_out/chromecast/chromecast.h
@@ -187,7 +187,7 @@ struct intf_sys_t
private:
bool handleMessages();
- void processMessage(const castchannel::CastMessage &msg);
+ bool processMessage(const castchannel::CastMessage &msg);
void queueMessage( QueueableMessages msg );
void setPauseState(bool paused, mtime_t delay);
@@ -212,7 +212,7 @@ private:
void mainLoop();
void processAuthMessage( const castchannel::CastMessage& msg );
void processHeartBeatMessage( const castchannel::CastMessage& msg );
- void processReceiverMessage( const castchannel::CastMessage& msg );
+ bool processReceiverMessage( const castchannel::CastMessage& msg );
void processMediaMessage( const castchannel::CastMessage& msg );
void processConnectionMessage( const castchannel::CastMessage& msg );
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 0703c841e5..4f7dc18ffb 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -505,7 +505,7 @@ void intf_sys_t::sendInputEvent(enum cc_input_event event, union cc_input_arg ar
* @param msg the CastMessage to process
* @return 0 if the message has been successfuly processed else -1
*/
-void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
+bool intf_sys_t::processMessage(const castchannel::CastMessage &msg)
{
const std::string & namespace_ = msg.namespace_();
@@ -513,12 +513,13 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
msg_Dbg( m_module, "processMessage: %s->%s %s", namespace_.c_str(), msg.destination_id().c_str(), msg.payload_utf8().c_str());
#endif
+ bool ret = true;
if (namespace_ == NAMESPACE_DEVICEAUTH)
processAuthMessage( msg );
else if (namespace_ == NAMESPACE_HEARTBEAT)
processHeartBeatMessage( msg );
else if (namespace_ == NAMESPACE_RECEIVER)
- processReceiverMessage( msg );
+ ret = processReceiverMessage( msg );
else if (namespace_ == NAMESPACE_MEDIA)
processMediaMessage( msg );
else if (namespace_ == NAMESPACE_CONNECTION)
@@ -527,6 +528,7 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
{
msg_Err( m_module, "Unknown namespace: %s", msg.namespace_().c_str());
}
+ return ret;
}
void intf_sys_t::queueMessage( QueueableMessages msg )
@@ -625,11 +627,12 @@ void intf_sys_t::processHeartBeatMessage( const castchannel::CastMessage& msg )
json_value_free(p_data);
}
-void intf_sys_t::processReceiverMessage( const castchannel::CastMessage& msg )
+bool intf_sys_t::processReceiverMessage( const castchannel::CastMessage& msg )
{
json_value *p_data = json_parse(msg.payload_utf8().c_str());
std::string type((*p_data)["type"]);
+ bool ret = true;
if (type == "RECEIVER_STATUS")
{
json_value applications = (*p_data)["status"]["applications"];
@@ -715,6 +718,7 @@ void intf_sys_t::processReceiverMessage( const castchannel::CastMessage& msg )
m_appTransportId = "";
m_mediaSessionId = 0;
setState( Dead );
+ ret = false;
}
else
{
@@ -723,6 +727,7 @@ void intf_sys_t::processReceiverMessage( const castchannel::CastMessage& msg )
}
json_value_free(p_data);
+ return ret;
}
void intf_sys_t::processMediaMessage( const castchannel::CastMessage& msg )
@@ -958,8 +963,7 @@ bool intf_sys_t::handleMessages()
}
castchannel::CastMessage msg;
msg.ParseFromArray(p_packet + PACKET_HEADER_LEN, i_payloadSize);
- processMessage(msg);
- return true;
+ return processMessage(msg);
}
void intf_sys_t::doStop()
More information about the vlc-commits
mailing list