Adjust timestamps in fMP4 if there is an initial composition offset
In some ISO-BMFF files, there is an initial non-zero composition offset, but there is no EditList present. This is against ISO-BMFF spec recommentation [1] and we believe in most cases it is just missing the EditList. [1] 14496-12:2015 8.6.6.1 It is recommended that such an edit be used to establish a presentation time of 0 for the first presented sample, when composition offsets are used. Issue: #112. Change-Id: I178d5ec9d8c294c9f70aac4f4dd6254c824e2255
This commit is contained in:
parent
0fe31423cb
commit
36a7c7d935
|
@ -681,8 +681,15 @@ int64_t TrackRunIterator::GetTimestampAdjustment(const Movie& movie,
|
||||||
} else {
|
} else {
|
||||||
CompositionOffsetIterator composition_offset_iter(
|
CompositionOffsetIterator composition_offset_iter(
|
||||||
track.media.information.sample_table.composition_time_to_sample);
|
track.media.information.sample_table.composition_time_to_sample);
|
||||||
if (composition_offset_iter.IsValid())
|
if (!composition_offset_iter.IsValid()) {
|
||||||
composition_offset = composition_offset_iter.sample_offset();
|
// This is the init (sub)segment of a fragmented mp4, which does not
|
||||||
|
// contain any samples. Exit with 0 adjustment and without storing
|
||||||
|
// |timestamp_adjustment|. This function will be called again later
|
||||||
|
// with track fragment |traf|. |timestamp_adjustment| will be computed
|
||||||
|
// and stored then.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
composition_offset = composition_offset_iter.sample_offset();
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t decode_time = 0;
|
int64_t decode_time = 0;
|
||||||
|
|
Loading…
Reference in New Issue