windows音频采集流程图
2022-05-25 16:35:40 0 举报
webrtc windwos音频采集流程图
作者其他创作
大纲/内容
False
waitMulitipleObjects_hShutdownCaptureEvent_hSetCaptureVolumeEven
keepRecording && !_bLoopingCapture
Set(_hCaptureNeedRestartEvent)
createSyncBuffer
True
_ptrClientLoop->Stop();_clientLoopIsStarted = true;
++_captureTimeoutTimes;
Lock(_critSect)
Call onAudioEventChanged
AudioDeviceBuffersetCurrentMicLevel
ResetFailed
false
waitMulitipleObjects_hShutdownCaptureWatchdogEvent_hCaptureNeedRestartEvent
StopCapturingStream
Successed
_ptrAudioBuffer->SetTypingStatus
CheckDeviceValidity
CreateCaptureWatchdogThread
_ptrDeviceIn_microphoneIsInitialized
_ptrLoopClient == NULL || _ptrClientLoop == NULL
CaptureThread
CopyDataTo_syncBufferL
SetEvent(_hCaptureStartedEvent)
_ptrAudioBuffer->SetLoopedBuffer
true
Unlock(_critSect)
Lock(_volumeMutex)
_loopBlockSize(10ms数据)
setRecordThreadHighestPriority
_ptrClientLoop->Stop();_clientLoopIsStarted = false;
hr=_ptrLoopClient->GetBuffer
recording=true_looping=true
ResetRecording
Exit
WAIT_TIMEOUT
delete[] _syncBufferL; delete[] syncBuffer;
newMicLevel = _newMicLevel
SAFE_RELEASE(_ptrClientIn); SAFE_RELEASE(_ptrCaptureClient); SAFE_RELEASE(_ptrClientLoop); SAFE_RELEASE(_ptrLoopClient);_recording = false _clientLoopIsStarted = false; _loopIsInitialized = false; _looping = false;
_hShutdownCaptureEvent
waitMulitipleObjects(500)_hShutdownCaptureEvent_hCaptureTimer
_ptrLoopClient->ReleaseBuffer
Unlock(_volumeMutex)
结束
bAbnormalExit||keepRecording
_ptrAudioBuffer->DeliverRecordedData()
_captureResetTimes >= 5
releaseBuffer
StartCapturingStream
_ptrAudioBuffer->DeliverLoopedData()
_ptrAudioBuffer->SetRecordTimeStamp
_ptrAudioBuffer->SetLoopTimeStamp
syncBufIndex >= _recBlockSize
_ptrClientIn->GetBufferSize() syncBufferSize = 2 * (bufferLength * _recAudioFrameSize); syncBuffer = new BYTE[syncBufferSize]
_ptrClientLoop->GetBufferSize() _syncBufferSizeL = 2 * (bufferLength * _loopAudioFrameSize); _syncBufferL= new BYTE[_syncBufferSizeL]
create _syncBuufferL
GetMasterVolumeLevelScalar
CreateGetCaptureVolumeThread
StartRecording
_loopSamples += framesAvailable;syncBufIndexL += framesAvailable;
SetMasterVolumeLevelScalar
AudioEventkDoCaptureThreadBufferEmptyFailed
Set _hSetCaptureVolumeEvent
hr=_ptrCaptureClient->GetBuffer
_ptrAudioBuffer->SetRecordedBuffer
Wait _hCaptureWatchdogThreadStartedEvent
SetCaptureVolumeThread
InitCaptureThreadPriority
_hSetCaptureVolumeEvent
Release
_ptrClientLoop->Start();_clientLoopIsStarted = true;
_loopIsInitialized
_ptrCaptureClient == NULL || __ptrClientIn == NULL
CreateSetCaptureVolumeThread
RevertCaptureThreadPriority
default_hShutdownCaptureWatchdogEvent
Failed
AUDCLNT_E_BUFFER_ERRORAUDCLNT_E_BUFFER_OPERATION_PENDING
onAudioEventChanged()AdmRecordEventReset
AGC
_ptrClientIn->Start();
CloseAudioStream release resources
GetCaptureVolumeThread
_hCaptureNeedRestartEvent
FAILD(hr)
CaptureWatchDogThread
AUDCLNT_S_BUFFER_EMPTY
SetWaitableTimer_hCaptureTimer
AGC()
_ptrAudioBuffer->SetVQEData
ResetSuccessed
_hCaptureTimer
startLoopCapturingStream
FAILED(hr)
syncBufIndexL >= _loopBlockSize
_hShutdownCaptureEventdefault
keepRecording && _ptrLoopClient && _looping
bAbnormalExit = true
_captureResetTimes = 0; _captureTimeoutTimes = 0;
采集数据
loopMute = !_looping_ptrAudioBuffer->SetLoopedStatus
CreateCaptureThread
FAILED
AUDCLNT_E_DEVICE_INVALIDATED
FALSE
Wait _hCaptureStartedEvent
keepRecording
_bLoopingCapture(shareAudio)
Set _hCaptureWatchdogThreadStartedEvent
default
store remaining data whichwas not able to deliver as 10ms segment
AUDCLNT_E_SERVICE_NOT_RUNNING
AUDCLNT_S_BUFFER_EMPTYframesAvailable == 0
FAlse
bufferErrorCount++
// Loopback capture loop
CopyDataTo_syncBuffer
waitObjects_hShutdownCaptureEvent
bufferErrorCount > 100
0 条评论
下一页