Closed Bug 1098015 Opened 10 years ago Closed 9 years ago

Need to not fail on seeing RTCAnswerOptions in CreateAnswer

Categories

(Core :: WebRTC: Signaling, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: bwc, Assigned: jib)

References

(Blocks 2 open bugs, )

Details

Attachments

(2 files)

Word is that W3C is moving toward having an RTCAnswerOptions param on createAnswer.
I think this boils down to support for VoiceActivityDetection.
Blocks: webrtc_spec
Rank: 45
Priority: -- → P4
backlog: --- → webRTC+
there is a more immediate problem, see https://github.com/webrtc/apprtc/pull/162#discussion-diff-34814044

When calling this.pc_.createAnswer({mandatory:..., optional: ...})
Firefox errors out since it interprets this as a callback and does not find an error callback.
From discussion with jib on a similar issue in createOffer a while ago we concluded that webidl can't tell the difference between function and object.

Even if it's a no-op, not throwing an error in that case would be good.
The error in comment 2 is:

  TypeError: Not enough arguments to mozRTCPeerConnection.createAnswer.

I'll submit a patch here to support the optional (no-op) argument to createAnswer.

I've opened Bug 1184712 to track voiceActivityDetection.
Bug 1098015 - make createAnswer tolerate (no-op) options argument.
Attachment #8634935 - Flags: review?(docfaraday)
Attachment #8634935 - Flags: review?(bzbarsky)
Assignee: nobody → jib
Attachment #8634935 - Flags: review?(bzbarsky) → review+
Comment on attachment 8634935 [details]
MozReview Request: Bug 1098015 - make createAnswer tolerate (no-op) options argument.

https://reviewboard.mozilla.org/r/13477/#review12095

Ship It!
Comment on attachment 8634935 [details]
MozReview Request: Bug 1098015 - make createAnswer tolerate (no-op) options argument.

https://reviewboard.mozilla.org/r/13477/#review12097

::: dom/media/PeerConnection.js:697
(Diff revision 1)
> -  createAnswer: function(onSuccess, onError) {
> +  createAnswer: function(optionsOrOnSuccess, onError) {
> +    let onSuccess, options;
> +    if (typeof optionsOrOnSuccess == "function") {
> +      onSuccess = optionsOrOnSuccess;
> +    } else {
> +      options = optionsOrOnSuccess;
> +    }

I think it would be helpful to comment why we're doing this.
Attachment #8634935 - Flags: review?(docfaraday) → review+
https://reviewboard.mozilla.org/r/13477/#review12097

> I think it would be helpful to comment why we're doing this.

It's similar to what we're already doing on createOffer, but I'll add a comment to both.
Comment on attachment 8634935 [details]
MozReview Request: Bug 1098015 - make createAnswer tolerate (no-op) options argument.

Bug 1098015 - make createAnswer tolerate (no-op) options argument.
Attachment #8634935 - Flags: review?(docfaraday)
Attachment #8634935 - Flags: review?(bzbarsky)
Attachment #8634935 - Flags: review+
Bug 1098015 - modify a test to make sure createAnswer({}) works.
Attachment #8634976 - Flags: review?(docfaraday)
Attachment #8634935 - Flags: review?(docfaraday)
Attachment #8634935 - Flags: review?(bzbarsky)
Attachment #8634935 - Flags: review+
Comment on attachment 8634976 [details]
MozReview Request: Bug 1098015 - modify a test to make sure createAnswer({}) works. r=bwc

https://reviewboard.mozilla.org/r/13493/#review12181

::: dom/media/tests/mochitest/test_peerConnection_promiseSendOnly.html:41
(Diff revision 1)
> -    .then(() => pc1.createOffer())
> +    .then(() => pc1.createOffer({}))
>      .then(offer => pc1.setLocalDescription(offer))
>      .then(() => pc2.setRemoteDescription(pc1.localDescription))
> -    .then(() => pc2.createAnswer())
> +    .then(() => pc2.createAnswer({}))

Couldn't hurt to have a comment here explaining why you're doing this.
Attachment #8634976 - Flags: review?(docfaraday) → review+
Attachment #8634935 - Flags: review?(docfaraday)
Attachment #8634935 - Flags: review?(bzbarsky)
Attachment #8634935 - Flags: review+
Comment on attachment 8634935 [details]
MozReview Request: Bug 1098015 - make createAnswer tolerate (no-op) options argument.

Bug 1098015 - make createAnswer tolerate (no-op) options argument.
Attachment #8634976 - Attachment description: MozReview Request: Bug 1098015 - modify a test to make sure createAnswer({}) works. → MozReview Request: Bug 1098015 - modify a test to make sure createAnswer({}) works. r=bwc
Attachment #8634976 - Flags: review+ → review?(docfaraday)
Comment on attachment 8634976 [details]
MozReview Request: Bug 1098015 - modify a test to make sure createAnswer({}) works. r=bwc

Bug 1098015 - modify a test to make sure createAnswer({}) works. r=bwc
Attachment #8634935 - Flags: review?(docfaraday)
Attachment #8634935 - Flags: review?(bzbarsky)
Attachment #8634935 - Flags: review+
Attachment #8634976 - Flags: review?(docfaraday) → review+
https://hg.mozilla.org/mozilla-central/rev/382c04062988
https://hg.mozilla.org/mozilla-central/rev/7d8c8896957f
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
Summary: Need to support RTCAnswerOptions in CreateAnswer (pending standardization) → Need to not fail on seeing RTCAnswerOptions in CreateAnswer
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: