Closed Bug 1221009 Opened 9 years ago Closed 9 years ago

Separate the interface of MediaResourceCallback from MediaDecoder

Categories

(Core :: Audio/Video: Playback, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: jwwang, Assigned: jwwang)

References

Details

Attachments

(3 files)

We will have a class inheriting MediaResourceCallback to forward notifications from MediaResource to MediaDecoder which no longer inherits MediaResourceCallback.

There are several benefits in doing this:
1. We will be able to create MediaDecoder after MediaResource is instantiated and remove the need for MediaDecoder::SetResource() by passing MediaResource to the constructor. This allow us to make mResource const and simplify the logic.

2. MediaDecoder can be disconnected from the object to stop receiving notifications from MediaResource. We won't have to check if MediaDecoder is in a valid state (shutdown or not) to process the notifications.
Assignee: nobody → jwwang
Blocks: 1218279
Priority: -- → P2
Bug 1221009. Part 1 - add a class to forward notifications from MediaResource to MediaDecoder. r=roc.
Attachment #8686528 - Flags: review?(roc)
Bug 1221009. Part 2 - remove unused code. r=roc.
Attachment #8686529 - Flags: review?(roc)
Bug 1221009. Part 3 - add assertions to functions that shouldn't be called after shutdown. r=roc.
Attachment #8686530 - Flags: review?(roc)
Comment on attachment 8686528 [details]
MozReview Request: Bug 1221009. Part 1 - add a class to forward notifications from MediaResource to MediaDecoder. r=roc.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/24995/diff/1-2/
For some reason I can't review those patches. Others do work. Maybe you need to repost them?
Flags: needinfo?(jwwang)
Comment on attachment 8686528 [details]
MozReview Request: Bug 1221009. Part 1 - add a class to forward notifications from MediaResource to MediaDecoder. r=roc.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/24995/diff/1-2/
Comment on attachment 8686529 [details]
MozReview Request: Bug 1221009. Part 2 - remove unused code. r=roc.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/24997/diff/1-2/
Comment on attachment 8686530 [details]
MozReview Request: Bug 1221009. Part 3 - add assertions to functions that shouldn't be called after shutdown. r=roc.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/24999/diff/1-2/
reposted. Does it work?
Flags: needinfo?(jwwang)
Comment on attachment 8686528 [details]
MozReview Request: Bug 1221009. Part 1 - add a class to forward notifications from MediaResource to MediaDecoder. r=roc.

https://reviewboard.mozilla.org/r/24995/#review22725

This is only a very small improvement IMHO, but since you've done it, I guess we might as well take it.
Comment on attachment 8686529 [details]
MozReview Request: Bug 1221009. Part 2 - remove unused code. r=roc.

https://reviewboard.mozilla.org/r/24997/#review22727
Attachment #8686529 - Flags: review?(roc) → review+
Comment on attachment 8686530 [details]
MozReview Request: Bug 1221009. Part 3 - add assertions to functions that shouldn't be called after shutdown. r=roc.

https://reviewboard.mozilla.org/r/24999/#review22729
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #11)
> This is only a very small improvement IMHO, but since you've done it, I
> guess we might as well take it.

I mean, it probably wasn't worth your time to do this.
Thanks for the review!

This is a step forward to remove bi-directional dependency between MediaDecoder and MDSM/MediaResource. For now, MediaDecoder functions could be called after Shutdown() and we have to check |mShuttingDown| from time to time to know if this MediaDecoder is in a valid state to handle the request.

I would like to apply the observer pattern so MediaDecoder can convenient disconnect from the event publishers (MDSM or MediaResource) during shutdown to stop receiving notifications. It also helps improve the logic of MediaDecoder in a more readable way.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: