-
-
Notifications
You must be signed in to change notification settings - Fork 240
Refactor DelayedReader startup #771
Copy link
Copy link
Labels
C-refactoringcategory: Refactoringcategory: Refactoringeasy hacksSolution requires minimal project contextSolution requires minimal project contexthelp wantedLooking for contributorsLooking for contributorsmost wantedNeeded most among other help-wanted issuesNeeded most among other help-wanted issues
Metadata
Metadata
Assignees
Labels
C-refactoringcategory: Refactoringcategory: Refactoringeasy hacksSolution requires minimal project contextSolution requires minimal project contexthelp wantedLooking for contributorsLooking for contributorsmost wantedNeeded most among other help-wanted issuesNeeded most among other help-wanted issues
Type
Projects
Status
Help wanted
DelayedReader is pipeline elements that inserts initial delay in the stream, by accumulating packets until there is enough of them, and only then forwarding them.
LatencyTuner is a class that monitors and adjusts latency on fly.
Currently, they work independently. DelayedReader unconditionally inserts initial delay and then enters "normal" mode (just forwards packets through it). We want to change it, so that LatencyTuner will decide when initial delay is done and tell DelayedReader to finish delay and enter normal mode.
Steps
Rework
DelayedReader. Removetarget_delayparameter and instead add new methodsis_started()andstart(). Until start() is called,DelayedReaderaccumulates packets. When it's called, it enters normal mode.Update
LatencyTuner. Add new methodcan_start(). It starts returning true whenactual_latencycalculated inupdate_stream()became>= target_latency.Update
LatencyMonitor. It is a class that glues multiple latency-related classes together. Pass a reference to DelayedReader to LatencyMonitor. Inpre_read_(), check if DelayedReaderis_started(). If not, ask LatencyTuner if wecan_start(). If yes,start()Delay reader.After this, all tests (except unit tests for DelayedReader) should continue working without modification. roc_pipeline tests cover initial delay, so if they pass, we've done everything right.