From 814869759c59ed3ce16604837fbf55e4f5ff7392 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Wed, 2 May 2018 19:29:11 -0700 Subject: 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 --- player/playloop.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'player/playloop.c') 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; -- cgit v1.2.3