ActiveAE: flush engine on flush stream if only one stream is active
authorunknown <fernetmenta@online.de>
Mon, 12 Aug 2013 12:59:38 +0000 (14:59 +0200)
committerunknown <fernetmenta@online.de>
Thu, 22 Aug 2013 06:48:13 +0000 (08:48 +0200)
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp
xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h

index 4326729..30af6e8 100644 (file)
@@ -1077,6 +1077,33 @@ void CActiveAE::SFlushStream(CActiveAEStream *stream)
   stream->m_streamPort->Purge();
   stream->m_bufferedTime = 0.0;
   stream->m_paused = true;
+
+  // flsuh the engine if we only have a single stream
+  if (m_streams.size() == 1)
+  {
+    m_sinkBuffers->Flush();
+    m_vizBuffers->Flush();
+
+    // send message to sink
+    Message *reply;
+    if (m_sink.m_controlPort.SendOutMessageSync(CSinkControlProtocol::FLUSH, 
+                                             &reply, 2000))
+    {
+      bool success = reply->signal == CSinkControlProtocol::ACC ? true : false;
+      if (!success)
+      {
+        CLog::Log(LOGERROR, "ActiveAE::%s - returned error on flush", __FUNCTION__);
+        m_extError = true;
+      }
+      reply->Release();
+    }
+    else
+    {
+      CLog::Log(LOGERROR, "ActiveAE::%s - failed to flush", __FUNCTION__);
+      m_extError = true;
+    }
+    m_stats.Reset(m_sinkFormat.m_sampleRate);
+  }
 }
 
 void CActiveAE::ClearDiscardedBuffers()
index 82854c2..4785c76 100644 (file)
@@ -167,6 +167,11 @@ void CActiveAESink::StateMachine(int signal, Protocol *port, Message *msg)
           msg->Reply(CSinkControlProtocol::ACC);
           return;
 
+        case CSinkControlProtocol::FLUSH:
+          ReturnBuffers();
+          msg->Reply(CSinkControlProtocol::ACC);
+          return;
+
         default:
           break;
         }
index 559179c..e241b03 100644 (file)
@@ -50,6 +50,7 @@ public:
     UNCONFIGURE,
     SILENCEMODE,
     VOLUME,
+    FLUSH,
     TIMEOUT,
   };
   enum InSignal