Commit e9dea57b authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

chromecast: only lock once when checking the current app

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent b84d8384
......@@ -276,21 +276,23 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
{
json_value applications = (*p_data)["status"]["applications"];
const json_value *p_app = NULL;
vlc_mutex_locker locker(&lock);
for (unsigned i = 0; i < applications.u.array.length; ++i)
{
std::string appId(applications[i]["appId"]);
if (appId == APP_ID)
{
p_app = &applications[i];
vlc_mutex_lock(&lock);
if (appTransportId.empty())
appTransportId = std::string(applications[i]["transportId"]);
vlc_mutex_unlock(&lock);
const char *pz_transportId = applications[i]["transportId"];
if (pz_transportId != NULL)
{
appTransportId = std::string(pz_transportId);
p_app = &applications[i];
}
break;
}
}
vlc_mutex_lock(&lock);
if ( p_app )
{
if (!appTransportId.empty()
......@@ -318,7 +320,6 @@ void intf_sys_t::processMessage(const castchannel::CastMessage &msg)
}
}
vlc_mutex_unlock(&lock);
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment