[MPlayer-dev-eng] [PATCH] To work around a bug in ffmpeg's H.263+ decoder

Ross Finlayson finlayson at live.com
Mon Nov 25 22:50:46 CET 2002


Index: demux_rtp.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_rtp.cpp,v
retrieving revision 1.7
diff -u -r1.7 demux_rtp.cpp
--- demux_rtp.cpp	16 Oct 2002 15:15:43 -0000	1.7
+++ demux_rtp.cpp	25 Nov 2002 20:11:04 -0000
@@ -373,7 +373,7 @@
 
   // Allocate a new packet buffer, and arrange to read into it:
   unsigned const bufferSize = 30000; // >= the largest conceivable RTP packet
-  demux_packet_t* dp = new_demux_packet(bufferSize);
+  demux_packet_t* dp = new_demux_packet(bufferSize+4/*hack, see below*/);
   if (dp == NULL) return;
   ReadBuffer* readBuffer = new ReadBuffer(bufferQueue, dp);
 
@@ -394,6 +394,11 @@
 
   demux_packet_t* dp = readBuffer->dp();
   dp->len = frameSize;
+
+  // Hack: Add some zero bytes after the end of the data that we've just read.
+  // This overcomes a bug in the "ffmpeg" H.263+ parsing code, which can read
+  // past the end of the buffer, expecting zeros there.
+  *(unsigned*)(dp->buffer+frameSize) = 0;
 
   // Set the packet's presentation time stamp, depending on whether or
   // not our RTP source's timestamps have been synchronized yet: 


More information about the MPlayer-dev-eng mailing list