mirror of
https://github.com/mpv-player/mpv
synced 2025-04-07 01:53:06 +00:00
mplayer: prefer audio PTS over video PTS for status line
This slightly improves display of the current playback time in files with sparse video packets (like video tracks containing a slow MJPG slideshows as in [1]), or audio files with cover art image attachments. While the video PTS is always "stuck" at the last frame displayed or the last seek, audio is usually continuous. Given sane samplerates and working audio drivers (to query how much of the current audio buffer has been played), the audio PTS should always be more reliable. [1] http://www.podtrac.com/pts/redirect.mp3/traffic.libsyn.com/rtpodcast/Rooster_Teeth_Podcast_191.m4a
This commit is contained in:
parent
4a40eeda94
commit
3f949cf50b
@ -2976,14 +2976,14 @@ double get_current_time(struct MPContext *mpctx)
|
||||
return 0;
|
||||
if (demuxer->stream_pts != MP_NOPTS_VALUE)
|
||||
return demuxer->stream_pts;
|
||||
double apts = playing_audio_pts(mpctx);
|
||||
if (apts != MP_NOPTS_VALUE)
|
||||
return apts;
|
||||
if (mpctx->sh_video) {
|
||||
double pts = mpctx->video_pts;
|
||||
if (pts != MP_NOPTS_VALUE)
|
||||
return pts;
|
||||
}
|
||||
double apts = playing_audio_pts(mpctx);
|
||||
if (apts != MP_NOPTS_VALUE)
|
||||
return apts;
|
||||
if (mpctx->last_seek_pts != MP_NOPTS_VALUE)
|
||||
return mpctx->last_seek_pts;
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user