diff options
author | Luca Abeni <lucabe72@email.it> | 2009-01-15 17:03:07 +0300 |
---|---|---|
committer | Luca Abeni <lucabe72@email.it> | 2009-01-15 17:03:07 +0300 |
commit | 0a63a676ec5cc1e69768024df51ffca6a5cfbd08 (patch) | |
tree | 31b233b41814ec0604ebe429448fab5812c53fd8 /libavformat/flvenc.c | |
parent | 2ea512a6c2ff3404563ad364a3e806a8630cdc84 (diff) |
Do not reallocate AVPacket's data when muxing a packet
Originally committed as revision 16616 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/flvenc.c')
-rw-r--r-- | libavformat/flvenc.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 27f96217c4..8cc88199e9 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -341,13 +341,6 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) } if (enc->codec_id == CODEC_ID_H264) { - /* check if extradata looks like mp4 formated */ - if (enc->extradata_size > 0 && *(uint8_t*)enc->extradata != 1) { - if (ff_avc_parse_nal_units(pkt->data, &pkt->data, &pkt->size) < 0) - return -1; - assert(pkt->size); - size = pkt->size; - } if (!flv->delay && pkt->dts < 0) flv->delay = -pkt->dts; } @@ -368,7 +361,13 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) put_byte(pb,1); // AVC NALU put_be24(pb,pkt->pts - pkt->dts); } + if (enc->codec_id == CODEC_ID_H264 && + /* check if extradata looks like mp4 formated */ + enc->extradata_size > 0 && *(uint8_t*)enc->extradata != 1) { + ff_avc_parse_nal_units(pb, pkt->data, pkt->size); + } else { put_buffer(pb, pkt->data, size); + } put_be32(pb,size+flags_size+11); // previous tag size flv->duration = FFMAX(flv->duration, pkt->pts + flv->delay + pkt->duration); |