summaryrefslogtreecommitdiff
path: root/libavformat/sdp.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-12-14 00:27:26 +0200
committerMartin Storsjö <martin@martin.st>2013-12-14 17:48:46 +0200
commit6451c8853a07ff2e28bda950fb5e83fcf88c5cf4 (patch)
tree5022b9346bfa2b2d2bee2c2b648500bfcf5a8a3d /libavformat/sdp.c
parent797f2a791397210ec1b591b326658805c5dbf104 (diff)
sdp: Check theora colorspace before producing the configuration string
This avoids a memory leak (or having to worry about freeing the config string) if the colorspace isn't accepted. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/sdp.c')
-rw-r--r--libavformat/sdp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 186f83b1a0..ec7e2f430c 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -513,13 +513,6 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
break;
case AV_CODEC_ID_THEORA: {
const char *pix_fmt;
- if (c->extradata_size)
- config = xiph_extradata2config(c);
- else
- av_log(c, AV_LOG_ERROR, "Theora configuation info missing\n");
- if (!config)
- return NULL;
-
switch (c->pix_fmt) {
case AV_PIX_FMT_YUV420P:
pix_fmt = "YCbCr-4:2:0";
@@ -535,6 +528,13 @@ static char *sdp_write_media_attributes(char *buff, int size, AVCodecContext *c,
return NULL;
}
+ if (c->extradata_size)
+ config = xiph_extradata2config(c);
+ else
+ av_log(c, AV_LOG_ERROR, "Theora configuation info missing\n");
+ if (!config)
+ return NULL;
+
av_strlcatf(buff, size, "a=rtpmap:%d theora/90000\r\n"
"a=fmtp:%d delivery-method=inline; "
"width=%d; height=%d; sampling=%s; "