summaryrefslogtreecommitdiff
path: root/libavformat/rtpenc.c
diff options
context:
space:
mode:
authorLuca Abeni <lucabe72@email.it>2009-02-06 20:41:15 +0000
committerLuca Abeni <lucabe72@email.it>2009-02-06 20:41:15 +0000
commitd3536678dc87608c18c9aecde357173924c4a5fd (patch)
treec5d71d58b8aec798523ad483504b2fd821cc7051 /libavformat/rtpenc.c
parentdcd913d9ed6c15ea53882894baa343695575abcd (diff)
Do not use RTP_MAX_PACKET_LENGTH in the RTP muxer
Originally committed as revision 17022 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtpenc.c')
-rw-r--r--libavformat/rtpenc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index dbb931afd0..0e129acea6 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -65,6 +65,10 @@ static int rtp_write_header(AVFormatContext *s1)
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(AVFormatContext *s1, AVPacket *pkt)
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,
};