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 /player/playloop.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 'player/playloop.c')
-rw-r--r-- | player/playloop.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/player/playloop.c b/player/playloop.c index 8845b58cef..f5c1fde0ef 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -950,7 +950,9 @@ static void handle_dummy_ticks(struct MPContext *mpctx) // Update current playback time. static void handle_playback_time(struct MPContext *mpctx) { - if (mpctx->vo_chain && !mpctx->vo_chain->is_coverart && + if (mpctx->vo_chain && + !mpctx->vo_chain->is_coverart && + !mpctx->vo_chain->is_sparse && mpctx->video_status >= STATUS_PLAYING && mpctx->video_status < STATUS_EOF) { @@ -986,6 +988,13 @@ static void handle_playback_restart(struct MPContext *mpctx) { struct MPOpts *opts = mpctx->opts; + // Do not wait for video stream if it only has sparse frames. + if (mpctx->vo_chain && + mpctx->vo_chain->is_sparse && + mpctx->video_status < STATUS_READY) { + mpctx->video_status = STATUS_READY; + } + if (mpctx->audio_status < STATUS_READY || mpctx->video_status < STATUS_READY) return; @@ -1008,7 +1017,9 @@ static void handle_playback_restart(struct MPContext *mpctx) } // Video needed, but not started yet -> wait. - if (mpctx->vo_chain && !mpctx->vo_chain->is_coverart && + if (mpctx->vo_chain && + !mpctx->vo_chain->is_coverart && + !mpctx->vo_chain->is_sparse && mpctx->video_status <= STATUS_READY) return; |