зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1160695 - Clean up SetDuration and remove negative duration case. r=jww
This commit is contained in:
Родитель
5d37b9d6aa
Коммит
8bdb81bbd6
|
@ -1491,7 +1491,7 @@ void MediaDecoderStateMachine::RecomputeDuration()
|
|||
fireDurationChanged = true;
|
||||
}
|
||||
|
||||
SetDuration(duration.ToMicroseconds());
|
||||
SetDuration(duration);
|
||||
|
||||
if (fireDurationChanged) {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
|
@ -1500,29 +1500,25 @@ void MediaDecoderStateMachine::RecomputeDuration()
|
|||
}
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::SetDuration(int64_t aDuration)
|
||||
void MediaDecoderStateMachine::SetDuration(TimeUnit aDuration)
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
|
||||
if (aDuration < 0) {
|
||||
mDurationSet = false;
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aDuration.ToMicroseconds() >= 0);
|
||||
mDurationSet = true;
|
||||
|
||||
if (mStartTime == -1) {
|
||||
SetStartTime(0);
|
||||
}
|
||||
|
||||
if (aDuration == INT64_MAX) {
|
||||
if (aDuration.IsInfinite()) {
|
||||
mEndTime = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
mEndTime = mStartTime + aDuration;
|
||||
mEndTime = mStartTime + aDuration.ToMicroseconds();
|
||||
|
||||
if (mDecoder && mEndTime >= 0 && mEndTime < mCurrentPosition.ReadOnWrongThread()) {
|
||||
if (mDecoder && mEndTime >= 0 && mEndTime < mCurrentPosition) {
|
||||
// The current playback position is now past the end of the element duration
|
||||
// the user agent must also seek to the time of the end of the media
|
||||
// resource.
|
||||
|
|
|
@ -204,7 +204,7 @@ public:
|
|||
// media metadata. The decoder monitor must be obtained before calling this.
|
||||
// aDuration is in microseconds.
|
||||
// A value of INT64_MAX will be treated as infinity.
|
||||
void SetDuration(int64_t aDuration);
|
||||
void SetDuration(media::TimeUnit aDuration);
|
||||
|
||||
// Functions used by assertions to ensure we're calling things
|
||||
// on the appropriate threads.
|
||||
|
|
Загрузка…
Ссылка в новой задаче