[FFmpeg-devel] [PATCH 1/3] avformat/oggparsevp8: fix pts calculation on pages ending with an invisible frame
James Almer
jamrial at gmail.com
Wed Jul 13 00:36:20 EEST 2016
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavformat/oggparsevp8.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libavformat/oggparsevp8.c b/libavformat/oggparsevp8.c
index d57419e..3ba5375 100644
--- a/libavformat/oggparsevp8.c
+++ b/libavformat/oggparsevp8.c
@@ -82,7 +82,11 @@ static uint64_t vp8_gptopts(AVFormatContext *s, int idx,
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + idx;
- uint64_t pts = (granule >> 32);
+ uint32_t 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)
--
2.9.0
More information about the ffmpeg-devel
mailing list