[FFmpeg-cvslog] r17022 - in trunk/libavformat: rtpenc.c rtpenc.h

lucabe subversion
Fri Feb 6 21:41:15 CET 2009


Author: lucabe
Date: Fri Feb  6 21:41:15 2009
New Revision: 17022

Log:
Do not use RTP_MAX_PACKET_LENGTH in the RTP muxer

Modified:
   trunk/libavformat/rtpenc.c
   trunk/libavformat/rtpenc.h

Modified: trunk/libavformat/rtpenc.c
==============================================================================
--- trunk/libavformat/rtpenc.c	Fri Feb  6 21:30:18 2009	(r17021)
+++ trunk/libavformat/rtpenc.c	Fri Feb  6 21:41:15 2009	(r17022)
@@ -65,6 +65,10 @@ static int rtp_write_header(AVFormatCont
     max_packet_size = url_fget_max_packet_size(s1->pb);
     if (max_packet_size <= 12)
         return AVERROR(EIO);
+    s->buf = av_malloc(max_packet_size);
+    if (s->buf == NULL) {
+        return AVERROR(ENOMEM);
+    }
     s->max_payload_size = max_packet_size - 12;
 
     s->max_frames_per_packet = 0;
@@ -344,6 +348,15 @@ static int rtp_write_packet(AVFormatCont
     return 0;
 }
 
+static int rtp_write_trailer(AVFormatContext *s1)
+{
+    RTPMuxContext *s = s1->priv_data;
+
+    av_freep(&s->buf);
+
+    return 0;
+}
+
 AVOutputFormat rtp_muxer = {
     "rtp",
     NULL_IF_CONFIG_SMALL("RTP output format"),
@@ -354,4 +367,5 @@ AVOutputFormat rtp_muxer = {
     CODEC_ID_NONE,
     rtp_write_header,
     rtp_write_packet,
+    rtp_write_trailer,
 };

Modified: trunk/libavformat/rtpenc.h
==============================================================================
--- trunk/libavformat/rtpenc.h	Fri Feb  6 21:30:18 2009	(r17021)
+++ trunk/libavformat/rtpenc.h	Fri Feb  6 21:41:15 2009	(r17022)
@@ -46,7 +46,7 @@ struct RTPMuxContext {
     unsigned int last_octet_count; // TODO: move into statistics (outgoing)
     int first_packet;
     /* buffer for output */
-    uint8_t buf[RTP_MAX_PACKET_LENGTH];
+    uint8_t *buf;
     uint8_t *buf_ptr;
 
     int max_frames_per_packet;




More information about the ffmpeg-cvslog mailing list