Skip to content

Commit

Permalink
Use capturing mediastreamtrack settings for audio feature detection (#…
Browse files Browse the repository at this point in the history
…1318)

* Use capturing mediastreamtrack settings for audio feature detection

* Create soft-clouds-nail.md
  • Loading branch information
lukasIO authored Nov 19, 2024
1 parent f04272c commit 7b037b8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/soft-clouds-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-client": patch
---

Use capturing mediastreamtrack settings for audio feature detection
8 changes: 8 additions & 0 deletions src/room/track/LocalTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ export default abstract class LocalTrack<
return this.processor?.processedTrack ?? this._mediaStreamTrack;
}

/**
* @internal
* returns mediaStreamTrack settings of the capturing mediastreamtrack source - ignoring processors
*/
getSourceTrackSettings() {
return this._mediaStreamTrack.getSettings();
}

private async setMediaStreamTrack(newTrack: MediaStreamTrack, force?: boolean) {
if (newTrack === this._mediaStreamTrack && !force) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/room/track/LocalTrackPublication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default class LocalTrackPublication extends TrackPublication {

getTrackFeatures() {
if (this.track instanceof LocalAudioTrack) {
const settings = this.track!.mediaStreamTrack.getSettings();
const settings = this.track!.getSourceTrackSettings();
const features: Set<AudioTrackFeature> = new Set();
if (settings.autoGainControl) {
features.add(AudioTrackFeature.TF_AUTO_GAIN_CONTROL);
Expand Down

0 comments on commit 7b037b8

Please sign in to comment.