From 45e64941778058312d72711dbfcf039bb4ba5171 Mon Sep 17 00:00:00 2001
From: Frank Galligan <fgalligan@google.com>
Date: Tue, 5 Oct 2010 17:46:37 -0400
Subject: [PATCH] Change altref times to preceding pts+1.

Change the pts of the altref frame to be as close as possible to the
pts of the preceding frame and still be strictly increasing.

Change-Id: Iae3033a4c89ae5a9d0e5c4198e9196e5f3ee57c7
---
 vp8/vp8_cx_iface.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c
index b4bb679b5b..8e50b7f1b0 100644
--- a/vp8/vp8_cx_iface.c
+++ b/vp8/vp8_cx_iface.c
@@ -763,12 +763,13 @@ static vpx_codec_err_t vp8e_encode(vpx_codec_alg_priv_t  *ctx,
                 {
                     pkt.data.frame.flags |= VPX_FRAME_IS_INVISIBLE;
 
-                    // TODO: ideally this timestamp should be as close as
-                    // possible to the prior PTS so that if a decoder uses
-                    // pts to schedule when to do this, we start right after
-                    // last frame was decoded.  Maybe should be set to
-                    // last time stamp. Invisible frames have no duration..
-                    pkt.data.frame.pts --;
+                    // This timestamp should be as close as possible to the
+                    // prior PTS so that if a decoder uses pts to schedule when
+                    // to do this, we start right after last frame was decoded.
+                    // Invisible frames have no duration.
+                    pkt.data.frame.pts = ((cpi->last_time_stamp_seen
+                        * ctx->cfg.g_timebase.den + round)
+                        / ctx->cfg.g_timebase.num / 10000000) + 1;
                     pkt.data.frame.duration = 0;
                 }
 
-- 
GitLab