Avoid treating capture timing as microphone failure
This commit is contained in:
committed by
Brandon McGinty
parent
5db174e92f
commit
64d0ef6f0f
@@ -674,8 +674,9 @@ func (s *Stream) sourceRoutine(inputDevice *string) {
|
||||
// available. PipeWire and PulseAudio do not guarantee that a Go
|
||||
// ticker fires precisely on a capture-frame boundary.
|
||||
hasMicInput := false
|
||||
available := s.deviceSource.CapturedSamples()
|
||||
var buff []byte
|
||||
if s.deviceSource.CapturedSamples() >= uint32(frameSize) {
|
||||
if available >= uint32(frameSize) {
|
||||
buff = s.deviceSource.CaptureSamples(uint32(frameSize))
|
||||
}
|
||||
if len(buff) == sampleCount*2 {
|
||||
@@ -700,7 +701,7 @@ func (s *Stream) sourceRoutine(inputDevice *string) {
|
||||
} else {
|
||||
s.processStereoSamples(int16Buffer, frameSize)
|
||||
}
|
||||
} else if !micFailed {
|
||||
} else if available >= uint32(frameSize) && !micFailed {
|
||||
micFailed = true
|
||||
if s.errorFunc != nil {
|
||||
s.errorFunc(ErrMic)
|
||||
|
||||
Reference in New Issue
Block a user