From 0f68ce394de8db3a241acf465f86f659f38f9738 Mon Sep 17 00:00:00 2001 From: Seungbae Shin Date: Fri, 24 Feb 2017 20:00:58 +0900 Subject: [PATCH] Write dummy write if stream is not written at first callback during prepare situtaion [Version] 0.3.68 [Profile] Common [Issue Type] Bug Change-Id: I3118c91af39d6022db9d4fb889a1a437a47dc605 --- packaging/capi-media-audio-io.spec | 2 +- src/cpp/CPulseAudioClient.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packaging/capi-media-audio-io.spec b/packaging/capi-media-audio-io.spec index 4525359..e1c78c7 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.3.67 +Version: 0.3.68 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/cpp/CPulseAudioClient.cpp b/src/cpp/CPulseAudioClient.cpp index 8fc6bec..8c0d379 100644 --- a/src/cpp/CPulseAudioClient.cpp +++ b/src/cpp/CPulseAudioClient.cpp @@ -171,6 +171,19 @@ void CPulseAudioClient::__streamPlaybackCb(pa_stream* s, size_t length, void* us assert(pClient->__mpListener); pClient->__mpListener->onStream(pClient, length); + + /* If stream is not written in first callback during prepare, + then write dummy data to ensure the start */ + if (pClient->__mIsFirstStream) { + AUDIO_IO_LOGD("Write dummy, length [%d]", length); + + char* dummy = new char[length]; + memset(dummy, 0, length); + pa_stream_write(s, dummy, length, NULL, 0LL, PA_SEEK_RELATIVE); + delete [] dummy; + + pClient->__mIsFirstStream = false; + } } void CPulseAudioClient::__streamLatencyUpdateCb(pa_stream* s, void* user_data) { -- 2.7.4