[FFmpeg-cvslog] avformat/oggparsevp8: fix pts calculation on pages ending with an invisible frame

James Almer git at videolan.org
Mon Jul 25 19:52:40 EEST 2016


ffmpeg | branch: release/2.5 | James Almer <jamrial at gmail.com> | Tue Jul 12 17:05:42 2016 -0300| [5141a0ceafd34a68723da1940a410cfacf116110] | committer: James Almer

avformat/oggparsevp8: fix pts calculation on pages ending with an invisible frame

Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit 5adfbd391847fcdaea1e9b105fae2dd90af2a733)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5141a0ceafd34a68723da1940a410cfacf116110
---

 libavformat/oggparsevp8.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/oggparsevp8.c b/libavformat/oggparsevp8.c
index 5959d32..7c67cc5 100644
--- a/libavformat/oggparsevp8.c
+++ b/libavformat/oggparsevp8.c
@@ -79,7 +79,11 @@ static uint64_t vp8_gptopts(AVFormatContext *s, int idx, uint64_t granule, int64
     struct ogg *ogg = s->priv_data;
     struct ogg_stream *os = ogg->streams + idx;
 
-    uint64_t pts  = (granule >> 32);
+    int invcnt    = !((granule >> 30) & 3);
+    // If page granule is that of an invisible vp8 frame, its pts will be
+    // that of the end of the next visible frame. We substract 1 for those
+    // to prevent messing up pts calculations.
+    uint64_t pts  = (granule >> 32) - invcnt;
     uint32_t dist = (granule >>  3) & 0x07ffffff;
 
     if (!dist)



More information about the ffmpeg-cvslog mailing list