mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-30 17:14:58 +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) {
|
if (current_pipeline_ && current_pipeline_->id() == pipeline_id) {
|
||||||
|
|
||||||
FinishPipeline(current_pipeline_);
|
GstEnginePipelinePtr pipeline = current_pipeline_;
|
||||||
current_pipeline_ = GstEnginePipelinePtr();
|
current_pipeline_ = GstEnginePipelinePtr();
|
||||||
|
FinishPipeline(pipeline);
|
||||||
|
|
||||||
BufferingFinished();
|
BufferingFinished();
|
||||||
Q_EMIT StateChanged(State::Error);
|
Q_EMIT StateChanged(State::Error);
|
||||||
@ -962,7 +963,10 @@ void GstEngine::FinishPipeline(GstEnginePipelinePtr pipeline) {
|
|||||||
|
|
||||||
QObject::disconnect(&*pipeline, nullptr, this, nullptr);
|
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);
|
old_pipelines_.insert(pipeline_id, pipeline);
|
||||||
QObject::connect(&*pipeline, &GstEnginePipeline::Finished, this, [this, pipeline_id]() {
|
QObject::connect(&*pipeline, &GstEnginePipeline::Finished, this, [this, pipeline_id]() {
|
||||||
PipelineFinished(pipeline_id);
|
PipelineFinished(pipeline_id);
|
||||||
@ -975,12 +979,19 @@ void GstEngine::PipelineFinished(const int pipeline_id) {
|
|||||||
|
|
||||||
qLog(Debug) << "Pipeline" << pipeline_id << "finished";
|
qLog(Debug) << "Pipeline" << pipeline_id << "finished";
|
||||||
|
|
||||||
GstEnginePipelinePtr pipeline = old_pipelines_.value(pipeline_id);
|
if (old_pipelines_.contains(pipeline_id)) {
|
||||||
old_pipelines_.remove(pipeline_id);
|
GstEnginePipelinePtr pipeline = old_pipelines_.value(pipeline_id);
|
||||||
if (pipeline == fadeout_pause_pipeline_) {
|
old_pipelines_.remove(pipeline_id);
|
||||||
StopFadeoutPause();
|
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) {
|
if (current_pipeline_ && old_pipelines_.isEmpty() && delayed_state_ != State::Empty) {
|
||||||
switch (delayed_state_) {
|
switch (delayed_state_) {
|
||||||
@ -998,12 +1009,6 @@ void GstEngine::PipelineFinished(const int pipeline_id) {
|
|||||||
delayed_state_offset_nanosec_ = 0;
|
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) {
|
void GstEngine::UpdateScope(const int chunk_length) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user