Watchdog class monitors audio stream and terminates session if it detects that there is no playback during specified timeout, or there is constant stuttering.
There is one problem with current implementation. Pipeline design implies that at the very beginning of the session, there is no playback (all samples are zero) until the initial buffer of N samples is accumulated, where N is target latency.
It means that if watchdog no_playback timeout (aka blank timeout) is smaller than the target latency, then it's always triggered at start, and the session is always terminated.
Solution
The fix is simple: at the very beginning, watchdog should enter "warmup" phase when timeouts are not triggered.
Warmup phase should end when:
N samples are read through watchdog, where N is warmup duration is set in watchdog config (it should be configured in nanoseconds)
OR, when the first non-blank frame is read
In roc_pipeline, we should set watchdog warmup parameter equal to the configured target latency.
Testing
Before the fix, in roc-recv, if --no-play-timeout is smaller than --sess-latency, the session will be constantly terminated and restarted. After the fix, it should work fine.
Problem
Watchdog class monitors audio stream and terminates session if it detects that there is no playback during specified timeout, or there is constant stuttering.
There is one problem with current implementation. Pipeline design implies that at the very beginning of the session, there is no playback (all samples are zero) until the initial buffer of N samples is accumulated, where N is target latency.
It means that if watchdog no_playback timeout (aka blank timeout) is smaller than the target latency, then it's always triggered at start, and the session is always terminated.
Solution
The fix is simple: at the very beginning, watchdog should enter "warmup" phase when timeouts are not triggered.
Warmup phase should end when:
In roc_pipeline, we should set watchdog warmup parameter equal to the configured target latency.
Testing
Before the fix, in
roc-recv
, if--no-play-timeout
is smaller than--sess-latency
, the session will be constantly terminated and restarted. After the fix, it should work fine.E.g.:
Before the fix, there is no playback, and you will see frequent messages like this:
We also need to update unit tests: