cec: process buffered messages too
[deb_libcec.git] / src / lib / CECProcessor.cpp
index 7e8af29c0a88abce63037bb29e2e614f5e5133f5..18e0e6128e2ec1bcbc84e6a23802ad5ccefb9f56 100644 (file)
@@ -98,7 +98,8 @@ void *CCECProcessor::Process(void)
 
     {
       CLockObject lock(&m_mutex);
-      if (m_communication->IsOpen() && m_communication->Read(msg, 50))
+      if (m_frameBuffer.Pop(msg) ||
+          (m_communication->IsOpen() && m_communication->Read(msg, 50)))
         bParseFrame = ParseMessage(msg);
 
       bParseFrame &= !IsStopped();
@@ -186,7 +187,7 @@ bool CCECProcessor::Transmit(const cec_command &data, bool bWaitForAck /* = true
   bool bReturn(false);
   LogOutput(data);
 
-  CCECAdapterMessage output(data);
+  CCECAdapterMessagePtr output(new CCECAdapterMessage(data));
 
   CLockObject lock(&m_mutex);
   if (!m_communication || !m_communication->Write(output))
@@ -195,7 +196,7 @@ bool CCECProcessor::Transmit(const cec_command &data, bool bWaitForAck /* = true
   if (bWaitForAck)
   {
     bool bError(false);
-    if ((bReturn = WaitForAck(&bError, output.size(), 1000)) == false)
+    if ((bReturn = WaitForAck(&bError, output->size(), 1000)) == false)
       m_controller->AddLog(CEC_LOG_ERROR, "did not receive ack");
   }
   else