зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1563949 - part1 : add function 'GetEndTimeCode'. r=jya
We already have function `GetEndTime()`, so it's good to have a similar function `GetEndTimeCode()` so that we won't have to calculate end time code by ourselves. Differential Revision: https://phabricator.services.mozilla.com/D38425 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
96bd181ea7
Коммит
7cea87585a
|
@ -296,6 +296,8 @@ class MediaData {
|
|||
|
||||
media::TimeUnit GetEndTime() const { return mTime + mDuration; }
|
||||
|
||||
media::TimeUnit GetEndTimecode() const { return mTimecode + mDuration; }
|
||||
|
||||
// Return true if the adjusted time is valid. Caller should handle error when
|
||||
// the result is invalid.
|
||||
virtual bool AdjustForStartTime(const media::TimeUnit& aStartTime) {
|
||||
|
|
|
@ -2477,7 +2477,7 @@ uint32_t TrackBuffersManager::SkipToNextRandomAccessPoint(
|
|||
aFound = true;
|
||||
break;
|
||||
}
|
||||
nextSampleTimecode = sample->mTimecode + sample->mDuration;
|
||||
nextSampleTimecode = sample->GetEndTimecode();
|
||||
nextSampleTime = sample->GetEndTime();
|
||||
parsed++;
|
||||
}
|
||||
|
@ -2570,7 +2570,7 @@ already_AddRefed<MediaRawData> TrackBuffersManager::GetSample(
|
|||
}
|
||||
trackData.mNextGetSampleIndex.ref()++;
|
||||
// Estimate decode timestamp and timestamp of the next sample.
|
||||
TimeUnit nextSampleTimecode = sample->mTimecode + sample->mDuration;
|
||||
TimeUnit nextSampleTimecode = sample->GetEndTimecode();
|
||||
TimeUnit nextSampleTime = sample->GetEndTime();
|
||||
const MediaRawData* nextSample =
|
||||
GetSample(aTrack, trackData.mNextGetSampleIndex.ref(),
|
||||
|
@ -2612,7 +2612,7 @@ already_AddRefed<MediaRawData> TrackBuffersManager::GetSample(
|
|||
UpdateEvictionIndex(trackData, i);
|
||||
|
||||
trackData.mNextGetSampleIndex.ref()++;
|
||||
trackData.mNextSampleTimecode = sample->mTimecode + sample->mDuration;
|
||||
trackData.mNextSampleTimecode = sample->GetEndTimecode();
|
||||
trackData.mNextSampleTime = sample->GetEndTime();
|
||||
return p.forget();
|
||||
}
|
||||
|
@ -2626,8 +2626,7 @@ int32_t TrackBuffersManager::FindCurrentPosition(TrackInfo::TrackType aTrack,
|
|||
// Perform an exact search first.
|
||||
for (uint32_t i = 0; i < track.Length(); i++) {
|
||||
const RefPtr<MediaRawData>& sample = track[i];
|
||||
TimeInterval sampleInterval{sample->mTimecode,
|
||||
sample->mTimecode + sample->mDuration};
|
||||
TimeInterval sampleInterval{sample->mTimecode, sample->GetEndTimecode()};
|
||||
|
||||
if (sampleInterval.ContainsStrict(trackData.mNextSampleTimecode)) {
|
||||
return i;
|
||||
|
@ -2641,8 +2640,8 @@ int32_t TrackBuffersManager::FindCurrentPosition(TrackInfo::TrackType aTrack,
|
|||
|
||||
for (uint32_t i = 0; i < track.Length(); i++) {
|
||||
const RefPtr<MediaRawData>& sample = track[i];
|
||||
TimeInterval sampleInterval{sample->mTimecode,
|
||||
sample->mTimecode + sample->mDuration, aFuzz};
|
||||
TimeInterval sampleInterval{sample->mTimecode, sample->GetEndTimecode(),
|
||||
aFuzz};
|
||||
|
||||
if (sampleInterval.ContainsWithStrictEnd(trackData.mNextSampleTimecode)) {
|
||||
return i;
|
||||
|
@ -2699,7 +2698,7 @@ TimeUnit TrackBuffersManager::GetNextRandomAccessPoint(
|
|||
if (sample->mKeyframe) {
|
||||
return sample->mTime;
|
||||
}
|
||||
nextSampleTimecode = sample->mTimecode + sample->mDuration;
|
||||
nextSampleTimecode = sample->GetEndTimecode();
|
||||
nextSampleTime = sample->GetEndTime();
|
||||
}
|
||||
return TimeUnit::FromInfinity();
|
||||
|
@ -2726,8 +2725,7 @@ nsresult TrackBuffersManager::SetNextGetSampleIndexIfNeeded(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (trackData.mNextSampleTimecode >
|
||||
track.LastElement()->mTimecode + track.LastElement()->mDuration) {
|
||||
if (trackData.mNextSampleTimecode > track.LastElement()->GetEndTimecode()) {
|
||||
// The next element is past our last sample. We're done.
|
||||
trackData.mNextGetSampleIndex = Some(uint32_t(track.Length()));
|
||||
return NS_ERROR_DOM_MEDIA_END_OF_STREAM;
|
||||
|
|
Загрузка…
Ссылка в новой задаче