gstengine: Fix InitFromString return value
GstEnginePipeline::InitFromString was attempting to link the decoder and audio bins twice and returning the result of the failed second attempt as it's own status. The return value was also being ignored by the caller.
This commit is contained in:
parent
0393d865ca
commit
a012e7e273
@ -831,17 +831,19 @@ shared_ptr<GstEnginePipeline> GstEngine::CreatePipeline(
|
|||||||
shared_ptr<GstEnginePipeline> ret = CreatePipeline();
|
shared_ptr<GstEnginePipeline> ret = CreatePipeline();
|
||||||
|
|
||||||
if (req.url_.scheme() == "hypnotoad") {
|
if (req.url_.scheme() == "hypnotoad") {
|
||||||
ret->InitFromString(kHypnotoadPipeline);
|
if (!ret->InitFromString(kHypnotoadPipeline)) {
|
||||||
return ret;
|
qLog(Error) << "Could not initialize pipeline" << kHypnotoadPipeline;
|
||||||
|
ret.reset();
|
||||||
|
}
|
||||||
|
} else if (req.url_.scheme() == "enterprise") {
|
||||||
|
if (!ret->InitFromString(kEnterprisePipeline)) {
|
||||||
|
qLog(Error) << "Could not initialize pipeline" << kEnterprisePipeline;
|
||||||
|
ret.reset();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!ret->InitFromReq(req, end_nanosec)) ret.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.url_.scheme() == "enterprise") {
|
|
||||||
ret->InitFromString(kEnterprisePipeline);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ret->InitFromReq(req, end_nanosec)) ret.reset();
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ GstElement* GstEnginePipeline::CreateDecodeBinFromString(const char* pipeline) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GstEnginePipeline::Init() {
|
bool GstEnginePipeline::InitAudioBin() {
|
||||||
// Here we create all the parts of the gstreamer pipeline - from the source
|
// Here we create all the parts of the gstreamer pipeline - from the source
|
||||||
// to the sink. The parts of the pipeline are split up into bins:
|
// to the sink. The parts of the pipeline are split up into bins:
|
||||||
// uri decode bin -> audio bin
|
// uri decode bin -> audio bin
|
||||||
@ -489,8 +489,6 @@ bool GstEnginePipeline::Init() {
|
|||||||
bus_cb_id_ = gst_bus_add_watch(bus, BusCallback, this);
|
bus_cb_id_ = gst_bus_add_watch(bus, BusCallback, this);
|
||||||
gst_object_unref(bus);
|
gst_object_unref(bus);
|
||||||
|
|
||||||
MaybeLinkDecodeToAudio();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,7 +516,7 @@ bool GstEnginePipeline::InitFromString(const QString& pipeline) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Init()) return false;
|
if (!InitAudioBin()) return false;
|
||||||
return gst_element_link(new_bin, audiobin_);
|
return gst_element_link(new_bin, audiobin_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,7 +543,12 @@ bool GstEnginePipeline::InitFromReq(const MediaPlaybackRequest& req,
|
|||||||
// Decode bin
|
// Decode bin
|
||||||
if (!ReplaceDecodeBin(url)) return false;
|
if (!ReplaceDecodeBin(url)) return false;
|
||||||
|
|
||||||
return Init();
|
if (!InitAudioBin()) return false;
|
||||||
|
|
||||||
|
// Link decoder and audio bins if decoder bin already has a src pad.
|
||||||
|
MaybeLinkDecodeToAudio();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstEnginePipeline::~GstEnginePipeline() {
|
GstEnginePipeline::~GstEnginePipeline() {
|
||||||
|
@ -151,7 +151,7 @@ class GstEnginePipeline : public QObject {
|
|||||||
|
|
||||||
QString ParseTag(GstTagList* list, const char* tag) const;
|
QString ParseTag(GstTagList* list, const char* tag) const;
|
||||||
|
|
||||||
bool Init();
|
bool InitAudioBin();
|
||||||
GstElement* CreateDecodeBinFromString(const char* pipeline);
|
GstElement* CreateDecodeBinFromString(const char* pipeline);
|
||||||
GstElement* CreateDecodeBinFromUrl(const QUrl& url);
|
GstElement* CreateDecodeBinFromUrl(const QUrl& url);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user