mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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>
This commit is contained in:
parent
797f2a7913
commit
6451c8853a
@ -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; "
|
||||
|
Loading…
Reference in New Issue
Block a user