-
Notifications
You must be signed in to change notification settings - Fork 472
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
Support sending and receiving redundant audio data to help reduce the effects of packet loss on audio quality. #2745
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some flyby nits, will continue taking a look later!
@@ -156,6 +156,10 @@ <h5 class="modal-title" id="additional-options-modal-label">Additional Options</ | |||
<label for="echo-reduction-capability" class="form-check-label">Use Echo Reduction (new meetings | |||
only)</label> | |||
</div> | |||
<div class="form-check" id="disable-audio-redundancy-checkbox" style="text-align: left; display: block;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is disabling RED meant to be common? Do we need demo coverage of it disabled? Asking because having it in the demo kinda encourages builders to disable it. We don't want a builder to disable RED just because one end-user had a disconnection or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about common but it is something a builder can do. I did put in a note in the readme that we encourage this be turned on and a builder can turn this off only if their customers have very strict bandwidth limitations.
What do you mean by demo coverage? You mean adding it to the canary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is probably adding it to demo for now as long as it is not the default behavior in case we need to reproduce case w/ or w/o it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: trung, this is the default behavior. Understandable if we want to reproduce issues, though i wonder how frequent that would be where we need to build in UX to disable it (as opposed to just hacking in the change manually). Always a tough call with the kitchen sink demo lol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we have 2 separate needs: one kitchen sink with every knobs to test and one streamline for demo. Whenever we have time we would need to separate these out :D
@@ -1635,6 +1680,7 @@ export class DemoMeetingApp | |||
|
|||
metricsDidReceive(clientMetricReport: ClientMetricReport): void { | |||
this.logAudioStreamPPS(clientMetricReport); | |||
this.logRedRecoveryPercent(clientMetricReport); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Would be nice to encapsulate this and logAudioStreamPps
in a function/class outside of this monolithic file.
test/videouplinkbandwidthpolicy/NScaleVideoUplinkBandwidthPolicy.test.ts
Outdated
Show resolved
Hide resolved
276f101
to
0f6795c
Compare
depending on the amount of packet loss detected. The SDK will automatically stop sending redundant data if it hasn't | ||
detected any packet loss for 5 minutes. | ||
|
||
This feature is not supported on Firefox at the moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it works for Chrome, Safari, and iOS and Android?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Basically chromium and webkit browsers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically we also support Opera. So maybe we should be more specific. Also will all browser version works or only a certain version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some extra information. In the latest push, I also added fallback to peer connection without RED if we determine that we cannot enable it. Tested this on an older version of safari on saucelabs and was able to send/receive audio/video fine.
meetingSession.audioVideo.setContentAudioProfile(AudioProfile.fullbandSpeechMono(false)); | ||
``` | ||
|
||
While there is an option to disable the feature, we recommend keeping it enabled for improved audio quality. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does CSP have to have worker directive for this to work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is already there:
'worker-src': "'self' blob:", |
We have tested this by deploying the demo to the SDK dev account and did not see any csp related issues. Is there any other place that needs update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also added a line in the new README section just to call it out that blob is needed. Also verified that the policy we recommend in https://aws.github.io/amazon-chime-sdk-js/modules/contentsecurity_policy.html already has this.
}) | ||
); | ||
this.logger.info(`[AudioRed] Redundant audio worker URL ${this.audioRedWorkerURL}`); | ||
this.audioRedWorker = new Worker(this.audioRedWorkerURL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this fail? Should we catch error here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it can theoretically fail. Lemme force the audioRedWorker
to null
and see behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this could fail for reasons mentioned in https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker
Updated to account for failure and restart connection with redundancy disabled so that user connects to the meeting. Tested this out by removing blob
from csp worker-src and connecting to a meeting. Tested both audio and video sending and receiving. Also added unit tests.
5f0de01
to
a791d39
Compare
a791d39
to
70c34b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
… effects of packet loss on audio quality.
70c34b4
to
6b5c8d6
Compare
Issue #:
Description of changes:
Support sending and receiving redundant audio data to help reduce the effects of packet loss on audio quality. This will be enabled by default on chromium and webkit based browsers. Firefox unfortunately does not support this feature due to browser API limitations. README also provides instructions to disable feature if needed.
Testing:
Can these tested using a demo application? Please provide reproducible step-by-step instructions.
Yes but you will also need a network link conditioner (NLC) on macOS to trigger redundant audio as it is sent only once packet loss is detected and is above a certain threshold. You can set NLC to 30% in either direction and speak. Subjectively speaking, there should be no cut-outs in audio or robotic voice. Note that redundant audio packets are only sent for speech/music. If there is no voice activity detected, no redundant packets will be sent.
Checklist:
Have you successfully run
npm run build:release
locally?Y
Do you add, modify, or delete public API definitions? If yes, has that been reviewed and approved?
Yes this has been reviewed internally. Please reach out for the API doc.
Do you change the wire protocol, e.g. the request method? If yes, has that been reviewed and approved?
N
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.