[FFmpeg-cvslog] r24334 - trunk/libavformat/rtpdec_xiph.c

mstorsjo subversion
Mon Jul 19 20:43:20 CEST 2010


Author: mstorsjo
Date: Mon Jul 19 20:43:20 2010
New Revision: 24334

Log:
rtpdec_xiph: Avoid extra memcpy in Xiph RTP depacketizer

Patch by Josh Allmann, joshua dot allmann at gmail

Modified:
   trunk/libavformat/rtpdec_xiph.c

Modified: trunk/libavformat/rtpdec_xiph.c
==============================================================================
--- trunk/libavformat/rtpdec_xiph.c	Mon Jul 19 20:37:45 2010	(r24333)
+++ trunk/libavformat/rtpdec_xiph.c	Mon Jul 19 20:43:20 2010	(r24334)
@@ -178,24 +178,18 @@ static int xiph_handle_packet(AVFormatCo
 
         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;
-            }
-
-            if (av_new_packet(pkt, frame_size)) {
-                av_log(ctx, AV_LOG_ERROR, "Out of memory.\n");
-                return AVERROR(ENOMEM);
+                return pkt->size;
             }
 
-            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;



More information about the ffmpeg-cvslog mailing list