summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@qt.io>2018-01-28 21:26:36 +0100
committerChristian Stromme <christian.stromme@qt.io>2018-02-02 09:19:43 +0000
commit8846e6fb9f41bd283dd754a87bb704026f0f12cf (patch)
tree8e63d74df647f74541cde46d82bd4b8134703a31
parentf4ed0d4178ecdf50cdaca47716a5101a28494157 (diff)
downloadqtmultimedia-8846e6fb9f41bd283dd754a87bb704026f0f12cf.tar.gz
GStreamer: fix udpsrc timeout setting
The timeout's time unit has changed between 0.10 and 1.0, from microseconds to nanoseconds, but we were always passing the value in microseconds. This would cause an UDP stream to always timeout with GStreamer 1.0. Change-Id: I69786480d29854d3a030f9dbea15c69ee89f3dd5 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
index cc7aef367..a96da66f8 100644
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
+++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
@@ -1541,10 +1541,17 @@ void QGstreamerPlayerSession::playbinNotifySource(GObject *o, GParamSpec *p, gpo
//set timeout property to 30 seconds
const int timeout = 30;
if (qstrcmp(G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(source)), "GstUDPSrc") == 0) {
- //udpsrc timeout unit = microsecond
- //The udpsrc is always a live source.
- g_object_set(G_OBJECT(source), "timeout", G_GUINT64_CONSTANT(timeout*1000000), NULL);
+ quint64 convertedTimeout = timeout;
+#if GST_CHECK_VERSION(1,0,0)
+ // Gst 1.x -> nanosecond
+ convertedTimeout *= 1000000000;
+#else
+ // Gst 0.10 -> microsecond
+ convertedTimeout *= 1000000;
+#endif
+ g_object_set(G_OBJECT(source), "timeout", convertedTimeout, NULL);
self->m_sourceType = UDPSrc;
+ //The udpsrc is always a live source.
self->m_isLiveSource = true;
} else if (qstrcmp(G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(source)), "GstSoupHTTPSrc") == 0) {
//souphttpsrc timeout unit = second