1From 8656a0534fc8178138fa48ae1a165d43acd11a6f Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Fri, 26 Nov 2021 09:38:19 +0800
4Subject: [PATCH 17/17] gstreamer: Support choosing playbin2 and playbin3
5
6Neither of them is perfect.
7
8The playbin2 (decodebin2) cannot handle multiqueue overrun for some
9broken streams:
10https://bugzilla.gnome.org/show_bug.cgi?id=775474
11
12The playbin3 (decodebin3) might cause memory corruption or ghostpad
13activation deadlock in looping.
14
15So let's support choosing them by setting QT_GSTREAMER_PLAYBIN env to
16playbin or playbin3.
17
18Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
19---
20 src/gsttools/qgstreamerplayersession.cpp                        | 2 +-
21 .../gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp    | 2 +-
22 2 files changed, 2 insertions(+), 2 deletions(-)
23
24diff --git a/src/gsttools/qgstreamerplayersession.cpp b/src/gsttools/qgstreamerplayersession.cpp
25index b0a37f8..635b6e9 100755
26--- a/src/gsttools/qgstreamerplayersession.cpp
27+++ b/src/gsttools/qgstreamerplayersession.cpp
28@@ -120,7 +120,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
29
30 void QGstreamerPlayerSession::initPlaybin()
31 {
32-    m_playbin = gst_element_factory_make(QT_GSTREAMER_PLAYBIN_ELEMENT_NAME, nullptr);
33+    m_playbin = gst_element_factory_make(getenv("QT_GSTREAMER_PLAYBIN") ?: QT_GSTREAMER_PLAYBIN_ELEMENT_NAME, NULL);
34     if (m_playbin) {
35         //GST_PLAY_FLAG_NATIVE_VIDEO omits configuration of ffmpegcolorspace and videoscale,
36         //since those elements are included in the video output bin when necessary.
37diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp
38index d6b8ad7..6ad6849 100644
39--- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp
40+++ b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp
41@@ -91,7 +91,7 @@ QGstreamerAudioDecoderSession::QGstreamerAudioDecoderSession(QObject *parent)
42      m_durationQueries(0)
43 {
44     // Create pipeline here
45-    m_playbin = gst_element_factory_make(QT_GSTREAMER_PLAYBIN_ELEMENT_NAME, NULL);
46+    m_playbin = gst_element_factory_make(getenv("QT_GSTREAMER_PLAYBIN") ?: QT_GSTREAMER_PLAYBIN_ELEMENT_NAME, NULL);
47
48     if (m_playbin != 0) {
49         // Sort out messages
50--
512.20.1
52
53