cec: hold a lock in CCECProcessor::SetHDMIPort()
authorLars Op den Kamp <lars@opdenkamp.eu>
Tue, 3 Jan 2012 14:50:48 +0000 (15:50 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Tue, 3 Jan 2012 14:50:48 +0000 (15:50 +0100)
src/lib/CECProcessor.cpp
src/lib/CECProcessor.h

index bcaea356f210b55676232e55ebfd9dab8b023939..6b401252f2bf289d958b4c69aecbcf4a13b3f7b9 100644 (file)
@@ -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;
 }
index a688befb290ac5ea1fe0a4b29807902c8fe7d01f..8c007b8aeacbbf54fc416d19f34d20a15eb9f135 100644 (file)
@@ -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);