From: Seungbae Shin Date: Fri, 19 Oct 2018 11:00:28 +0000 (+0900) Subject: Revise dummy stream write function using anonymous vector objects X-Git-Tag: accepted/tizen/unified/20200415.121418^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fapi%2Faudio-io.git;a=commitdiff_plain;h=487df789c11ec24e353a91de2eaaf118abdf214a Revise dummy stream write function using anonymous vector objects In addition, remove explicit c++ mode flag [Version] 0.5.27 [Issue Type] Revise Change-Id: I81e4481e9030d1dda006947e9a36884ba0f6304a --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 3026dc5..02254b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ ENDFOREACH(flag) 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") diff --git a/packaging/capi-media-audio-io.spec b/packaging/capi-media-audio-io.spec index 2fef947..f995fa6 100644 --- a/packaging/capi-media-audio-io.spec +++ b/packaging/capi-media-audio-io.spec @@ -1,6 +1,6 @@ Name: capi-media-audio-io Summary: An Audio Input & Audio Output library in Tizen Native API -Version: 0.5.26 +Version: 0.5.27 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/cpp/CPulseAudioClient.cpp b/src/cpp/CPulseAudioClient.cpp index 5c434cf..9b05a55 100644 --- a/src/cpp/CPulseAudioClient.cpp +++ b/src/cpp/CPulseAudioClient.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #ifdef ENABLE_DPM #include @@ -160,14 +161,9 @@ void CPulseAudioClient::__streamCaptureCb(pa_stream* s, size_t length, void* use 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(length).data(), length, NULL, 0LL, PA_SEEK_RELATIVE); } -#endif void CPulseAudioClient::__streamPlaybackCb(pa_stream* s, size_t length, void* user_data) { assert(s); @@ -689,12 +685,9 @@ int CPulseAudioClient::write(const void* data, size_t length) { 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); @@ -1039,4 +1032,4 @@ void CPulseAudioClient::applyRecordVolume(double volume) { pa_threaded_mainloop_unlock(__mpMainloop); throw; } -} \ No newline at end of file +}