Ensure NONTHREADSAFE_PSUEDOSTACK is never used

This commit is contained in:
Kae 2023-07-14 21:44:13 +10:00
parent 8ff5d9f82b
commit 52ba6fa7f7
3 changed files with 11 additions and 4 deletions

View File

@ -437,7 +437,7 @@ SET (STAR_EXT_LIBS ${STAR_EXT_LIBS}
${FREETYPE_LIBRARY}
${PNG_LIBRARY}
${ZLIB_LIBRARY}
"extern/opus/opus"
opus
)
IF (STAR_BUILD_GUI)

View File

@ -2,10 +2,17 @@ SET (OPUS_INSTALL_PKG_CONFIG_MODULE OFF)
SET (OPUS_INSTALL_CMAKE_CONFIG_MODULE OFF)
SET (OPUS_X86_MAY_HAVE_AVX OFF)
SET (OPUS_X86_MAY_HAVE_SSE4_1 OFF)
SET (OPUS_STACK_PROTECTOR OFF)
SET (OPUS_ENABLE_FLOAT_API ON)
SET (OPUS_STACK_PROTECTOR OFF)
SET (OPUS_NONTHREADSAFE_PSEUDOSTACK OFF)
SET (OPUS_USE_ALLOCA ON)
ADD_SUBDIRECTORY (opus)
IF (OPUS_NONTHREADSAFE_PSEUDOSTACK)
MESSAGE (FATAL_ERROR "Opus should not be using NONTHREADSAFE_PSEUDOSTACK")
ENDIF ()
INCLUDE_DIRECTORIES (
${STAR_EXTERN_INCLUDES}
opus/include

View File

@ -250,9 +250,9 @@ void Voice::readAudioData(uint8_t* stream, int len) {
ByteArray encoded(VOICE_MAX_PACKET_SIZE, 0);
size_t frameSamples = VOICE_FRAME_SIZE * (size_t)m_deviceChannels;
std::vector<opus_int16> samples;
samples.reserve(frameSamples);
while (m_capturedChunksFrames >= VOICE_FRAME_SIZE) {
std::vector<opus_int16> samples;
samples.reserve(frameSamples);
size_t samplesLeft = frameSamples;
while (samplesLeft && !m_capturedChunks.empty()) {
auto& front = m_capturedChunks.front();