mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-29 16:49:27 +01:00
GstEngine: Improve pipeline finish handling
This commit is contained in:
parent
f59c6c356e
commit
3a5e5d4aaa
@ -631,8 +631,9 @@ void GstEngine::HandlePipelineError(const int pipeline_id, const int domain, con
|
||||
|
||||
if (current_pipeline_ && current_pipeline_->id() == pipeline_id) {
|
||||
|
||||
FinishPipeline(current_pipeline_);
|
||||
GstEnginePipelinePtr pipeline = current_pipeline_;
|
||||
current_pipeline_ = GstEnginePipelinePtr();
|
||||
FinishPipeline(pipeline);
|
||||
|
||||
BufferingFinished();
|
||||
Q_EMIT StateChanged(State::Error);
|
||||
@ -962,7 +963,10 @@ void GstEngine::FinishPipeline(GstEnginePipelinePtr pipeline) {
|
||||
|
||||
QObject::disconnect(&*pipeline, nullptr, this, nullptr);
|
||||
|
||||
if (!pipeline->Finish() && !old_pipelines_.contains(pipeline->id())) {
|
||||
if (pipeline->Finish()) {
|
||||
PipelineFinished(pipeline_id);
|
||||
}
|
||||
else if (!old_pipelines_.contains(pipeline->id())) {
|
||||
old_pipelines_.insert(pipeline_id, pipeline);
|
||||
QObject::connect(&*pipeline, &GstEnginePipeline::Finished, this, [this, pipeline_id]() {
|
||||
PipelineFinished(pipeline_id);
|
||||
@ -975,12 +979,19 @@ void GstEngine::PipelineFinished(const int pipeline_id) {
|
||||
|
||||
qLog(Debug) << "Pipeline" << pipeline_id << "finished";
|
||||
|
||||
GstEnginePipelinePtr pipeline = old_pipelines_.value(pipeline_id);
|
||||
old_pipelines_.remove(pipeline_id);
|
||||
if (pipeline == fadeout_pause_pipeline_) {
|
||||
StopFadeoutPause();
|
||||
if (old_pipelines_.contains(pipeline_id)) {
|
||||
GstEnginePipelinePtr pipeline = old_pipelines_.value(pipeline_id);
|
||||
old_pipelines_.remove(pipeline_id);
|
||||
if (pipeline == fadeout_pause_pipeline_) {
|
||||
StopFadeoutPause();
|
||||
}
|
||||
}
|
||||
|
||||
qLog(Debug) << (current_pipeline_ ? 1 : 0) + old_pipelines_.count() << "pipelines are active";
|
||||
|
||||
if (!current_pipeline_ && old_pipelines_.isEmpty()) {
|
||||
Q_EMIT Finished();
|
||||
}
|
||||
pipeline = GstEnginePipelinePtr();
|
||||
|
||||
if (current_pipeline_ && old_pipelines_.isEmpty() && delayed_state_ != State::Empty) {
|
||||
switch (delayed_state_) {
|
||||
@ -998,12 +1009,6 @@ void GstEngine::PipelineFinished(const int pipeline_id) {
|
||||
delayed_state_offset_nanosec_ = 0;
|
||||
}
|
||||
|
||||
qLog(Debug) << (current_pipeline_ ? 1 : 0) + old_pipelines_.count() << "pipelines are active";
|
||||
|
||||
if (!current_pipeline_ && old_pipelines_.isEmpty()) {
|
||||
Q_EMIT Finished();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GstEngine::UpdateScope(const int chunk_length) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user