|author||wm4 <wm4@nowhere>||2016-08-06 15:47:04 +0200|
|committer||wm4 <wm4@nowhere>||2016-08-06 15:47:04 +0200|
player: improve instant track switching
When switching tracks, we normally have the problem that data gets lost due to readahead buffering. (Which in turn is because we're stubborn and instruct the demuxers to discard data on unselected streams.) The demuxer layer has a hack that re-reads discarded buffered data if a stream is enabled mid-stream, so track switching will seem instant. A somewhat similar problem is when all tracks of an external files were disabled - when enabling the first track, we have to seek to the target position. Handle these with the same mechanism. Pass the "current time" to the demuxer's stream switch function, and let the demuxer figure out what to do. The demuxer will issue a refresh seek (if possible) to update the new stream, or will issue a "normal" seek if there was no active stream yet. One case that changes is when a video/audio stream is enabled on an external file with only a subtitle stream active, and the demuxer does not support rrefresh seeks. This is a fuzzy case, because subtitles are sparse, and the demuxer might have skipped large amounts of data. We used to seek (and send the subtitle decoder some subtitle packets twice). This case is sort of obscure and insane, and the fix would be questionable, so we simply don't care. Should mostly fix #3392.
Diffstat (limited to 'demux/demux_timeline.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/demux/demux_timeline.c b/demux/demux_timeline.c
index 98bd9b9aa9..03d7ddd1a3 100644
@@ -84,7 +84,7 @@ static void reselect_streams(struct demuxer *demuxer)
// This stops demuxer readahead for inactive segments.
if (!p->current || seg->d != p->current->d)
selected = false;
- demuxer_select_track(seg->d, sh, selected);
+ demuxer_select_track(seg->d, sh, MP_NOPTS_VALUE, selected);