1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

rtpdec_xiph: Avoid extra memcpy in Xiph RTP depacketizer

Patch by Josh Allmann, joshua dot allmann at gmail

Originally committed as revision 24334 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Josh Allmann 2010-07-19 18:43:20 +00:00 committed by Martin Storsjö
parent 6d9f1b67e8
commit 7d894aeb60

View File

@ -178,24 +178,18 @@ static int xiph_handle_packet(AVFormatContext * ctx,
if (fragmented == 3) { if (fragmented == 3) {
// end of xiph data packet // end of xiph data packet
uint8_t* xiph_data; av_init_packet(pkt);
int frame_size = url_close_dyn_buf(data->fragment, &xiph_data); pkt->size = url_close_dyn_buf(data->fragment, &pkt->data);
if (frame_size < 0) { if (pkt->size < 0) {
av_log(ctx, AV_LOG_ERROR, av_log(ctx, AV_LOG_ERROR,
"Error occurred when getting fragment buffer."); "Error occurred when getting fragment buffer.");
return frame_size; return pkt->size;
} }
if (av_new_packet(pkt, frame_size)) {
av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
return AVERROR(ENOMEM);
}
memcpy(pkt->data, xiph_data, frame_size);
pkt->stream_index = st->index; pkt->stream_index = st->index;
pkt->destruct = av_destruct_packet;
av_free(xiph_data);
data->fragment = NULL; data->fragment = NULL;
return 0; return 0;