diff options
author | Aman Gupta <aman@tmm1.net> | 2018-05-02 19:29:11 -0700 |
---|---|---|
committer | Aman Gupta <aman@tmm1.net> | 2018-05-24 10:26:41 -0700 |
commit | 814869759c59ed3ce16604837fbf55e4f5ff7392 (patch) | |
tree | f629e0e87226074c486c9e1f81a96e063f187fd4 /demux/demux.c | |
parent | b24bd4e57075e116a5ce0c2d7a69f436776eae8f (diff) | |
download | mpv-814869759c59ed3ce16604837fbf55e4f5ff7392.tar.bz2 mpv-814869759c59ed3ce16604837fbf55e4f5ff7392.tar.xz |
demux, player: fix playback of sparse video streams (w/ still images)
Fixes several issues playing back mpegts with video streams marked
as having "still images". For example, see this video which has
frames only every 6s: https://s3.amazonaws.com/tmm1/music-choice.ts
Changes include:
- start playback right away, without waiting for first video frame
- do not consider the sparse video stream in demuxer underrun detection
- do not require multiple video frames for the VO
- use audio as the master stream for demuxer metadata events
- use audio stream for playback time
Signed-off-by: Aman Gupta <aman@tmm1.net>
Diffstat (limited to 'demux/demux.c')
-rw-r--r-- | demux/demux.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/demux/demux.c b/demux/demux.c index afe8d2b51f..40a68eacae 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -282,6 +282,7 @@ struct demux_stream { bool eager; // try to keep at least 1 packet queued // if false, this stream is disabled, or passively // read (like subtitles) + bool still_image; // stream has still video images bool refreshing; // finding old position after track switches bool eof; // end of demuxed stream? (true if no more packets) @@ -703,8 +704,9 @@ static void update_stream_selection_state(struct demux_internal *in, for (int n = 0; n < in->num_streams; n++) { struct demux_stream *s = in->streams[n]->ds; + s->still_image = s->sh->still_image; s->eager = s->selected && !s->sh->attached_picture; - if (s->eager) { + if (s->eager && !s->still_image) { any_av_streams |= s->type != STREAM_SUB; if (!master || (master->type == STREAM_VIDEO && s->type == STREAM_AUDIO)) @@ -2994,7 +2996,7 @@ static int cached_demux_control(struct demux_internal *in, int cmd, void *arg) struct demux_stream *ds = in->streams[n]->ds; if (ds->eager && !(!ds->queue->head && ds->eof) && !ds->ignore_eof) { - r->underrun |= !ds->reader_head && !ds->eof; + r->underrun |= !ds->reader_head && !ds->eof && !ds->still_image; r->ts_reader = MP_PTS_MAX(r->ts_reader, ds->base_ts); r->ts_end = MP_PTS_MAX(r->ts_end, ds->queue->last_ts); any_packets |= !!ds->reader_head; |