Closed Bug 1425618 Opened 6 years ago Closed 6 years ago

{offerToReceiveAudio: false} and {offerToReceiveVideo: false} stopped working.

Categories

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

59 Branch
Unspecified
All
defect

Tracking

()

VERIFIED FIXED
mozilla60
Tracking Status
firefox-esr52 --- unaffected
firefox57 --- unaffected
firefox58 --- unaffected
firefox59 + verified
firefox60 + verified

People

(Reporter: jib, Assigned: bwc)

References

Details

(Keywords: dev-doc-complete, regression)

Attachments

(2 files)

A recent spec change [1] let's us support this legacy case after all. 

We should get this in to 59 to avoid regressing support. 

[1] https://github.com/w3c/webrtc-pc/pull/1693
[2] https://github.com/webrtc/adapter/pull/729/files
Assignee: nobody → docfaraday
Rank: 11
Priority: -- → P2
Tracking for 59, as long as we can land the fix(es) by Jan 10 it should be ok for 59.
Comment on attachment 8937816 [details]
Bug 1425618 - Part 1: Test-cases for offerToReceiveX: false.

https://reviewboard.mozilla.org/r/208504/#review214692

::: dom/media/tests/mochitest/test_peerConnection_transceivers.html:369
(Diff revision 1)
> +    for (let kind of kinds) {
> +      if (kind == "audio") {
> +        options.offerToReceiveAudio = false;
> +      } else if (kind == "video") {
> +        options.offerToReceiveVideo = false;
> +      }
> +    }

Idea: Only because you have this pattern twice in this function, we could do:

    let keys = {audio: "offerToReceiveAudio", video: "offerToReceiveVideo"};

    // Test offerToReceive: true
    for (let kind of kinds) {
      options[keys[kind]] = true;
    }

    // Test offerToReceive: false
    for (let kind of kinds) {
      options[keys[kind]] = false;
    }

Seems safer against typos.
Attachment #8937816 - Flags: review?(jib) → review+
Comment on attachment 8937817 [details]
Bug 1425618 - Part 2: Make offerToReceiveX: false unset the send bit on transceivers.

https://reviewboard.mozilla.org/r/208506/#review214694

::: dom/media/PeerConnection.js:836
(Diff revision 1)
> -    if (options.offerToReceiveAudio === false) {
> -      this.logWarning("offerToReceiveAudio: false is ignored now. If you " +
> -                      "want to disallow a recv track, use " +
> -                      "RTCRtpTransceiver.direction");
> +    this._transceivers
> +      .filter(transceiver => {
> +        return (options.offerToReceiveVideo === false &&
> +                transceiver.receiver.track.kind == "video") ||
> +               (options.offerToReceiveAudio === false &&
> +                transceiver.receiver.track.kind == "audio");
> +      })
> +      .forEach(transceiver => {

Nit: For simple x => expression transforms, it seems more readable to omit return and {}:

    this._transceivers
      .filter(transceiver =>
        (options.offerToReceiveVideo === false &&
         transceiver.receiver.track.kind == "video") ||
        (options.offerToReceiveAudio === false &&
         transceiver.receiver.track.kind == "audio"))
      .forEach(transceiver => {

or with destructuring:

    this._transceivers
      .filter(({receiver: {track: kind}}) =>
        (options.offerToReceiveVideo === false && kind == "video") ||
        (options.offerToReceiveAudio === false && kind == "audio"))
      .forEach(transceiver => {
Attachment #8937817 - Flags: review?(jib) → review+
Comment on attachment 8937817 [details]
Bug 1425618 - Part 2: Make offerToReceiveX: false unset the send bit on transceivers.

https://reviewboard.mozilla.org/r/208506/#review214694

> Nit: For simple x => expression transforms, it seems more readable to omit return and {}:
> 
>     this._transceivers
>       .filter(transceiver =>
>         (options.offerToReceiveVideo === false &&
>          transceiver.receiver.track.kind == "video") ||
>         (options.offerToReceiveAudio === false &&
>          transceiver.receiver.track.kind == "audio"))
>       .forEach(transceiver => {
> 
> or with destructuring:
> 
>     this._transceivers
>       .filter(({receiver: {track: kind}}) =>
>         (options.offerToReceiveVideo === false && kind == "video") ||
>         (options.offerToReceiveAudio === false && kind == "audio"))
>       .forEach(transceiver => {

or

    this._transceivers
      .filter(({receiver: {track: kind}}) =>
        (options[{audio: "offerToReceiveAudio", video: "offerToReceiveVideo"}[kind]] === false))
      .forEach(transceiver => {
Comment on attachment 8937817 [details]
Bug 1425618 - Part 2: Make offerToReceiveX: false unset the send bit on transceivers.

https://reviewboard.mozilla.org/r/208506/#review214694

> or
> 
>     this._transceivers
>       .filter(({receiver: {track: kind}}) =>
>         (options[{audio: "offerToReceiveAudio", video: "offerToReceiveVideo"}[kind]] === false))
>       .forEach(transceiver => {

Personally, I have a harder time reading those, but I guess I'm not accustomed to destructuring yet.
Comment on attachment 8937816 [details]
Bug 1425618 - Part 1: Test-cases for offerToReceiveX: false.

https://reviewboard.mozilla.org/r/208504/#review214692

> Idea: Only because you have this pattern twice in this function, we could do:
> 
>     let keys = {audio: "offerToReceiveAudio", video: "offerToReceiveVideo"};
> 
>     // Test offerToReceive: true
>     for (let kind of kinds) {
>       options[keys[kind]] = true;
>     }
> 
>     // Test offerToReceive: false
>     for (let kind of kinds) {
>       options[keys[kind]] = false;
>     }
> 
> Seems safer against typos.

I've tweaked this to be better.
Pushed by bcampen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/50619d5809b4
Part 1: Test-cases for offerToReceiveX: false. r=jib
https://hg.mozilla.org/integration/autoland/rev/403655330301
Part 2: Make offerToReceiveX: false unset the send bit on transceivers. r=jib
https://hg.mozilla.org/mozilla-central/rev/50619d5809b4
https://hg.mozilla.org/mozilla-central/rev/403655330301
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Depends on: 1433953
According to this https://bugzilla.mozilla.org/show_bug.cgi?id=1433953#c6 we haven't fixed this properly.

Fiddle to repro: https://jsfiddle.net/jib1/1h8mr8fw/
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
I think I know what is going on here...
Depends on: 1435013
Tracking for 59, so that we make sure to follow up with uplift to beta if this is fixed & verified in 60.
Flags: qe-verify+
Target Milestone: mozilla59 → ---
The fix for the problem landed over in bug 1435013, because mozreview is a pain for re-opened bugs. Sorry for not updating the status properly here.
Status: REOPENED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
Verified as fixed with Firefox 59 beta 10 and latest Nightly 60.0a1 under Win 10 64-bit, Ubuntu 14.04032-bit and Mac OS X 10.13.
Status: RESOLVED → VERIFIED
Flags: qe-verify+
Since this was uplifted to 59, there's nothing to report in Firefox 60 for developers -- however, I did add these properties to the docs for createOffer()'s options, since they were missing.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: