From ba0766f0c010d37f8b372f40c8b3cb2864d6aba7 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Sun, 15 Oct 2017 12:23:46 +0200 Subject: [PATCH] fix gst playback --- libarmbox/playback_gst.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/libarmbox/playback_gst.cpp b/libarmbox/playback_gst.cpp index 5e34d5c..079074e 100644 --- a/libarmbox/playback_gst.cpp +++ b/libarmbox/playback_gst.cpp @@ -77,6 +77,35 @@ gint match_sinktype(const GValue *velement, const gchar *type) return strcmp(g_type_name(G_OBJECT_TYPE(element)), type); } +void playbinNotifySource(GObject *object, GParamSpec *unused, gpointer /*user_data*/) +{ + GstElement *source = NULL; + g_object_get(object, "source", &source, NULL); + + if (source) + { + if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "timeout") != 0) + { + GstElementFactory *factory = gst_element_get_factory(source); + if (factory) + { + const gchar *sourcename = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(factory)); + if (!strcmp(sourcename, "souphttpsrc")) + { + g_object_set(G_OBJECT(source), "timeout", HTTP_TIMEOUT, NULL); + } + } + } + + if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "ssl-strict") != 0) + { + g_object_set(G_OBJECT(source), "ssl-strict", FALSE, NULL); + } + + gst_object_unref(source); + } +} + GstBusSyncReply Gst_bus_call(GstBus * bus, GstMessage *msg, gpointer user_data) { gchar * sourceName; @@ -419,6 +448,8 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/, if(isHTTP) { + g_signal_connect (G_OBJECT (m_gst_playbin), "notify::source", G_CALLBACK (playbinNotifySource), NULL); + // set buffer size g_object_set(G_OBJECT(m_gst_playbin), "buffer-size", m_buffer_size, NULL); g_object_set(G_OBJECT(m_gst_playbin), "buffer-duration", 5LL * GST_SECOND, NULL);