|
|
@@ -23,6 +23,7 @@
|
|
|
|
|
|
#include "avio_internal.h"
|
|
|
#include "rtpdec_formats.h"
|
|
|
+#include "libavutil/avassert.h"
|
|
|
#include "libavutil/avstring.h"
|
|
|
#include "libavutil/imgutils.h"
|
|
|
#include "libavutil/pixdesc.h"
|
|
|
@@ -172,33 +173,39 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream,
|
|
|
}
|
|
|
|
|
|
static int rfc4175_parse_sdp_line(AVFormatContext *s, int st_index,
|
|
|
- PayloadContext *data, const char *line)
|
|
|
+ PayloadContext *data_arg, const char *line)
|
|
|
{
|
|
|
const char *p;
|
|
|
|
|
|
if (st_index < 0)
|
|
|
return 0;
|
|
|
|
|
|
+ av_assert0(!data_arg->sampling);
|
|
|
+
|
|
|
if (av_strstart(line, "fmtp:", &p)) {
|
|
|
AVStream *stream = s->streams[st_index];
|
|
|
+ PayloadContext data0 = *data_arg, *data = &data0;
|
|
|
int ret = ff_parse_fmtp(s, stream, data, p, rfc4175_parse_fmtp);
|
|
|
|
|
|
+ if (!data->sampling || !data->depth || !data->width || !data->height)
|
|
|
+ ret = AVERROR(EINVAL);
|
|
|
+
|
|
|
if (ret < 0)
|
|
|
- return ret;
|
|
|
+ goto fail;
|
|
|
|
|
|
ret = av_image_check_size(data->width, data->height, 0, s);
|
|
|
if (ret < 0)
|
|
|
- return ret;
|
|
|
-
|
|
|
- if (!data->sampling || !data->depth || !data->width || !data->height)
|
|
|
- return AVERROR(EINVAL);
|
|
|
+ goto fail;
|
|
|
|
|
|
stream->codecpar->width = data->width;
|
|
|
stream->codecpar->height = data->height;
|
|
|
|
|
|
ret = rfc4175_parse_format(stream, data);
|
|
|
av_freep(&data->sampling);
|
|
|
-
|
|
|
+ if (ret >= 0)
|
|
|
+ *data_arg = *data;
|
|
|
+fail:
|
|
|
+ av_freep(&data->sampling);
|
|
|
return ret;
|
|
|
}
|
|
|
|