Closed
Bug 1000264
Opened 11 years ago
Closed 11 years ago
Implement the new prototype for decodeAudioData, that returns a promise
Categories
(Core :: Web Audio, defect)
Tracking
()
RESOLVED
FIXED
mozilla36
People
(Reporter: padenot, Assigned: padenot)
References
Details
Attachments
(4 files, 1 obsolete file)
1.34 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
3.72 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
10.08 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
2.65 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
Comment 1•11 years ago
|
||
Yay! :-)
Assignee | ||
Comment 2•11 years ago
|
||
Boris, Ehsan told me this would work, but to ask you for this one.
Basically, we need to pass in an AudioBuffer when a Promise return from
AudioContext.decodeAudioData is resolved, and AudioBuffers are not inheriting
from nsISupports. Do you think this is this the right thing to do?
Attachment #8509670 -
Flags: review?(bzbarsky)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → padenot
Status: NEW → ASSIGNED
Assignee | ||
Comment 3•11 years ago
|
||
Attachment #8509676 -
Flags: review?(ehsan.akhgari)
Assignee | ||
Comment 4•11 years ago
|
||
And some tests. This is separate from test_mediaDecode.html, because it only test that the promise work properly, not that the decoding works properly.
Attachment #8509679 -
Flags: review?(ehsan.akhgari)
Updated•11 years ago
|
Attachment #8509676 -
Attachment is patch: true
Updated•11 years ago
|
Attachment #8509679 -
Attachment is patch: true
Comment 5•11 years ago
|
||
Comment on attachment 8509676 [details] [diff] [review]
decodeaudiodata-promises
Review of attachment 8509676 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/media/webaudio/MediaBufferDecoder.cpp
@@ +591,5 @@
> ErrorResult rv;
> mFailureCallback->Call(rv);
> }
>
> + mPromise->MaybeReject(NS_ERROR_FAILURE);
The spec says that we should reject the promise with EncodingError in this case, right?
Attachment #8509676 -
Flags: review?(ehsan.akhgari) → review-
Comment 6•11 years ago
|
||
Comment on attachment 8509679 [details] [diff] [review]
test
Review of attachment 8509679 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/media/webaudio/MediaBufferDecoder.cpp
@@ +544,5 @@
> // do about it here.
> ErrorResult rv;
> + if (mSuccessCallback) {
> + mSuccessCallback->Call(*mOutput, rv);
> + }
I'd collapse all of these patches into one when landing, FWIW.
::: content/media/webaudio/test/test_decodeAudioDataPromise.html
@@ +30,5 @@
> + p.then(function(data) {
> + ok(false, "Promise should not resolve with an invalid source buffer.");
> + finish();
> + }).catch(function() {
> + ok(true, "Promise should be rejected with an invalid source buffer.");
Please test the error that the promise is rejected with (see my comment about the other patch.)
Attachment #8509679 -
Flags: review?(ehsan.akhgari) → review+
![]() |
||
Comment 7•11 years ago
|
||
Comment on attachment 8509670 [details] [diff] [review]
Allow an object that inherits from nsWrapperCache but not nsISupports to be passed as a Promise::MaybeResolve argument. r=
Yeah, this seems fine. Especially given the IsDOMBinding() assert there.
r=me
Attachment #8509670 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 8•11 years ago
|
||
(In reply to :Ehsan Akhgari (not reading bugmail, needinfo? me!) from comment #6)
> Comment on attachment 8509679 [details] [diff] [review]
> test
>
> Review of attachment 8509679 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: content/media/webaudio/MediaBufferDecoder.cpp
> @@ +544,5 @@
> > // do about it here.
> > ErrorResult rv;
> > + if (mSuccessCallback) {
> > + mSuccessCallback->Call(*mOutput, rv);
> > + }
>
> I'd collapse all of these patches into one when landing, FWIW.
Ha yes, for some reason I qrefed C++ code in the test. But yes, I'll squash them all into one.
> ::: content/media/webaudio/test/test_decodeAudioDataPromise.html
> @@ +30,5 @@
> > + p.then(function(data) {
> > + ok(false, "Promise should not resolve with an invalid source buffer.");
> > + finish();
> > + }).catch(function() {
> > + ok(true, "Promise should be rejected with an invalid source buffer.");
>
> Please test the error that the promise is rejected with (see my comment
> about the other patch.)
Hrm, yes. It confuses me that EncodingError is defined in the StringEncoding spec, whereas we use it here to refer to audio encoding. That said, the message is not wrong per se ("EncodingError: The given encoding is not supported."), but decodeAudioData could fail in other ways with legal files.
Assignee | ||
Comment 9•11 years ago
|
||
Attachment #8510190 -
Flags: review?(ehsan.akhgari)
Assignee | ||
Updated•11 years ago
|
Attachment #8509676 -
Attachment is obsolete: true
Updated•11 years ago
|
Attachment #8510190 -
Flags: review?(ehsan.akhgari) → review+
Assignee | ||
Comment 10•11 years ago
|
||
Comment on attachment 8510190 [details] [diff] [review]
Make AudioContext.decodeAudioData return a promise. r=
I forgot I needed another review for the WebIDL change.
Spec is here: http://webaudio.github.io/web-audio-api/#widl-AudioContext-decodeAudioData-Promise-AudioBuffer--ArrayBuffer-audioData-DecodeSuccessCallback-successCallback-DecodeErrorCallback-errorCallback
According to annevk, in the spec, the callback should not be fired directly, but off a task, I filed a bug and written a patch for the spec here: https://github.com/WebAudio/web-audio-api/issues/418. This is effectively what we do in Gecko (NS_DispatchToMainThread from the decoding thread, and then call the callback from there).
Attachment #8510190 -
Flags: review+ → review?(bzbarsky)
![]() |
||
Comment 11•11 years ago
|
||
Comment on attachment 8510190 [details] [diff] [review]
Make AudioContext.decodeAudioData return a promise. r=
>+ if (rv.Failed()) {
Why not do this right after the CreatePromise call?
r=me
Attachment #8510190 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 12•11 years ago
|
||
Comment 13•11 years ago
|
||
Comment 14•11 years ago
|
||
Looks like it was a straight-up Linux failure (not e10s related).
Comment 15•11 years ago
|
||
Make that a failure across the board. Please make sure this is green on Try before relanding ;)
Assignee | ||
Comment 16•11 years ago
|
||
Attachment #8522394 -
Flags: review?(bzbarsky)
![]() |
||
Comment 17•11 years ago
|
||
Comment on attachment 8522394 [details] [diff] [review]
Stop checking exceptions on decodeAudioData now that it uses promises, and check it in the promise test file instead. r=
>+ ok(e.name == "TypeError", "The error should be EncodingError");
I don't see how the name check there says anything about it being EncodingError.
r=me apart from that
Attachment #8522394 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 18•11 years ago
|
||
Yes sorry, it was jus me being confused.
Assignee | ||
Comment 19•11 years ago
|
||
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/32ffa20c5e8f
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/6ead619835d3
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/ceed59c28910
remote: https://hg.mozilla.org/integration/mozilla-inbound/rev/854091113b03
Comment 20•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/32ffa20c5e8f
https://hg.mozilla.org/mozilla-central/rev/6ead619835d3
https://hg.mozilla.org/mozilla-central/rev/ceed59c28910
https://hg.mozilla.org/mozilla-central/rev/854091113b03
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in
before you can comment on or make changes to this bug.
Description
•