[FFmpeg-devel] [PATCH] Off by one in mpeg video parsing (r17731)

Wolfram Gloger wmglo
Mon May 4 22:47:11 CEST 2009


Hi,

I believe r17731 introduced an off-by-one error.
It introduced in mpeg12.c:

@@ -2244,6 +2244,9 @@
                     return i-3;
                 }
             }
+            if(s && state == PICTURE_START_CODE){
+                ff_fetch_timestamp(s, i-4, 1);
+            }
         }
     }
     pc->state= state;

however, as is apparent from the surrounding code, the index that
"points" to PICTURE_START_CODE is actually i-3 and not i-4.
The effect of this is that when a PES packet starts with
PICTURE_START_CODE (very common e.g. in DVB), the timestamps
are fetched from the _previous_ PES packet (offset==-1),
which is wrong IMHO.

Regards,
Wolfram.

--- ffmpeg-18731-wg/libavcodec/mpeg12.c~	2009-05-01 14:31:19.000000000 +0200
+++ ffmpeg-18731-wg/libavcodec/mpeg12.c	2009-05-04 15:23:21.000000000 +0200
@@ -2210,7 +2210,7 @@
                 }
             }
             if(s && state == PICTURE_START_CODE){
-                ff_fetch_timestamp(s, i-4, 1);
+                ff_fetch_timestamp(s, i-3, 1);
             }
         }
     }



More information about the ffmpeg-devel mailing list