Closed Bug 1353607 Opened 7 years ago Closed 7 years ago

Convert more use of int64_t for microseconds to TimeUnit in MDSM

Categories

(Core :: Audio/Video: Playback, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: jwwang, Assigned: jwwang)

References

(Blocks 1 open bug)

Details

Attachments

(12 files)

59 bytes, text/x-review-board-request
kikuo
: review+
Details
59 bytes, text/x-review-board-request
kikuo
: review+
Details
59 bytes, text/x-review-board-request
kikuo
: review+
Details
59 bytes, text/x-review-board-request
kikuo
: review+
Details
59 bytes, text/x-review-board-request
kikuo
: review+
Details
59 bytes, text/x-review-board-request
kikuo
: review+
Details
59 bytes, text/x-review-board-request
kikuo
: review+
Details
59 bytes, text/x-review-board-request
kikuo
: review+
Details
59 bytes, text/x-review-board-request
kikuo
: review+
Details
59 bytes, text/x-review-board-request
kikuo
: review+
Details
59 bytes, text/x-review-board-request
kikuo
: review+
Details
59 bytes, text/x-review-board-request
kikuo
: review+
Details
Another step further into bug 1245019.
Assignee: nobody → jwwang
Blocks: 1245019
Priority: -- → P3
Attachment #8854662 - Flags: review?(kikuo)
Attachment #8854663 - Flags: review?(kikuo)
Attachment #8854664 - Flags: review?(kikuo)
Attachment #8854665 - Flags: review?(kikuo)
Attachment #8854666 - Flags: review?(kikuo)
Attachment #8854667 - Flags: review?(kikuo)
Attachment #8854668 - Flags: review?(kikuo)
Attachment #8854669 - Flags: review?(kikuo)
Attachment #8854670 - Flags: review?(kikuo)
Attachment #8854671 - Flags: review?(kikuo)
Attachment #8854672 - Flags: review?(kikuo)
Attachment #8854673 - Flags: review?(kikuo)
Comment on attachment 8854662 [details]
Bug 1353607. P1 - remove the dead code.

https://reviewboard.mozilla.org/r/126602/#review129216
Attachment #8854662 - Flags: review?(kikuo) → review+
Comment on attachment 8854663 [details]
Bug 1353607. P2 - let GetDecodedAudioDuration() return a TimeUnit.

https://reviewboard.mozilla.org/r/126604/#review129814
Attachment #8854663 - Flags: review?(kikuo) → review+
Comment on attachment 8854664 [details]
Bug 1353607. P3 - use TimeUnit in ScheduleStateMachineIn().

https://reviewboard.mozilla.org/r/126606/#review129818
Attachment #8854664 - Flags: review?(kikuo) → review+
Comment on attachment 8854665 [details]
Bug 1353607. P4 - change the type of mFragmentEndTime to TimeUnit.

https://reviewboard.mozilla.org/r/126608/#review129826
Attachment #8854665 - Flags: review?(kikuo) → review+
Comment on attachment 8854666 [details]
Bug 1353607. P5 - change the type of mDecodedAudioEndTime/mDecodedVideoEndTime to TimeUnit.

https://reviewboard.mozilla.org/r/126610/#review129828
Attachment #8854666 - Flags: review?(kikuo) → review+
Comment on attachment 8854667 [details]
Bug 1353607. P6 - use TimeUnit in CheckSlowDecoding().

https://reviewboard.mozilla.org/r/126612/#review129844
Attachment #8854667 - Flags: review?(kikuo) → review+
Comment on attachment 8854668 [details]
Bug 1353607. P7 - remove the unused function.

https://reviewboard.mozilla.org/r/126614/#review129950
Attachment #8854668 - Flags: review?(kikuo) → review+
Comment on attachment 8854669 [details]
Bug 1353607. P8 - use TimeUnit in DispatchSetFragmentEndTime().

https://reviewboard.mozilla.org/r/126616/#review129978
Attachment #8854669 - Flags: review?(kikuo) → review+
Comment on attachment 8854670 [details]
Bug 1353607. P9 - change the underlying type of mCurrentPosition to TimeUnit.

