From: Lars Op den Kamp Date: Tue, 3 Jan 2012 14:50:48 +0000 (+0100) Subject: cec: hold a lock in CCECProcessor::SetHDMIPort() X-Git-Tag: upstream/2.2.0~1^2~42^2~6 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=bebb19dc6b8a478b09e8023cc1cfdf670044f4ab;p=deb_libcec.git cec: hold a lock in CCECProcessor::SetHDMIPort() --- diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index bcaea35..6b40125 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -588,7 +588,7 @@ bool CCECProcessor::SetMenuState(cec_menu_state state, bool bSendUpdate /* = tru return true; } -bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress) +bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpdate /* = true */) { bool bWasActiveSource(false); CLockObject lock(&m_mutex); @@ -600,10 +600,11 @@ bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress) bWasActiveSource |= m_busDevices[iPtr]->IsActiveSource(); m_busDevices[iPtr]->SetInactiveSource(); m_busDevices[iPtr]->SetPhysicalAddress(iPhysicalAddress); - m_busDevices[iPtr]->TransmitPhysicalAddress(); + if (bSendUpdate) + m_busDevices[iPtr]->TransmitPhysicalAddress(); } - return bWasActiveSource ? SetActiveView() : true; + return bWasActiveSource && bSendUpdate ? SetActiveView() : true; } return false; } diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index a688bef..8c007b8 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -88,7 +88,7 @@ namespace CEC virtual bool TransmitInactiveSource(void); virtual bool SetLogicalAddress(cec_logical_address iLogicalAddress); virtual bool SetMenuState(cec_menu_state state, bool bSendUpdate = true); - virtual bool SetPhysicalAddress(uint16_t iPhysicalAddress); + virtual bool SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpdate = true); virtual bool SetActiveSource(uint16_t iStreamPath); virtual bool SwitchMonitoring(bool bEnable); virtual bool PollDevice(cec_logical_address iAddress);