[phonon-backend-gstreamer] upstream fixes for gapless/repeat issues seen in amarok (#841941)
Rex Dieter
rdieter at fedoraproject.org
Thu Jul 26 14:03:11 UTC 2012
commit 3ca66d3e36c2df3c0a0dbffb30e03694e2d892f0
Author: Rex Dieter <rdieter at fedoraproject.org>
Date: Thu Jul 26 09:06:46 2012 -0500
upstream fixes for gapless/repeat issues seen in amarok (#841941)
...ool-to-track-whether-abouttofinish-is-run.patch | 59 +++++++++++++++++++
...ipgapless-and-wake-the-condition-iff-abou.patch | 39 +++++++++++++
...-setNextSource-iff-abouttofinish-is-activ.patch | 61 ++++++++++++++++++++
0004-warning.patch | 26 ++++++++
phonon-backend-gstreamer.spec | 16 +++++-
5 files changed, 200 insertions(+), 1 deletions(-)
---
diff --git a/0001-introduce-bool-to-track-whether-abouttofinish-is-run.patch b/0001-introduce-bool-to-track-whether-abouttofinish-is-run.patch
new file mode 100644
index 0000000..c43ac14
--- /dev/null
+++ b/0001-introduce-bool-to-track-whether-abouttofinish-is-run.patch
@@ -0,0 +1,59 @@
+From a13ae0338ce6e5b1ddd40b04b18ef77287488a51 Mon Sep 17 00:00:00 2001
+From: Harald Sitter <sitter at kde.org>
+Date: Thu, 26 Jul 2012 15:10:47 +0200
+Subject: [PATCH 1/4] introduce bool to track whether abouttofinish is running
+ and reset skipping
+
+---
+ gstreamer/mediaobject.cpp | 4 ++++
+ gstreamer/mediaobject.h | 3 +++
+ 2 files changed, 7 insertions(+)
+
+diff --git a/gstreamer/mediaobject.cpp b/gstreamer/mediaobject.cpp
+index dab18ba..ded4bcd 100644
+--- a/gstreamer/mediaobject.cpp
++++ b/gstreamer/mediaobject.cpp
+@@ -79,6 +79,7 @@ MediaObject::MediaObject(Backend *backend, QObject *parent)
+ , m_skippingEOS(false)
+ , m_skipGapless(false)
+ , m_doingEOS(false)
++ , m_handlingAboutToFinish(false)
+ {
+ qRegisterMetaType<GstCaps*>("GstCaps*");
+ qRegisterMetaType<State>("State");
+@@ -846,6 +847,7 @@ void MediaObject::handleAboutToFinish()
+ DEBUG_BLOCK;
+ debug() << "About to finish";
+ m_aboutToFinishLock.lock();
++ m_handlingAboutToFinish = true;
+ emit aboutToFinish();
+ // Three seconds should be more than enough for any application to get their act together.
+ // Any longer than that and they have bigger issues. If Phonon does no supply a next source
+@@ -858,8 +860,10 @@ void MediaObject::handleAboutToFinish()
+ }
+ } else {
+ debug() << "Skipping gapless audio";
++ m_skippingEOS = false;
+ }
+ m_skipGapless = false;
++ m_handlingAboutToFinish = false;
+ m_aboutToFinishLock.unlock();
+ }
+
+diff --git a/gstreamer/mediaobject.h b/gstreamer/mediaobject.h
+index 62374a2..be62eda 100644
+--- a/gstreamer/mediaobject.h
++++ b/gstreamer/mediaobject.h
+@@ -283,6 +283,9 @@ private:
+
+ qint64 m_lastTime;
+ bool m_skipGapless;
++
++ /*** Tracks whereever the MO is actively handling an aboutToFinish CB right now. */
++ bool m_handlingAboutToFinish;
+ };
+ }
+ } //namespace Phonon::Gstreamer
+--
+1.7.11.2
+
diff --git a/0002-only-set-skipgapless-and-wake-the-condition-iff-abou.patch b/0002-only-set-skipgapless-and-wake-the-condition-iff-abou.patch
new file mode 100644
index 0000000..b7fa43c
--- /dev/null
+++ b/0002-only-set-skipgapless-and-wake-the-condition-iff-abou.patch
@@ -0,0 +1,39 @@
+From 12cdb007c036fe6c03f592b7cc5f976440cd99b9 Mon Sep 17 00:00:00 2001
+From: Harald Sitter <sitter at kde.org>
+Date: Thu, 26 Jul 2012 15:11:18 +0200
+Subject: [PATCH 2/4] only set skipgapless and wake the condition iff
+ abouttofinish is active
+
+---
+ gstreamer/mediaobject.cpp | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/gstreamer/mediaobject.cpp b/gstreamer/mediaobject.cpp
+index ded4bcd..957f7fd 100644
+--- a/gstreamer/mediaobject.cpp
++++ b/gstreamer/mediaobject.cpp
+@@ -817,10 +817,17 @@ void MediaObject::setMetaData(QMultiMap<QString, QString> newData)
+ void MediaObject::requestState(Phonon::State state)
+ {
+ DEBUG_BLOCK;
+- m_aboutToFinishLock.tryLock();
+- m_skipGapless = true;
+- m_aboutToFinishWait.wakeAll();
+- m_aboutToFinishLock.unlock();
++ // Only abort handling here iff the handler is active.
++ if (m_aboutToFinishLock.tryLock()) {
++ // Note that this is not condition to unlocking, so the nesting is
++ // necessary.
++ if (m_handlingAboutToFinish) {
++ qDebug() << "Aborting aboutToFinish handling.";
++ m_skipGapless = true;
++ m_aboutToFinishWait.wakeAll();
++ }
++ m_aboutToFinishLock.unlock();
++ }
+ debug() << state;
+ switch (state) {
+ case Phonon::PlayingState:
+--
+1.7.11.2
+
diff --git a/0003-only-handle-setNextSource-iff-abouttofinish-is-activ.patch b/0003-only-handle-setNextSource-iff-abouttofinish-is-activ.patch
new file mode 100644
index 0000000..96992b0
--- /dev/null
+++ b/0003-only-handle-setNextSource-iff-abouttofinish-is-activ.patch
@@ -0,0 +1,61 @@
+From 70cc6e14d2f36a88a4202142fb1a723b76f9ac5d Mon Sep 17 00:00:00 2001
+From: Harald Sitter <sitter at 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
+
diff --git a/0004-warning.patch b/0004-warning.patch
new file mode 100644
index 0000000..b6551bb
--- /dev/null
+++ b/0004-warning.patch
@@ -0,0 +1,26 @@
+From 122c6556917bf154c3d78613802046fa63a74523 Mon Sep 17 00:00:00 2001
+From: Harald Sitter <sitter at kde.org>
+Date: Thu, 26 Jul 2012 15:13:50 +0200
+Subject: [PATCH 4/4] warning--
+
+---
+ gstreamer/mediaobject.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gstreamer/mediaobject.cpp b/gstreamer/mediaobject.cpp
+index 8ba8574..170c34b 100644
+--- a/gstreamer/mediaobject.cpp
++++ b/gstreamer/mediaobject.cpp
+@@ -77,8 +77,8 @@ MediaObject::MediaObject(Backend *backend, QObject *parent)
+ , m_waitingForNextSource(false)
+ , m_waitingForPreviousSource(false)
+ , m_skippingEOS(false)
+- , m_skipGapless(false)
+ , m_doingEOS(false)
++ , m_skipGapless(false)
+ , m_handlingAboutToFinish(false)
+ {
+ qRegisterMetaType<GstCaps*>("GstCaps*");
+--
+1.7.11.2
+
diff --git a/phonon-backend-gstreamer.spec b/phonon-backend-gstreamer.spec
index 55d3e4c..388ef43 100644
--- a/phonon-backend-gstreamer.spec
+++ b/phonon-backend-gstreamer.spec
@@ -3,7 +3,7 @@ Summary: Gstreamer phonon backend
Name: phonon-backend-gstreamer
Epoch: 2
Version: 4.6.1
-Release: 2%{?dist}
+Release: 3%{?dist}
Group: System Environment/Libraries
License: LGPLv2+
URL: http://phonon.kde.org/
@@ -16,6 +16,12 @@ Source0: ftp://ftp.kde.org/pub/kde/stable/phonon/phonon-backend-gstreamer/%{vers
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+## upstream patches
+Patch101: 0001-introduce-bool-to-track-whether-abouttofinish-is-run.patch
+Patch102: 0002-only-set-skipgapless-and-wake-the-condition-iff-abou.patch
+Patch103: 0003-only-handle-setNextSource-iff-abouttofinish-is-activ.patch
+Patch104: 0004-warning.patch
+
BuildRequires: automoc4
BuildRequires: cmake
BuildRequires: pkgconfig(gstreamer-0.10)
@@ -50,6 +56,11 @@ Requires: qt4%{?_isa} >= %{_qt4_version}
%prep
%setup -q -n phonon-backend-gstreamer-%{version}
+%patch101 -p1 -b .0001
+%patch102 -p1 -b .0002
+%patch103 -p1 -b .0003
+%patch104 -p1 -b .0004
+
%build
mkdir -p %{_target_platform}
@@ -93,6 +104,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null ||:
%changelog
+* Thu Jul 26 2012 Rex Dieter <rdieter at fedoraproject.org> 2:4.6.1-3
+- upstream fixes for gapless/repeat issues seen in amarok (#841941)
+
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2:4.6.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
More information about the scm-commits
mailing list