summaryrefslogtreecommitdiff
blob: c50e45e55a8452405472c7946901d932608b0ef6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
commit 786f37ae1c77b46b34ed66b4a73c42ff64bfc9b8
Author: wm4 <wm4@nowhere>
Date:   Sat Apr 23 17:16:54 2016 +0200

player: cleaner determination of current playback PTS

In particular, this won't overwrite the playback PTS in coverart mode,
which actually fixes relative seeks.
---

diff --git a/player/playloop.c b/player/playloop.c
index 71ecd7e..6eadcbc 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -958,6 +958,17 @@ void run_playloop(struct MPContext *mpctx)
     fill_audio_out_buffers(mpctx);
     write_video(mpctx);

+    if (mpctx->vo_chain && !mpctx->vo_chain->is_coverart &&
+        mpctx->video_status >= STATUS_PLAYING &&
+        mpctx->video_status < STATUS_EOF)
+    {
+        mpctx->playback_pts = mpctx->video_pts;
+    } else if (mpctx->audio_status >= STATUS_PLAYING &&
+               mpctx->audio_status < STATUS_EOF)
+    {
+        mpctx->playback_pts = playing_audio_pts(mpctx);
+    }
+
     if (mpctx->lavfi) {
         if (lavfi_process(mpctx->lavfi))
             mpctx->sleeptime = 0;
@@ -967,14 +978,6 @@ void run_playloop(struct MPContext *mpctx)

     handle_playback_restart(mpctx);

-    // Use the audio timestamp if no video, or video is enabled, but has ended.
-    if (mpctx->video_status == STATUS_EOF &&
-        mpctx->audio_status >= STATUS_PLAYING &&
-        mpctx->audio_status < STATUS_EOF)
-    {
-        mpctx->playback_pts = playing_audio_pts(mpctx);
-    }
-
     handle_dummy_ticks(mpctx);

     update_osd_msg(mpctx);
diff --git a/player/video.c b/player/video.c
index 0af0b90..7610c12 100644
--- a/player/video.c
+++ b/player/video.c
@@ -1380,7 +1380,6 @@ void write_video(struct MPContext *mpctx)

     mpctx->video_pts = mpctx->next_frames[0]->pts;
     mpctx->last_vo_pts = mpctx->video_pts;
-    mpctx->playback_pts = mpctx->video_pts;

     shift_frames(mpctx);