GstEnginePipeline: Check that state is actually NULL before finishing pipeline

Possible fix for #1582
This commit is contained in:
Jonas Kvinge 2024-11-09 19:30:28 +01:00
parent a0dd2c66e4
commit ba285925ca
2 changed files with 15 additions and 1 deletions

View File

@ -404,7 +404,7 @@ bool GstEnginePipeline::Finish() {
Disconnect();
if (state() == GST_STATE_NULL) {
if (IsStateNull()) {
finished_ = true;
}
else {
@ -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);

View File

@ -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);