task: do not resume when resume_receiver is cancelled

This could cause the state to go back to Started after
stop() was called, resulting in a panic in a subsequent
unprepare.
This commit is contained in:
Mathieu Duponchelle 2020-04-03 16:31:44 +02:00
parent a9b43da6cd
commit 9ec6a02e13

View file

@ -360,10 +360,16 @@ impl Task {
if let Some(resume_receiver) = resume_receiver.take() {
gst_trace!(RUNTIME_CAT, "Task loop paused");
let _ = resume_receiver.await;
gst_trace!(RUNTIME_CAT, "Resuming task loop");
inner_clone.lock().unwrap().state = TaskState::Started;
match resume_receiver.await {
Ok(_) => {
gst_trace!(RUNTIME_CAT, "Resuming task loop");
inner_clone.lock().unwrap().state = TaskState::Started;
}
Err(_) => {
gst_trace!(RUNTIME_CAT, "Resume cancelled");
break;
}
}
}
if func().await == glib::Continue(false) {