]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/oggparsevp8.c
Merge commit '8b7a9729aa162e2bbd571933f1aa40767f1ff47b'
[ffmpeg] / libavformat / oggparsevp8.c
index d57419e9f08bb37f3f5c364652073a2c420f9a2e..c534ab117d94e2aee590f03641681d5031aa83c4 100644 (file)
@@ -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 subtract 1 for those
+    // to prevent messing up pts calculations.
+    uint64_t pts  = (granule >> 32) - invcnt;
     uint32_t dist = (granule >>  3) & 0x07ffffff;
 
     if (!dist)