Mercurial > libavformat.hg
changeset 6280:eec2da728944 libavformat
rtpdec_xiph: Avoid extra memcpy in Xiph RTP depacketizer
Patch by Josh Allmann, joshua dot allmann at gmail
author | mstorsjo |
---|---|
date | Mon, 19 Jul 2010 18:43:20 +0000 |
parents | 111c9026932e |
children | f2ad554b2464 |
files | rtpdec_xiph.c |
diffstat | 1 files changed, 6 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/rtpdec_xiph.c Mon Jul 19 14:58:37 2010 +0000 +++ b/rtpdec_xiph.c Mon Jul 19 18:43:20 2010 +0000 @@ -178,24 +178,18 @@ if (fragmented == 3) { // end of xiph data packet - uint8_t* xiph_data; - int frame_size = url_close_dyn_buf(data->fragment, &xiph_data); + av_init_packet(pkt); + pkt->size = url_close_dyn_buf(data->fragment, &pkt->data); - if (frame_size < 0) { + if (pkt->size < 0) { av_log(ctx, AV_LOG_ERROR, "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); - } + pkt->stream_index = st->index; + pkt->destruct = av_destruct_packet; - memcpy(pkt->data, xiph_data, frame_size); - pkt->stream_index = st->index; - - av_free(xiph_data); data->fragment = NULL; return 0;