Blob Blame Raw
From 70cc6e14d2f36a88a4202142fb1a723b76f9ac5d Mon Sep 17 00:00:00 2001
From: Harald Sitter <sitter@kde.org>
Date: Thu, 26 Jul 2012 15:12:17 +0200
Subject: [PATCH 3/4] only handle setNextSource iff abouttofinish is active

if we go to stopped after phonon handed us a source it will simply set
it as regular source, so we do not need any special handling for the
next source call at all
---
 gstreamer/mediaobject.cpp | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/gstreamer/mediaobject.cpp b/gstreamer/mediaobject.cpp
index 957f7fd..8ba8574 100644
--- a/gstreamer/mediaobject.cpp
+++ b/gstreamer/mediaobject.cpp
@@ -339,23 +339,26 @@ void MediaObject::autoDetectSubtitle()
 void MediaObject::setNextSource(const MediaSource &source)
 {
     DEBUG_BLOCK;
-    debug() << "Got next source. Waiting for end of current.";
 
     m_aboutToFinishLock.lock();
-
-    // If next source is valid and is not empty (an empty source is sent by Phonon if
-    // there are no more sources) skip EOS for the current source in order to seamlessly
-    // pass to the next source.
-    if (source.type() == Phonon::MediaSource::Invalid ||
-        source.type() == Phonon::MediaSource::Empty)
-        m_skippingEOS = false;
-    else
-        m_skippingEOS = true;
-
-    m_waitingForNextSource = true;
-    m_waitingForPreviousSource = false;
-    m_pipeline->setSource(source);
-    m_aboutToFinishWait.wakeAll();
+    if (m_handlingAboutToFinish) {
+        debug() << "Got next source. Waiting for end of current.";
+
+        // If next source is valid and is not empty (an empty source is sent by Phonon if
+        // there are no more sources) skip EOS for the current source in order to seamlessly
+        // pass to the next source.
+        if (source.type() == Phonon::MediaSource::Invalid ||
+            source.type() == Phonon::MediaSource::Empty)
+            m_skippingEOS = false;
+        else
+            m_skippingEOS = true;
+
+        m_waitingForNextSource = true;
+        m_waitingForPreviousSource = false;
+        m_pipeline->setSource(source);
+        m_aboutToFinishWait.wakeAll();
+    } else
+        qDebug() << "Ignoring source as no aboutToFinish handling is in progress.";
     m_aboutToFinishLock.unlock();
 }
 
-- 
1.7.11.2