Skip to content

threadshare/*src: rework pause/flush_start/flush_stop

This commit fixes several issues with the Ts*Src elements.

pause

The pause functions used cancel_task which breaks the Task loop at await points. For some elements, this implies making sure no item is being lost. Moreover, cancelling the Task also cancels downstream processing, which makes it difficult to ensure elements can handle all cases.

This commit reimplements Task::pause which allows completing the running loop iteration before pausing the loop.

See !277 (comment 439529)

In the Paused state, incoming items were rejected by TsAppSrc and DataQueue.

See !277 (comment 438455)

flush_start / flush_stop

  • FlushStart must engage items rejection and cancel the Task.
  • FlushStop must purge the internal stream & accept items again.
  • A Segment event must be sent before pushing a new Buffer after a flush is complete.

push_prelude

If the task was cancelled, push_prelude could set need_initial_events to true when the events weren't actually pushed yet.

Potential Buffer loss in TsAppSrc

TsAppSrc used to renew its internal channel which could cause Buffer loss when transitionning Playing -> Paused -> Playing.

See #98 (closed)

Fixes #98 (closed)

Edited by François Laignel

Merge request reports