mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-11 09:20:01 +01:00
avformat/rtpdec_rfc4175: Only change PayloadContext on success
Reviewed-by: Joshua Rogers <joshua@joshua.hu>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c03e49dd1d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include "avio_internal.h"
|
#include "avio_internal.h"
|
||||||
#include "rtpdec_formats.h"
|
#include "rtpdec_formats.h"
|
||||||
|
#include "libavutil/avassert.h"
|
||||||
#include "libavutil/avstring.h"
|
#include "libavutil/avstring.h"
|
||||||
#include "libavutil/imgutils.h"
|
#include "libavutil/imgutils.h"
|
||||||
#include "libavutil/pixdesc.h"
|
#include "libavutil/pixdesc.h"
|
||||||
@@ -91,33 +92,39 @@ static int rfc4175_parse_fmtp(AVFormatContext *s, AVStream *stream,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int rfc4175_parse_sdp_line(AVFormatContext *s, int st_index,
|
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;
|
const char *p;
|
||||||
|
|
||||||
if (st_index < 0)
|
if (st_index < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
av_assert0(!data_arg->sampling);
|
||||||
|
|
||||||
if (av_strstart(line, "fmtp:", &p)) {
|
if (av_strstart(line, "fmtp:", &p)) {
|
||||||
AVStream *stream = s->streams[st_index];
|
AVStream *stream = s->streams[st_index];
|
||||||
|
PayloadContext data0 = *data_arg, *data = &data0;
|
||||||
int ret = ff_parse_fmtp(s, stream, data, p, rfc4175_parse_fmtp);
|
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)
|
if (ret < 0)
|
||||||
return ret;
|
goto fail;
|
||||||
|
|
||||||
ret = av_image_check_size(data->width, data->height, 0, s);
|
ret = av_image_check_size(data->width, data->height, 0, s);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
goto fail;
|
||||||
|
|
||||||
if (!data->sampling || !data->depth || !data->width || !data->height)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
stream->codecpar->width = data->width;
|
stream->codecpar->width = data->width;
|
||||||
stream->codecpar->height = data->height;
|
stream->codecpar->height = data->height;
|
||||||
|
|
||||||
ret = rfc4175_parse_format(stream, data);
|
ret = rfc4175_parse_format(stream, data);
|
||||||
av_freep(&data->sampling);
|
av_freep(&data->sampling);
|
||||||
|
if (ret >= 0)
|
||||||
|
*data_arg = *data;
|
||||||
|
fail:
|
||||||
|
av_freep(&data->sampling);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user