changeset 6994:5a5ded44808a libavcodec

In mpeg1/2 timestamps are associated with the access unit which contains the first picture startcode that commences in the PES packet, instead of the first access unit that commences in the PES packet. Fix the parser to handle that properly. This was a very long standing bug ... The change to the seek regressions is because the mpeg ts muxer stores too many invalid and randomized timestamps which overflow the 4 entry buffer we use in the parser.
author michael
date Tue, 03 Jun 2008 02:43:17 +0000
parents 91a3324f4abc
children 0e15e9324df2
files mpegvideo_parser.c
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mpegvideo_parser.c	Mon Jun 02 23:00:04 2008 +0000
+++ b/mpegvideo_parser.c	Tue Jun 03 02:43:17 2008 +0000
@@ -29,6 +29,7 @@
 {
     ParseContext1 *pc = s->priv_data;
     const uint8_t *buf_end;
+    const uint8_t *buf_start= buf;
     uint32_t start_code;
     int frame_rate_index, ext_type, bytes_left;
     int frame_rate_ext_n, frame_rate_ext_d;
@@ -43,6 +44,8 @@
         bytes_left = buf_end - buf;
         switch(start_code) {
         case PICTURE_START_CODE:
+            ff_fetch_timestamp(s, buf-buf_start-4, 1);
+
             if (bytes_left >= 2) {
                 s->pict_type = (buf[1] >> 3) & 7;
             }