Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VBLOCKS-3054 Fix echo and default stream not switching #270

Merged
merged 4 commits into from
May 28, 2024

Conversation

charliesantos
Copy link
Collaborator

@charliesantos charliesantos commented May 28, 2024

Contributing to Twilio

All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.

  • I acknowledge that all my contributions will be made under the project's license.

Pull Request Details

Please see changelog.

Burndown

Before review

  • Updated CHANGELOG.md if necessary
  • Added unit tests if necessary
  • Updated affected documentation
  • Verified locally with npm test
  • Manually sanity tested running locally
  • Ready for review

Before merge

  • Got one or more +1s
  • Squashed erroneous commits if necessary
  • Re-tested if necessary

Comment on lines 837 to 838
// this.inputDevice is not null if audio.setInputDevice() was explicitly called
(this.inputDevice && this.inputDevice.deviceId === defaultId) ||
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

I would prefer to have these complex conditions broken out like so:

const defaultId = 'default';
const isInputDeviceSet = this.inputDevice && this.inputDevice.deviceId === defaultId;
const isInputDeviceNotSet = this._defaultInputDeviceStream && this.availableInputDevices.get(defaultId);

It might not eliminate the need for the comments entirely, but it helps explain things and make the code more readable IMO.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. I'll update it. Though I would rename the 2nd one to isDefaultDeviceSet.

@@ -1976,6 +1976,23 @@ describe('PeerConnection', () => {
}).then(done).catch(done);
});

it('Should call setSinkId with \'\' if empty string is first device', done => {
output.audio.setSinkId.returns(Promise.resolve());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, this will cause the function to return the same promise every time. I don't see it affecting anything in this case, but wanted to note it.

// If this.inputDevice is null, and default stream is not null, it means
// this.inputDevice is not null if audio.setInputDevice() was explicitly called
const isInputDeviceSet = this.inputDevice && this.inputDevice.deviceId === defaultId;
// If this.inputDevice is null, and default stream is not null, it means
// the user is using the default stream and did not explicitly call audio.setInputDevice()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// the user is using the default stream and did not explicitly call audio.setInputDevice()
// the user is using the default stream and did not explicitly call audio.setInputDevice()

Formatting nit.

@charliesantos charliesantos merged commit 4445d39 into master May 28, 2024
0 of 7 checks passed
@charliesantos charliesantos deleted the VBLOCKS-3054 branch May 28, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants