aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2016-07-12 17:05:42 -0300
committerJames Almer <jamrial@gmail.com>2016-07-25 09:59:54 -0300
commite9b7ae08d6216997b644ade83d46a48732359bf9 (patch)
tree1ac9a8f29489d9ed7a493e2de1d5d53169bc59bb
parentda4ea971617351600f49437bc9d489e650b4de38 (diff)
downloadffmpeg-e9b7ae08d6216997b644ade83d46a48732359bf9.tar.gz
avformat/oggparsevp8: fix pts calculation on pages ending with an invisible frame
Signed-off-by: James Almer <jamrial@gmail.com> (cherry picked from commit 5adfbd391847fcdaea1e9b105fae2dd90af2a733)
-rw-r--r--libavformat/oggparsevp8.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/oggparsevp8.c b/libavformat/oggparsevp8.c
index 7aed8abad3..ca13928f1e 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);
+ 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)