This commit is contained in:
Atrotro 2024-08-08 16:41:03 +08:00
commit 92a3c0acc9
2 changed files with 22 additions and 6 deletions

View File

@ -3202,8 +3202,8 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (st->stts_data != NULL) {
memcpy(st->stts_data, sc->stts_data, st->stts_count * sizeof(AVMOVStts));
} else {
av_freep(&st->stts_data);
return AVERROR(ENOMEM);
av_log(c->fc, AV_LOG_WARNING, "st->stts_data malloc failed\n");
st->stts_count = 0;
}
#endif
@ -3333,8 +3333,8 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (st->ctts_data != NULL) {
memcpy(st->ctts_data, sc->ctts_data, st->ctts_count * sizeof(AVMOVCtts));
} else {
av_freep(&st->ctts_data);
return AVERROR(ENOMEM);
av_log(c->fc, AV_LOG_WARNING, "st->ctts_data malloc failed\n");
st->ctts_count = 0;
}
#endif
@ -8460,8 +8460,15 @@ static int mov_read_close(AVFormatContext *s)
MOVStreamContext *sc = st->priv_data;
#ifdef OHOS_EXPAND_MP4_INFO
av_freep(&st->stts_data);
av_freep(&st->ctts_data);
if (st->stts_data != NULL) {
free(st->stts_data);
st->stts_data = NULL;
}
if (st->ctts_data != NULL) {
free(st->ctts_data);
st->ctts_data = NULL;
}
#endif
if (!sc)

View File

@ -295,6 +295,15 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
st->start_time = AV_NOPTS_VALUE;
st->duration = AV_NOPTS_VALUE;
sti->first_dts = AV_NOPTS_VALUE;
#ifdef OHOS_EXPAND_MP4_INFO
st->stts_count = 0;
st->stts_data = NULL;
st->ctts_count = 0;
st->ctts_data = NULL;
st->time_scale = 0;
#endif
sti->probe_packets = s->max_probe_packets;
sti->pts_wrap_reference = AV_NOPTS_VALUE;
sti->pts_wrap_behavior = AV_PTS_WRAP_IGNORE;