Skip to content

Commit

Permalink
GstEnginePipeline: Check that state is actually NULL before finishing…
Browse files Browse the repository at this point in the history
… pipeline

Possible fix for #1582
  • Loading branch information
jonaski committed Nov 9, 2024
1 parent a0dd2c6 commit ba28592
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/engine/gstenginepipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ bool GstEnginePipeline::Finish() {

Disconnect();

if (state() == GST_STATE_NULL) {
if (IsStateNull()) {
finished_ = true;
}
else {
Expand Down Expand Up @@ -1784,6 +1784,19 @@ qint64 GstEnginePipeline::position() const {

}

bool GstEnginePipeline::IsStateNull() const {

if (!pipeline_) return true;

GstState s = GST_STATE_NULL, sp = GST_STATE_NULL;
if (gst_element_get_state(pipeline_, &s, &sp, kGstStateTimeoutNanosecs) == GST_STATE_CHANGE_FAILURE) {
return false;
}

return s == GST_STATE_NULL;

}

QFuture<GstStateChangeReturn> GstEnginePipeline::SetStateAsync(const GstState state) {

qLog(Debug) << "Setting pipeline" << id() << "state to" << GstStateText(state);
Expand Down
1 change: 1 addition & 0 deletions src/engine/gstenginepipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class GstEnginePipeline : public QObject {
private:
static QString GstStateText(const GstState state);
GstElement *CreateElement(const QString &factory_name, const QString &name, GstElement *bin, QString &error) const;
bool IsStateNull() const;
bool InitAudioBin(QString &error);
void SetupVolume(GstElement *element);

Expand Down

0 comments on commit ba28592

Please sign in to comment.