Skip to content

Commit

Permalink
dev-qt/qtmultimedia: Gstreamer: fix stream buffering
Browse files Browse the repository at this point in the history
Package-Manager: Portage-2.3.100, Repoman-2.3.22
Signed-off-by: Andreas Sturmlechner <[email protected]>
  • Loading branch information
a17r committed Jun 10, 2020
1 parent 8ededff commit 79b01c6
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From d8d072417b08dd75734b3f0aa86c3a49db934770 Mon Sep 17 00:00:00 2001
From: Roman Valov <[email protected]>
Date: Mon, 13 Apr 2020 12:54:09 +0000
Subject: [PATCH] Gstreamer: fix stream buffering

Gstreamer client should handle GST_MESSAGE_BUFFERING to play and pause
streams based on buffer-percent value and Qt does it properly.
However `updateSessionState` of QGstreamerPlayerControl was implemented
to go back into playing state each time session state becomes paused.
That behavior resulted into choppy stream playback.
Fix with condition to un-pause playback only if it's already buffered.

Fixes: QTBUG-83417
Change-Id: Ida4a9e2e196de00050bdc64725fa818c7e939785
Reviewed-by: VaL Doroshchuk <[email protected]>
---
src/gsttools/qgstreamerplayercontrol.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gsttools/qgstreamerplayercontrol.cpp b/src/gsttools/qgstreamerplayercontrol.cpp
index 165978288..d65102e2f 100644
--- a/src/gsttools/qgstreamerplayercontrol.cpp
+++ b/src/gsttools/qgstreamerplayercontrol.cpp
@@ -439,8 +439,10 @@ void QGstreamerPlayerControl::updateSessionState(QMediaPlayer::State state)
}
m_pendingSeekPosition = -1;

- if (m_currentState == QMediaPlayer::PlayingState)
- m_session->play();
+ if (m_currentState == QMediaPlayer::PlayingState) {
+ if (m_mediaStatus == QMediaPlayer::BufferedMedia)
+ m_session->play();
+ }
}

updateMediaStatus();
--
2.16.3
72 changes: 72 additions & 0 deletions dev-qt/qtmultimedia/qtmultimedia-5.14.2-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
inherit qt5-build

DESCRIPTION="Multimedia (audio, video, radio, camera) library for the Qt5 framework"

if [[ ${QT5_BUILD_TYPE} == release ]]; then
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
fi

IUSE="alsa gles2-only gstreamer openal pulseaudio qml widgets"

RDEPEND="
~dev-qt/qtcore-${PV}
~dev-qt/qtgui-${PV}[gles2-only=]
~dev-qt/qtnetwork-${PV}
alsa? ( media-libs/alsa-lib )
gstreamer? (
dev-libs/glib:2
media-libs/gstreamer:1.0
media-libs/gst-plugins-bad:1.0
media-libs/gst-plugins-base:1.0
)
pulseaudio? ( media-sound/pulseaudio[glib] )
qml? (
~dev-qt/qtdeclarative-${PV}
gles2-only? ( ~dev-qt/qtgui-${PV}[egl] )
openal? ( media-libs/openal )
)
widgets? (
~dev-qt/qtopengl-${PV}
~dev-qt/qtwidgets-${PV}[gles2-only=]
)
"
DEPEND="${RDEPEND}
gstreamer? ( x11-base/xorg-proto )
"

PATCHES=(
"${FILESDIR}/${P}-gstreamer-buffering.patch" # QTBUG-83417
)

src_prepare() {
sed -i -e '/CONFIG\s*+=/ s/optimize_full//' \
src/multimedia/multimedia.pro || die

qt_use_disable_config openal openal \
src/imports/imports.pro

qt_use_disable_mod qml quick \
src/src.pro \
src/plugins/plugins.pro

qt_use_disable_mod widgets widgets \
src/src.pro \
src/gsttools/gsttools.pro \
src/plugins/gstreamer/common.pri

qt5-build_src_prepare
}

src_configure() {
local myqmakeargs=(
--
$(qt_use alsa)
$(qt_use gstreamer)
$(qt_use pulseaudio)
)
qt5-build_src_configure
}

0 comments on commit 79b01c6

Please sign in to comment.