diff options
author | François Laignel <fengalin@free.fr> | 2022-07-30 13:18:30 +0300 |
---|---|---|
committer | Sebastian Dröge <slomo@coaxion.net> | 2022-08-09 16:17:21 +0300 |
commit | 833331ab66ce19f9f14c691b42b6a0e52b33d80f (patch) | |
tree | afe30b8f7e4e88a58ef15d08ef7da6be1fdcd384 /generic/threadshare/src/runtime | |
parent | 374671cb6fb9c15daf601522f8f1a63fe135c0dc (diff) |
ts/Task: wake up after the triggering event is pushed
The scheduler is awaken when aborting a task loop, but not after
a triggering event is pushed. This can cause throttling to induce
long state transitions for pipelines with many streams.
Observed for Unprepare with:
GST_DEBUG=ts-benchmark:4 ../../target/debug/examples/benchmark 2000 ts-udpsrc 2 20 5000
Diffstat (limited to 'generic/threadshare/src/runtime')
-rw-r--r-- | generic/threadshare/src/runtime/task.rs | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/generic/threadshare/src/runtime/task.rs b/generic/threadshare/src/runtime/task.rs index 13d8e4d9a..761af91ab 100644 --- a/generic/threadshare/src/runtime/task.rs +++ b/generic/threadshare/src/runtime/task.rs @@ -353,25 +353,14 @@ impl TaskInner { } })?; + self.context.as_ref().unwrap().wake_up(); + Ok(ack_rx) } - /// Aborts the task iteration loop ASAP. - /// - /// When the iteration loop is throttling, the call to `abort` - /// on the `loop_abort_handle` returns immediately, but the - /// actual `Future` for the iteration loop is aborted only when - /// the scheduler throttling completes. - /// - /// This function aborts the task iteration loop and awakes the - /// iteration scheduler. fn abort_task_loop(&mut self) { if let Some(loop_abort_handle) = self.loop_abort_handle.take() { loop_abort_handle.abort(); - - if let Some(context) = self.context.as_ref() { - context.wake_up(); - } } } } @@ -508,6 +497,10 @@ impl Task { inner.state = TaskState::Unpreparing; + if let Some(prepare_abort_handle) = inner.prepare_abort_handle.take() { + prepare_abort_handle.abort(); + } + inner.abort_task_loop(); let _ = inner.trigger(Trigger::Unprepare).unwrap(); @@ -515,11 +508,6 @@ impl Task { let state_machine_handle = inner.state_machine_handle.take(); let context = inner.context.take().unwrap(); - - if let Some(prepare_abort_handle) = inner.prepare_abort_handle.take() { - prepare_abort_handle.abort(); - } - drop(inner); match state_machine_handle { |