avformat/utils: Don't initialize AVStreamInternal.info multiple times

It has been allocated and initialized in avformat_find_stream_info()
until fd0368e7ca when the structure
was moved to AVStreamInternal and its allocation to avformat_new_stream.
In order to also initialize the struct for new streams that only get
created during avformat_find_stream_info() said the initialization has
been added to avformat_new_stream() later. Due to the Libav-FFmpeg split
this has been done twice: In 4cda8aa1c5
and in 30c26c2442. The initialization in
avformat_find_stream_info() has not been removed at all despite being
redundant. This commit removes it and the duplicated initialization in
avformat_new_stream().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
pull/365/head
Andreas Rheinhardt 3 years ago
parent 2c3c83663d
commit 10646d30a3
  1. 9
      libavformat/utils.c

@ -3624,14 +3624,6 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
av_dict_free(&thread_opt);
}
for (i = 0; i < ic->nb_streams; i++) {
#if FF_API_R_FRAME_RATE
ic->streams[i]->internal->info->last_dts = AV_NOPTS_VALUE;
#endif
ic->streams[i]->internal->info->fps_first_dts = AV_NOPTS_VALUE;
ic->streams[i]->internal->info->fps_last_dts = AV_NOPTS_VALUE;
}
read_size = 0;
for (;;) {
const AVPacket *pkt;
@ -4379,7 +4371,6 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
st->internal->info = av_mallocz(sizeof(*st->internal->info));
if (!st->internal->info)
goto fail;
st->internal->info->last_dts = AV_NOPTS_VALUE;
st->codecpar = avcodec_parameters_alloc();
if (!st->codecpar)

Loading…
Cancel
Save