jitterbuffer: Flushing and timer thread
Almost all rtsp seeking validate tests are failing right now, one part of it is related to how jitterbuffer handles flushing.
The timer thread is:
- Started in READY=>PAUSED (but actually blocked until PAUSED=>PLAYING)
- Stopped in PAUSED=>READY (but the blocked variable is set in PLAYING=>PAUSED)
The problem is that this assumes that the jitterbuffer:
- Will only ever go to PLAYING once
- Will never ever get any FLUSH events (resetting the contents)
- By extension will never see more than one EOS
If the jitterbuffer receives a flush start/stop events:
- It won't reset all the timers (especially the EOS one)
- It won't stop waiting and put itself in a "before anything arrived" state
When the pads are deactivated (PAUSED=>READY) that thread won't put itself in a "Ready to be stoped" state either which can cause various deadlocks