Merge remote branch 'qatar/master'
* qatar/master: mov: fix composition timestamps on movie fragments. wmavoice: Use proper size in memeset().
This commit is contained in:
commit
e5a85164b1
@ -315,7 +315,7 @@ static av_cold int decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25])
|
|||||||
};
|
};
|
||||||
int cntr[8], n, res;
|
int cntr[8], n, res;
|
||||||
|
|
||||||
memset(vbm_tree, 0xff, sizeof(vbm_tree));
|
memset(vbm_tree, 0xff, sizeof(vbm_tree[0]) * 25);
|
||||||
memset(cntr, 0, sizeof(cntr));
|
memset(cntr, 0, sizeof(cntr));
|
||||||
for (n = 0; n < 17; n++) {
|
for (n = 0; n < 17; n++) {
|
||||||
res = get_bits(gb, 3);
|
res = get_bits(gb, 3);
|
||||||
|
@ -2004,6 +2004,7 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
MOVFragment *frag = &c->fragment;
|
MOVFragment *frag = &c->fragment;
|
||||||
AVStream *st = NULL;
|
AVStream *st = NULL;
|
||||||
MOVStreamContext *sc;
|
MOVStreamContext *sc;
|
||||||
|
MOVStts *ctts_data;
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
int64_t dts;
|
int64_t dts;
|
||||||
int data_offset = 0;
|
int data_offset = 0;
|
||||||
@ -2027,18 +2028,33 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
flags = avio_rb24(pb);
|
flags = avio_rb24(pb);
|
||||||
entries = avio_rb32(pb);
|
entries = avio_rb32(pb);
|
||||||
av_dlog(c->fc, "flags 0x%x entries %d\n", flags, entries);
|
av_dlog(c->fc, "flags 0x%x entries %d\n", flags, entries);
|
||||||
if (flags & 0x001) data_offset = avio_rb32(pb);
|
|
||||||
if (flags & 0x004) first_sample_flags = avio_rb32(pb);
|
/* Always assume the presence of composition time offsets.
|
||||||
if (flags & 0x800) {
|
* Without this assumption, for instance, we cannot deal with a track in fragmented movies that meet the following.
|
||||||
MOVStts *ctts_data;
|
* 1) in the initial movie, there are no samples.
|
||||||
if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data))
|
* 2) in the first movie fragment, there is only one sample without composition time offset.
|
||||||
return -1;
|
* 3) in the subsequent movie fragments, there are samples with composition time offset. */
|
||||||
ctts_data = av_realloc(sc->ctts_data,
|
if (!sc->ctts_count && sc->sample_count)
|
||||||
(entries+sc->ctts_count)*sizeof(*sc->ctts_data));
|
{
|
||||||
|
/* Complement ctts table if moov atom doesn't have ctts atom. */
|
||||||
|
ctts_data = av_malloc(sizeof(*sc->ctts_data));
|
||||||
if (!ctts_data)
|
if (!ctts_data)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
sc->ctts_data = ctts_data;
|
sc->ctts_data = ctts_data;
|
||||||
|
sc->ctts_data[sc->ctts_count].count = sc->sample_count;
|
||||||
|
sc->ctts_data[sc->ctts_count].duration = 0;
|
||||||
|
sc->ctts_count++;
|
||||||
}
|
}
|
||||||
|
if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data))
|
||||||
|
return -1;
|
||||||
|
ctts_data = av_realloc(sc->ctts_data,
|
||||||
|
(entries+sc->ctts_count)*sizeof(*sc->ctts_data));
|
||||||
|
if (!ctts_data)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
sc->ctts_data = ctts_data;
|
||||||
|
|
||||||
|
if (flags & 0x001) data_offset = avio_rb32(pb);
|
||||||
|
if (flags & 0x004) first_sample_flags = avio_rb32(pb);
|
||||||
dts = st->duration;
|
dts = st->duration;
|
||||||
offset = frag->base_data_offset + data_offset;
|
offset = frag->base_data_offset + data_offset;
|
||||||
distance = 0;
|
distance = 0;
|
||||||
@ -2052,11 +2068,9 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||||||
if (flags & 0x100) sample_duration = avio_rb32(pb);
|
if (flags & 0x100) sample_duration = avio_rb32(pb);
|
||||||
if (flags & 0x200) sample_size = avio_rb32(pb);
|
if (flags & 0x200) sample_size = avio_rb32(pb);
|
||||||
if (flags & 0x400) sample_flags = avio_rb32(pb);
|
if (flags & 0x400) sample_flags = avio_rb32(pb);
|
||||||
if (flags & 0x800) {
|
sc->ctts_data[sc->ctts_count].count = 1;
|
||||||
sc->ctts_data[sc->ctts_count].count = 1;
|
sc->ctts_data[sc->ctts_count].duration = (flags & 0x800) ? avio_rb32(pb) : 0;
|
||||||
sc->ctts_data[sc->ctts_count].duration = avio_rb32(pb);
|
sc->ctts_count++;
|
||||||
sc->ctts_count++;
|
|
||||||
}
|
|
||||||
if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ||
|
if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ||
|
||||||
(flags & 0x004 && !i && !sample_flags) || sample_flags & 0x2000000))
|
(flags & 0x004 && !i && !sample_flags) || sample_flags & 0x2000000))
|
||||||
distance = 0;
|
distance = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user