SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -fPIC -Wall -Werror -std=c++14")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS} -fPIC -Wall -Werror")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
IF("${ARCH}" STREQUAL "arm")
#include <string.h>
#include <assert.h>
#include <algorithm>
+#include <vector>
#ifdef ENABLE_DPM
#include <dpm/restriction.h>
pClient->__mpListener->onStream(pClient, length);
}
-#ifndef DISABLE_MOBILE_BACK_COMP
static void __dummy_write(pa_stream* s, size_t length) {
- char* dummy = new char[length];
- memset(dummy, 0, length);
- pa_stream_write(s, dummy, length, NULL, 0LL, PA_SEEK_RELATIVE);
- delete [] dummy;
+ pa_stream_write(s, std::vector<char>(length).data(), length, NULL, 0LL, PA_SEEK_RELATIVE);
}
-#endif
void CPulseAudioClient::__streamPlaybackCb(pa_stream* s, size_t length, void* user_data) {
assert(s);
uint32_t prebuf = attr->prebuf;
// Compensate amount of prebuf in first stream callback when audio-io use prebuf(-1)
// Because a stream will never start when an application wrote less than prebuf at first
- if (length < prebuf) {
- char* dummy = new char[prebuf - length];
- memset(dummy, 0, prebuf - length);
- pa_stream_write(__mpStream, dummy, prebuf - length, NULL, 0LL, PA_SEEK_RELATIVE);
- delete [] dummy;
- }
+ if (length < prebuf)
+ __dummy_write(__mpStream, prebuf - length);
+
__mIsFirstStream = false;
AUDIO_IO_LOGW("FIRST STREAM CALLBACK : length[%zu], prebuf[%d], dummy[%zu]",
length, prebuf, (length < prebuf) ? prebuf - length : 0);
pa_threaded_mainloop_unlock(__mpMainloop);
throw;
}
-}
\ No newline at end of file
+}