mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-06-10 02:18:57 +00:00
Properly set dts on plain MP4 media
This fixes a problem of frames being displayed out of order with some versions of LibAV/FFmpeg.
This commit is contained in:
@@ -255,6 +255,7 @@ Index::Index(const nsTArray<Indice>& aIndex,
|
||||
indice.end_offset);
|
||||
sample.mCompositionRange = Interval<Microseconds>(indice.start_composition,
|
||||
indice.end_composition);
|
||||
sample.mDecodeTime = indice.start_decode;
|
||||
sample.mSync = indice.sync;
|
||||
MOZ_ALWAYS_TRUE(mIndex.AppendElement(sample));
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ ConvertIndex(FallibleTArray<Index::Indice>& aDest,
|
||||
indice.end_offset = s_indice.end_offset;
|
||||
indice.start_composition = s_indice.start_composition;
|
||||
indice.end_composition = s_indice.end_composition;
|
||||
indice.start_decode = s_indice.start_decode;
|
||||
indice.sync = s_indice.sync;
|
||||
MOZ_ALWAYS_TRUE(aDest.AppendElement(indice));
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
uint64_t end_offset;
|
||||
uint64_t start_composition;
|
||||
uint64_t end_composition;
|
||||
uint64_t start_decode;
|
||||
bool sync;
|
||||
};
|
||||
|
||||
|
||||
@@ -116,6 +116,7 @@ struct MediaSource : public virtual RefBase {
|
||||
uint64_t end_offset;
|
||||
uint64_t start_composition;
|
||||
uint64_t end_composition;
|
||||
uint64_t start_decode;
|
||||
bool sync;
|
||||
};
|
||||
|
||||
|
||||
@@ -4150,9 +4150,10 @@ nsTArray<MediaSource::Indice> MPEG4Source::exportIndex()
|
||||
uint32_t compositionTime;
|
||||
uint32_t duration;
|
||||
bool isSyncSample;
|
||||
uint32_t decodeTime;
|
||||
if (mSampleTable->getMetaDataForSample(sampleIndex, &offset, &size,
|
||||
&compositionTime, &duration,
|
||||
&isSyncSample) != OK) {
|
||||
&isSyncSample, &decodeTime) != OK) {
|
||||
ALOGE("Unexpected sample table problem");
|
||||
continue;
|
||||
}
|
||||
@@ -4166,6 +4167,7 @@ nsTArray<MediaSource::Indice> MPEG4Source::exportIndex()
|
||||
indice.end_composition =
|
||||
(compositionTime * 1000000ll + duration * 1000000ll) / mTimescale;
|
||||
indice.sync = isSyncSample;
|
||||
indice.start_decode = (decodeTime * 1000000ll) / mTimescale;
|
||||
MOZ_ALWAYS_TRUE(index.AppendElement(indice));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user