diff options
author | Uoti Urpala <uau@mplayer2.org> | 2011-07-30 21:05:59 +0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-07-30 21:05:59 +0300 |
commit | f1bb6fde3288cbbaf01175b980b9704f9406ce80 (patch) | |
tree | d2ca0f86394e7f95af43d80297cd52b25b784f97 /mplayer.c | |
parent | b33bb28ea3218399d6023a8f3fd2f9a86a3dec41 (diff) | |
download | mpv-f1bb6fde3288cbbaf01175b980b9704f9406ce80.tar.bz2 mpv-f1bb6fde3288cbbaf01175b980b9704f9406ce80.tar.xz |
core: audio: if audio pts is missing return MP_NOPTS_VALUE
Change written_audio_pts() and playing_audio_pts() to return
MP_NOPTS_VALUE if no reasonable pts estimate is available. Before they
returned some incorrect value typically around zero (but not
necessarily exactly that).
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1855,6 +1855,9 @@ static double written_audio_pts(struct MPContext *mpctx) // but not accurately known in sh_audio->i_bps. a_pts = d_audio->pts; + if (a_pts == MP_NOPTS_VALUE) + return a_pts; + // ds_tell_pts returns bytes read after last timestamp from // demuxing layer, decoder might use sh_audio->a_in_buffer for bytes // it has read but not decoded @@ -1885,8 +1888,10 @@ static double written_audio_pts(struct MPContext *mpctx) // Return pts value corresponding to currently playing audio. double playing_audio_pts(struct MPContext *mpctx) { - return written_audio_pts(mpctx) - mpctx->opts.playback_speed * - ao_get_delay(mpctx->ao); + double pts = written_audio_pts(mpctx); + if (pts == MP_NOPTS_VALUE) + return pts; + return pts - mpctx->opts.playback_speed * ao_get_delay(mpctx->ao); } static bool is_av_sub(int type) |