Closed Bug 1274189 Opened 8 years ago Closed 8 years ago

Remove use of FlushableTaskQueue::Flush() from OpusDataDecoder

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: jwwang, Assigned: jwwang)

References

Details

Attachments

(3 files)

      No description provided.
Assignee: nobody → jwwang
Blocks: 1270039
Attachment #8755744 - Flags: review?(jyavenard) → review+
Comment on attachment 8755744 [details]
MozReview Request: Bug 1274189. Part 1 - rename some functions to be consistent with other MediaDataDecoder sub-classes. r=jya.

https://reviewboard.mozilla.org/r/54782/#review51470
Comment on attachment 8755745 [details]
MozReview Request: Bug 1274189. Part 2 - remove use of FlushableTaskQueue::Flush(). r=jya.

https://reviewboard.mozilla.org/r/54784/#review51472

::: dom/media/platforms/agnostic/OpusDecoder.cpp:323
(Diff revision 1)
>  nsresult
>  OpusDataDecoder::Flush()
>  {
> -  mTaskQueue->Flush();
> -  if (mOpusDecoder) {
> +  mIsFlushing = true;
> +  nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction([this] () {
> +    MOZ_ASSERT(mOpusDecoder);

do not assert. While it's very unlikely, it is possible for mOpusDecoder to be false if initialisation failed.

Flush() is called when the MediaFormatReader shutdown, in which case you would hit the assertion whe initialisation failed.

I guess you could simply return Flush() early if mOpusDecoder is null.
Attachment #8755745 - Flags: review?(jyavenard) → review+
Comment on attachment 8755746 [details]
MozReview Request: Bug 1274189. Part 3 - remove use of FlushableTaskQueue. r=jya

https://reviewboard.mozilla.org/r/54786/#review51474
Attachment #8755746 - Flags: review?(jyavenard) → review+
https://reviewboard.mozilla.org/r/54784/#review51472

> do not assert. While it's very unlikely, it is possible for mOpusDecoder to be false if initialisation failed.
> 
> Flush() is called when the MediaFormatReader shutdown, in which case you would hit the assertion whe initialisation failed.
> 
> I guess you could simply return Flush() early if mOpusDecoder is null.

I will remove the assertion. It is usually a bad idea to continue to use an abject after Init() fails. However, since Init() is resolved (or rejected) asynchronously, chances are we call Shutdown() before the promise is resolved, right?
https://reviewboard.mozilla.org/r/54784/#review51472

> I will remove the assertion. It is usually a bad idea to continue to use an abject after Init() fails. However, since Init() is resolved (or rejected) asynchronously, chances are we call Shutdown() before the promise is resolved, right?

Oops! I mean to return realy when mOpusDecoder is null.
Comment on attachment 8755745 [details]
MozReview Request: Bug 1274189. Part 2 - remove use of FlushableTaskQueue::Flush(). r=jya.

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/54784/diff/1-2/
Comment on attachment 8755746 [details]
MozReview Request: Bug 1274189. Part 3 - remove use of FlushableTaskQueue. r=jya

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/54786/diff/1-2/
(In reply to JW Wang [:jwwang] from comment #8)
> https://reviewboard.mozilla.org/r/54784/#review51472
> 
> > do not assert. While it's very unlikely, it is possible for mOpusDecoder to be false if initialisation failed.
> > 
> > Flush() is called when the MediaFormatReader shutdown, in which case you would hit the assertion whe initialisation failed.
> > 
> > I guess you could simply return Flush() early if mOpusDecoder is null.
> 
> I will remove the assertion. It is usually a bad idea to continue to use an
> abject after Init() fails. However, since Init() is resolved (or rejected)
> asynchronously, chances are we call Shutdown() before the promise is
> resolved, right?

actually, upon checking; the decoder is no longer being flushed if init failed...

so it should be fine with the assert. still doing nothing looks better to me
(In reply to Jean-Yves Avenard [:jya] from comment #12)
> actually, upon checking; the decoder is no longer being flushed if init
> failed...
> 
> so it should be fine with the assert. still doing nothing looks better to me

I see. Thanks for the update and review!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: