aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtpdec_xiph.c
diff options
context:
space:
mode:
authorJosh Allmann <joshua.allmann@gmail.com>2010-07-19 18:43:20 +0000
committerMartin Storsjö <martin@martin.st>2010-07-19 18:43:20 +0000
commit7d894aeb60d767852ba9d5a4a2480abac17846ee (patch)
treeac7479821b41911a5a52902228d6ce8b56338233 /libavformat/rtpdec_xiph.c
parent6d9f1b67e8e5bbce598d6c7a6d0ec8a1c3ba528b (diff)
downloadffmpeg-7d894aeb60d767852ba9d5a4a2480abac17846ee.tar.gz
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
Diffstat (limited to 'libavformat/rtpdec_xiph.c')
-rw-r--r--libavformat/rtpdec_xiph.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c
index 9973efcd73..4c9cad2877 100644
--- a/libavformat/rtpdec_xiph.c
+++ b/libavformat/rtpdec_xiph.c
@@ -178,24 +178,18 @@ static int xiph_handle_packet(AVFormatContext * ctx,
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);
- }
-
- memcpy(pkt->data, xiph_data, frame_size);
pkt->stream_index = st->index;
+ pkt->destruct = av_destruct_packet;
- av_free(xiph_data);
data->fragment = NULL;
return 0;