[FFmpeg-cvslog] avformat/oggdec: Simplify cleanup after read_header failure
Andreas Rheinhardt
git at videolan.org
Thu Jul 8 16:45:01 EEST 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sat Mar 21 18:31:06 2020 +0100| [7c684827d90d82822f426d73564cee8479fccc7b] | committer: Andreas Rheinhardt
avformat/oggdec: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c684827d90d82822f426d73564cee8479fccc7b
---
libavformat/oggdec.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index e5ca3272cd..bb289e0756 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -732,10 +732,8 @@ static int ogg_read_header(AVFormatContext *s)
//linear headers seek from start
do {
ret = ogg_packet(s, NULL, NULL, NULL, NULL);
- if (ret < 0) {
- ogg_read_close(s);
+ if (ret < 0)
return ret;
- }
} while (!ogg->headers);
av_log(s, AV_LOG_TRACE, "found headers\n");
@@ -751,10 +749,8 @@ static int ogg_read_header(AVFormatContext *s)
"Headers mismatch for stream %d: "
"expected %d received %d.\n",
i, os->codec->nb_header, os->nb_header);
- if (s->error_recognition & AV_EF_EXPLODE) {
- ogg_read_close(s);
+ if (s->error_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA;
- }
}
if (os->start_granule != OGG_NOGRANULE_VALUE)
os->lastpts = s->streams[i]->start_time =
@@ -763,10 +759,8 @@ static int ogg_read_header(AVFormatContext *s)
//linear granulepos seek from end
ret = ogg_get_length(s);
- if (ret < 0) {
- ogg_read_close(s);
+ if (ret < 0)
return ret;
- }
return 0;
}
@@ -970,6 +964,7 @@ const AVInputFormat ff_ogg_demuxer = {
.name = "ogg",
.long_name = NULL_IF_CONFIG_SMALL("Ogg"),
.priv_data_size = sizeof(struct ogg),
+ .flags_internal = FF_FMT_INIT_CLEANUP,
.read_probe = ogg_probe,
.read_header = ogg_read_header,
.read_packet = ogg_read_packet,
More information about the ffmpeg-cvslog
mailing list