splitmuxsink: deadlock when reference stream has low framerate
@xclaesse
Submitted by Xavier Claessens Link to original bug (#764635)
Description
I'm using splitmuxsink with matroskamux and filesink.
I've got 3 input streams:
- video: 8 jpeg frames per sec, so all buffers are keyframes
- audio: normal mp4a
- subtitle: 1 buffer every second
-
During the 1s it waits for a subtitle buffer, check_queue_length() allows audio/video queues to grow because the subtitle queued_bufs is empty, see the /* If another stream is starving, grow */ case. The 7th GOP arrives at t=875ms.
-
At t=900ms (so between 2 GOPs), the subtitle buf arrives, it's blocked in handle_mq_input() waiting for the next GOP to complete, because max_in_running_time=875ms.
-
At t=1000ms the 8th GOP arrives, max_in_running_time is set to 1000ms.
-
The subtitle buffer enters the queue but cannot go out yet because max_out_running_time is still 875ms because audio/subtitle streams didn't catchup to 1000ms yet.
-
Since the subtitle queued_bufs is not empty anymore, the audio queue is not allowed to grow anymore. So next audio buffer needed to catchup to 1000ms are blocked because its queue is full.