Skip to content

Commit

Permalink
RSDK-1848: Don’t use video constraints for microphone (#4435)
Browse files Browse the repository at this point in the history
  • Loading branch information
jckras authored Oct 10, 2024
1 parent b421961 commit 53e02ca
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions components/audioinput/microphone/microphone.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,17 @@ func newMicrophoneSource(conf *Config, logger logging.Logger) (audioinput.AudioS

debug := conf.Debug

constraints := mediadevices.MediaTrackConstraints{}
audioConstraints := constraints.MediaConstraints.AudioConstraints
audioOption := func(trackConstraints *mediadevices.MediaTrackConstraints) {
trackConstraints.AudioConstraints = audioConstraints
}
audioStreamConstraints := mediadevices.MediaStreamConstraints{
Audio: audioOption,
}

if conf.Path != "" {
return tryMicrophoneOpen(conf.Path, gostream.DefaultConstraints, logger)
return tryMicrophoneOpen(conf.Path, audioStreamConstraints, logger)
}

var pattern *regexp.Regexp
Expand Down Expand Up @@ -91,7 +100,7 @@ func newMicrophoneSource(conf *Config, logger logging.Logger) (audioinput.AudioS
}
continue
}
s, err := tryMicrophoneOpen(label, gostream.DefaultConstraints, logger)
s, err := tryMicrophoneOpen(label, audioStreamConstraints, logger)
if err == nil {
if debug {
logger.Debug("\t USING")
Expand Down

0 comments on commit 53e02ca

Please sign in to comment.