Remove VLA from audio device code.

Those trigger new warnings when importing the Chromium roll.

Follow-up to https://webrtc-review.googlesource.com/c/src/+/363740.

Bug: None
Change-Id: If32d8981bc0f73d697848fb27a8fd80384a7837e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/363861
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43085}
This commit is contained in:
Mirko Bonadei 2024-09-26 11:16:31 +00:00 committed by WebRTC LUCI CQ
parent 28d1a9a4de
commit b28d0698a2

View File

@ -15,6 +15,7 @@
#include <sys/sysctl.h> // sysctlbyname()
#include <memory>
#include <vector>
#include "modules/audio_device/audio_device_config.h"
#include "modules/third_party/portaudio/pa_ringbuffer.h"
@ -2428,7 +2429,7 @@ bool AudioDeviceMac::CaptureWorkerThread() {
OSStatus err = noErr;
UInt32 noRecSamples =
ENGINE_REC_BUF_SIZE_IN_SAMPLES * _inDesiredFormat.mChannelsPerFrame;
SInt16 recordBuffer[noRecSamples];
std::vector<SInt16> recordBuffer(noRecSamples);
UInt32 size = ENGINE_REC_BUF_SIZE_IN_SAMPLES;
AudioBufferList engineBuffer;
@ -2436,7 +2437,7 @@ bool AudioDeviceMac::CaptureWorkerThread() {
engineBuffer.mBuffers->mNumberChannels = _inDesiredFormat.mChannelsPerFrame;
engineBuffer.mBuffers->mDataByteSize =
_inDesiredFormat.mBytesPerPacket * noRecSamples;
engineBuffer.mBuffers->mData = recordBuffer;
engineBuffer.mBuffers->mData = recordBuffer.data();
err = AudioConverterFillComplexBuffer(_captureConverter, inConverterProc,
this, &size, &engineBuffer, NULL);
@ -2471,7 +2472,8 @@ bool AudioDeviceMac::CaptureWorkerThread() {
// store the recorded buffer (no action will be taken if the
// #recorded samples is not a full buffer)
_ptrAudioBuffer->SetRecordedBuffer((int8_t*)&recordBuffer, (uint32_t)size);
_ptrAudioBuffer->SetRecordedBuffer((int8_t*)recordBuffer.data(),
(uint32_t)size);
_ptrAudioBuffer->SetVQEData(msecOnPlaySide, msecOnRecordSide);
_ptrAudioBuffer->SetTypingStatus(KeyPressed());