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

fix: audio track constraints when krisp is enabled #3374

Merged
merged 6 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: remove redundant method
  • Loading branch information
KaustubhKumar05 committed Nov 22, 2024
commit bef3fb9c0d651b166991d3269a946da62b5ff0e8
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 59,6 @@ export class HMSAudioTrackSettingsBuilder {
return this;
}

updateConstraints(overrides: Partial<Array<MediaTrackConstraintSet>>) {
const constraintsMap = new Map<string, MediaTrackConstraintSet>();
this._advanced.forEach(constraint => {
const key = Object.keys(constraint)[0];
constraintsMap.set(key, constraint);
});

Object.entries(overrides).forEach(([key, value]) => {
if (value !== undefined) {
// @ts-ignore
constraintsMap.set(key, { [key]: { exact: value['exact'] } });
}
});

this._advanced = Array.from(constraintsMap.values());
return this;
}

advanced(advanced: Array<MediaTrackConstraintSet>) {
this._advanced = advanced;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 91,20 @@ export class HMSAudioPluginsManager {
.codec(settings.codec)
.maxBitrate(settings.maxBitrate)
.deviceId(settings.deviceId!)
.updateConstraints([{ autoGainControl: { exact: false } }, { noiseSuppression: { exact: false } }])
.advanced([
// @ts-ignore
{ googEchoCancellation: { exact: true } },
// @ts-ignore
{ googExperimentalEchoCancellation: { exact: true } },
// @ts-ignore
{ autoGainControl: { exact: false } },
// @ts-ignore
{ noiseSuppression: { exact: false } },
// @ts-ignore
{ googHighpassFilter: { exact: true } },
// @ts-ignore
{ googAudioMirroring: { exact: true } },
])
.audioMode(settings.audioMode)
.build();
await this.hmsTrack.setSettings(newAudioTrackSettings);
Expand Down Expand Up @@ -180,7 193,20 @@ export class HMSAudioPluginsManager {
.codec(settings.codec)
.maxBitrate(settings.maxBitrate)
.deviceId(settings.deviceId!)
.updateConstraints([{ autoGainControl: { exact: true } }, { noiseSuppression: { exact: true } }])
.advanced([
// @ts-ignore
{ googEchoCancellation: { exact: true } },
// @ts-ignore
{ googExperimentalEchoCancellation: { exact: true } },
// @ts-ignore
{ autoGainControl: { exact: true } },
// @ts-ignore
{ noiseSuppression: { exact: true } },
// @ts-ignore
{ googHighpassFilter: { exact: true } },
// @ts-ignore
{ googAudioMirroring: { exact: true } },
])
.audioMode(settings.audioMode)
.build();
await this.hmsTrack.setSettings(newAudioTrackSettings);
Expand Down