mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
Clean up SetDuration and remove negative duration case
This commit is contained in:
@@ -1448,7 +1448,7 @@ void MediaDecoderStateMachine::RecomputeDuration()
|
||||
fireDurationChanged = true;
|
||||
}
|
||||
|
||||
SetDuration(duration.ToMicroseconds());
|
||||
SetDuration(duration);
|
||||
|
||||
if (fireDurationChanged) {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
@@ -1457,29 +1457,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.
|
||||
|
||||
Reference in New Issue
Block a user