[Ffmpeg-devel] BUG - buffer overflow
Wolfram Gloger
wmglo
Wed Nov 9 17:39:42 CET 2005
Hi,
[mpeg -> mpeg transcoding]
> After running for a long time (2G original file) at about the 50% mark I
> get a ton of these errors:
>
> [dvd @ 0x82adfc0]buffer underflow
I am sure there is a bug in the mpeg muxer but I don't know whether it
is the same problem you are seeing. Please try the patch below. I
noticed this problem only with subtitle substreams with a very low
packets/second rate.
Regards,
Wolfram.
diff -ur ffmpeg/libavformat/mpeg.c ffmpeg-wg/libavformat/mpeg.c
--- ffmpeg/libavformat/mpeg.c Fri Sep 23 19:54:33 2005
+++ ffmpeg-wg/libavformat/mpeg.c Tue Oct 18 10:47:48 2005
@@ -30,7 +30,7 @@
int64_t dts;
int size;
int unwritten_size;
- int flags;
+ //int flags;
struct PacketDesc *next;
} PacketDesc;
@@ -1181,7 +1190,8 @@
AVStream *st = ctx->streams[stream_index];
StreamInfo *stream = st->priv_data;
int64_t pts, dts;
- PacketDesc *pkt_desc;
+ PacketDesc *pkt_desc, *dec_next;
+ int requeue = 0;
const int preload= av_rescale(ctx->preload, 90000, AV_TIME_BASE);
const int is_iframe = st->codec->codec_type == CODEC_TYPE_VIDEO && (pkt->flags & PKT_FLAG_KEY);
@@ -1191,18 +1201,26 @@
if(pts != AV_NOPTS_VALUE) pts += preload;
if(dts != AV_NOPTS_VALUE) dts += preload;
-//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d stream:%d nopts:%d\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, pts != AV_NOPTS_VALUE);
- if (!stream->premux_packet)
+//av_log(ctx, AV_LOG_DEBUG, "dts:%f pts:%f flags:%d i=%d size:%d premux=%p\n", dts/90000.0, pts/90000.0, pkt->flags, pkt->stream_index, size, stream->premux_packet);
+ if (!stream->premux_packet) {
stream->next_packet = &stream->premux_packet;
+ requeue= 1;
+ }
*stream->next_packet=
- pkt_desc= av_mallocz(sizeof(PacketDesc));
+ pkt_desc= av_malloc(sizeof(PacketDesc));
pkt_desc->pts= pts;
pkt_desc->dts= dts;
pkt_desc->unwritten_size=
pkt_desc->size= size;
+ pkt_desc->next= NULL;
if(!stream->predecode_packet)
stream->predecode_packet= pkt_desc;
+ else if (requeue) {
+ for (dec_next= stream->predecode_packet; dec_next->next; dec_next= dec_next->next);
+ dec_next->next = pkt_desc;
+ }
+
stream->next_packet= &pkt_desc->next;
fifo_realloc(&stream->fifo, fifo_size(&stream->fifo, NULL) + size + 1);
More information about the ffmpeg-devel
mailing list