Restore ability to transmit in stereo.
This commit is contained in:
1 parent
c1722c2491
commit
abf6729ce9
6 files changed
+55
-27
No files matched your search
@@ -1064,21 +1064,10 @@ func (s *Stream) sourceRoutine(inputDevice *string, stop chan bool, done chan st
|
||||
recorder.RecordAudioFrame(recorderOutgoingSource, outputBuffer, true)
|
||||
}
|
||||
} else if hasMicInput {
|
||||
// Send mic when no file is playing. If the microphone is
|
||||
// stereo, downmix to mono since Mumble voice transmission
|
||||
// uses mono Opus encoding.
|
||||
outBuf := int16Buffer
|
||||
if s.sourceChannels == 2 {
|
||||
monoBuf := make([]int16, frameSize)
|
||||
for i := 0; i < frameSize; i++ {
|
||||
// Average left and right channels
|
||||
monoBuf[i] = int16((int32(int16Buffer[i*2]) + int32(int16Buffer[i*2+1])) / 2)
|
||||
}
|
||||
outBuf = monoBuf
|
||||
}
|
||||
outgoing <- gumble.AudioBuffer(outBuf)
|
||||
// Preserve the capture device's channel layout for encoding.
|
||||
outgoing <- gumble.AudioBuffer(int16Buffer)
|
||||
if recorder := s.getRecorder(); recorder != nil {
|
||||
recorder.RecordAudioFrame(recorderOutgoingSource, outBuf, false)
|
||||
recorder.RecordAudioFrame(recorderOutgoingSource, int16Buffer, s.sourceChannels == 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user