streamsynchronizer: gap event processing problem for mpegdash multi period case
0001-streamsynchronizer-manage-all-stream-segment-changes.patch
Recently, I have confirmed that when testing the mpegdash stream of the ondemand profile, there is a problem in gap event processing in the streamsynchronizer.
This problem can be reproduced when an audio / video stream, such as mpegdash, has its own demuxer(multi source) and a period change occurs at the end.
The symptom of the problem is that the media is not stopped and the duration is exceeded without ending at the end of playback.
The cause is stream segment position updating logic at the chain function of the sink pad. Currently, streamsynchronizer sends gap event based on segment position(stream's last buffer timestamp + buffer duration) when there is a difference in eos event handling between streams. So each stream's segment position is updated by other stream's segment position at the chain function if other stream's segment position is bigger than own's segment position.
I think that this logic does not consider period changes for multi sources. Therefore, the following problem occurs.
(for example) video ----------2:23----------(period change)--0:02--(end) audio ---2:23---(period change)--0:02--(end)
- audio handle eos event but video still receiving previous period data
- audio send gap event based on own's segment position
- audio segment position update by video stream's segment position because video stream segment position is bigger than audio
0:02:27.534538821 6497 0xf13fe580 DEBUG streamsynchronizer gststreamsynchronizer.c:246:gst_stream_synchronizer_wait:<streamsynchronizer0:src_1> Send GAP event, position: 0:00:02.331687500 duration: 99:99:99.999999999 0:02:27.542334904 6497 0xf13fe580 DEBUG streamsynchronizer gststreamsynchronizer.c:246:gst_stream_synchronizer_wait:<streamsynchronizer0:src_1> Send GAP event, position: 0:02:22.170983333 duration: 0:02:19.839295833 0:02:27.548689529 6497 0xf13fe580 DEBUG streamsynchronizer gststreamsynchronizer.c:246:gst_stream_synchronizer_wait:<streamsynchronizer0:src_1> Send GAP event, position: 0:02:22.187683333 duration: 0:00:00.016700000 0:02:27.558626862 6497 0xf13fe580 DEBUG streamsynchronizer gststreamsynchronizer.c:246:gst_stream_synchronizer_wait:<streamsynchronizer0:src_1> Send GAP event, position: 0:02:22.204383333 duration: 0:00:00.016700000 0:02:27.576503737 6497 0xf13fe580 DEBUG streamsynchronizer gststreamsynchronizer.c:246:gst_stream_synchronizer_wait:<streamsynchronizer0:src_1> Send GAP event, position: 0:02:22.221083333 duration: 0:00:00.016700000 0:02:27.592382112 6497 0xf13fe580 DEBUG streamsynchronizer gststreamsynchronizer.c:246:gst_stream_synchronizer_wait:<streamsynchronizer0:src_1> Send GAP event, position: 0:02:22.237783333 duration: 0:00:00.016700000
So streamsynchronizer should manage all stream segment change.