https://reviewboard.mozilla.org/r/126618/#review129982
Attachment #8854670 - Flags: review?(kikuo) → review+
Comment on attachment 8854671 [details]
Bug 1353607. P10 - use TimeUnit in DropAudioUpToSeekTarget().

https://reviewboard.mozilla.org/r/126620/#review130236

::: dom/media/MediaDecoderStateMachine.cpp:1352
(Diff revision 1)
> -    CheckedInt64 framesToPrune = UsecsToFrames(
> -      mSeekJob.mTarget->GetTime().ToMicroseconds() - aAudio->mTime,
> +    CheckedInt64 framesToPrune = TimeUnitToFrames(
> +      mSeekJob.mTarget->GetTime() - audioTime, Info().mAudio.mRate);
> -      Info().mAudio.mRate);
>      if (!framesToPrune.isValid()) {
>        return NS_ERROR_DOM_MEDIA_OVERFLOW_ERR;
>      }
>      if (framesToPrune.value() > aAudio->mFrames) {
>        // We've messed up somehow. Don't try to trim frames, the |frames|
>        // variable below will overflow.
>        SLOGW("Can't prune more frames that we have!");
>        return NS_ERROR_FAILURE;
>      }
> -    uint32_t frames =
> +    uint32_t frames = aAudio->mFrames - uint32_t(framesToPrune.value());

Every time I looked into this place, it always took me a while to check the type conversion. Because framesToPrune is a int64, but we get the 'uint32_t frames' by substracting it.

And then I noticed again that there's a conditional check above ... |if (framesToPrune.value() > aAudio->mFrames)|

:(
Attachment #8854671 - Flags: review?(kikuo) → review+
Comment on attachment 8854672 [details]
Bug 1353607. P11 - use TimeUnit in RecomputeDuration().

https://reviewboard.mozilla.org/r/126622/#review130238
Attachment #8854672 - Flags: review?(kikuo) → review+
Comment on attachment 8854673 [details]
Bug 1353607. P12 - replace |TimeUnit::ToMicroseconds()*double| with |TimeUnit::MultDouble()|.

https://reviewboard.mozilla.org/r/126624/#review130252
Attachment #8854673 - Flags: review?(kikuo) → review+
Thanks for the review!
Pushed by jwwang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6d07c599d031
P1 - remove the dead code. r=kikuo
https://hg.mozilla.org/integration/autoland/rev/f7909dc12794
P2 - let GetDecodedAudioDuration() return a TimeUnit. r=kikuo
https://hg.mozilla.org/integration/autoland/rev/1e0d6ee061d2
P3 - use TimeUnit in ScheduleStateMachineIn(). r=kikuo
https://hg.mozilla.org/integration/autoland/rev/af62c8593753
P4 - change the type of mFragmentEndTime to TimeUnit. r=kikuo
https://hg.mozilla.org/integration/autoland/rev/b652d908fc4c
P5 - change the type of mDecodedAudioEndTime/mDecodedVideoEndTime to TimeUnit. r=kikuo
https://hg.mozilla.org/integration/autoland/rev/19ca8c9a6ac8
P6 - use TimeUnit in CheckSlowDecoding(). r=kikuo
https://hg.mozilla.org/integration/autoland/rev/d1a102bb93a7
P7 - remove the unused function. r=kikuo
https://hg.mozilla.org/integration/autoland/rev/12ad42030432
P8 - use TimeUnit in DispatchSetFragmentEndTime(). r=kikuo
https://hg.mozilla.org/integration/autoland/rev/78f4e24a6693
P9 - change the underlying type of mCurrentPosition to TimeUnit. r=kikuo
https://hg.mozilla.org/integration/autoland/rev/1f6bb215acef
P10 - use TimeUnit in DropAudioUpToSeekTarget(). r=kikuo
https://hg.mozilla.org/integration/autoland/rev/8064ece4cfd7
P11 - use TimeUnit in RecomputeDuration(). r=kikuo
https://hg.mozilla.org/integration/autoland/rev/ff0a61f271ed
P12 - replace |TimeUnit::ToMicroseconds()*double| with |TimeUnit::MultDouble()|. r=kikuo
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: