summaryrefslogtreecommitdiff
blob: 5d17b079613d88d055b81ed287b39d08cf05405a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From d8d072417b08dd75734b3f0aa86c3a49db934770 Mon Sep 17 00:00:00 2001
From: Roman Valov <roman.valov@gmail.com>
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 <valentyn.doroshchuk@qt.io>
---
 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