Closed Bug 1097375 Opened 5 years ago Closed 5 years ago

Implement MediaSource::SetDuration

Categories

(Core :: Audio/Video, defect)

29 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: mattwoodrow, Assigned: mattwoodrow)

References

Details

Attachments

(1 file)

Splitting this off from bug 896884 because I've only implemented part of what that bug covers.

The Dashif player example video doesn't decode a duration, and it just sets on using MediaSource.duration.

I had to move the mDuration value from MediaSource into MediaSourceDecoder so that it can be protected by the monitor and accessed from multiple threads.

This is because MediaSourceReader::ReadMetadata needs to update the duration value in MDSM immediately, but we're only supposed to use it if a value hasn't already been set using setDuration. Since this happens off the main-thread, we need to lock accesses to mDuration.
This fixes the dashif player use case, and *almost* passes the MediaSourceDuration test from the conformance test suite (with both mp4 and webm).

I've filed bug 1097381 for the remaining work to get the test to pass.
Attachment #8521039 - Flags: review?(kinetik)
See Also: → 1097252
Comment on attachment 8521039 [details] [diff] [review]
Implement setDuration properly.

Review of attachment 8521039 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/media/mediasource/MediaSourceDecoder.h
@@ +77,5 @@
>    dom::MediaSource* mMediaSource;
>    nsRefPtr<MediaSourceReader> mReader;
> +
> +  // Protected by GetReentrantMonitor()
> +  double mDuration;

This shadows |int64_t mDuration| on the base class.  It could be confusing, maybe rename it if you can think of a good name?
Attachment #8521039 - Flags: review?(kinetik) → review+
https://hg.mozilla.org/mozilla-central/rev/1ef10ba3d73c
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.