Add gstreamer stream discoverer workaround for Windows

- gst_discoverer_stop seem to block
This commit is contained in:
Jonas Kvinge 2019-09-08 21:07:56 +02:00
parent c0ebbc8e2f
commit 795f95d855
1 changed files with 11 additions and 6 deletions

View File

@ -126,7 +126,9 @@ GstEnginePipeline::~GstEnginePipeline() {
}
if (discoverer_) {
#ifndef Q_OS_WIN
gst_discoverer_stop(discoverer_);
#endif
g_object_unref(discoverer_);
}
@ -412,9 +414,11 @@ bool GstEnginePipeline::InitAudioBin() {
gst_object_unref(bus);
// Add request to discover the stream
if (discoverer_) {
if (!gst_discoverer_discover_uri_async(discoverer_, stream_url_.toStdString().c_str())) {
qLog(Error) << "Failed to start stream discovery for" << stream_url_;
}
}
return true;
@ -446,10 +450,11 @@ bool GstEnginePipeline::InitFromUrl(const QByteArray &stream_url, const QUrl ori
// Setting up a discoverer
discoverer_ = gst_discoverer_new(kDiscoveryTimeoutS * GST_SECOND, NULL);
if (!discoverer_) return false;
if (discoverer_) {
CHECKED_GCONNECT(G_OBJECT(discoverer_), "discovered", &StreamDiscovered, this);
CHECKED_GCONNECT(G_OBJECT(discoverer_), "finished", &StreamDiscoveryFinished, this);
gst_discoverer_start(discoverer_);
}
if (!InitAudioBin()) return false;