cec-client: fixed - wait for the source switch to finish when cec-client is called...
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 11 Oct 2012 12:13:22 +0000 (14:13 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 11 Oct 2012 12:13:22 +0000 (14:13 +0200)
src/testclient/main.cpp

index d170bfa44a791be7606384ef6f2bc8cbfb7d5c8b..986884ee9276188a0a5ba273da4bf7d30ea33aa1 100644 (file)
@@ -537,6 +537,18 @@ bool ProcessCommandAS(ICECAdapter *parser, const string &command, string & UNUSE
   if (command == "as")
   {
     parser->SetActiveSource();
+    // wait for the source switch to finish for 15 seconds tops
+    if (g_bSingleCommand)
+    {
+      CTimeout timeout(15000);
+      bool bActiveSource(false);
+      while (timeout.TimeLeft() > 0 && !bActiveSource)
+      {
+        bActiveSource = parser->IsLibCECActiveSource();
+        if (!bActiveSource)
+          CEvent::Sleep(100);
+      }
+    }
     return true;
   }