Add pa_threaded_mainloop_lock() in CPulseAudioClient::write() 84/192484/2 accepted/tizen/unified/20181107.082100 submit/tizen/20181106.060307
authorJungsup Lee <jungsup4.lee@samsung.com>
Tue, 6 Nov 2018 04:07:28 +0000 (13:07 +0900)
committerJungsup Lee <jungsup4.lee@samsung.com>
Tue, 6 Nov 2018 05:36:57 +0000 (14:36 +0900)
[Version] 0.5.14
[Issue Type] Bug fix

Change-Id: I56747241d749c2434101106c4aa1144aad1dde07
Signed-off-by: Jungsup Lee <jungsup4.lee@samsung.com>
packaging/capi-media-audio-io.spec
src/cpp/CPulseAudioClient.cpp

index 59a599f..7c16553 100644 (file)
@@ -1,6 +1,6 @@
 Name:           capi-media-audio-io
 Summary:        An Audio Input & Audio Output library in Tizen Native API
-Version:        0.5.13
+Version:        0.5.14
 Release:        0
 Group:          Multimedia/API
 License:        Apache-2.0
index 0e0bb28..7f41a61 100644 (file)
@@ -683,16 +683,22 @@ int CPulseAudioClient::write(const void* data, size_t length) {
 #ifdef _AUDIO_IO_DEBUG_TIMING_
     AUDIO_IO_LOGD("data[%p], length[%d], First[%d]", data, length, __mIsFirstStream);
 #endif
-    if (pa_stream_is_corked(__mpStream)) {
-        AUDIO_IO_LOGW("stream is corked...do uncork here first!!!!");
-        pa_operation_unref(pa_stream_cork(__mpStream, 0, NULL, this));
-    }
 
     if (isInThread() == false) {
         pa_threaded_mainloop_lock(__mpMainloop);
+        if (pa_stream_is_corked(__mpStream)) {
+            AUDIO_IO_LOGW("stream is corked...do uncork here first!!!!");
+            pa_operation_unref(pa_stream_cork(__mpStream, 0, NULL, this));
+        }
+
         ret = pa_stream_write(__mpStream, data, length, NULL, 0LL, PA_SEEK_RELATIVE);
         pa_threaded_mainloop_unlock(__mpMainloop);
     } else {
+        if (pa_stream_is_corked(__mpStream)) {
+            AUDIO_IO_LOGW("stream is corked...do uncork here first!!!!");
+            pa_operation_unref(pa_stream_cork(__mpStream, 0, NULL, this));
+        }
+
         if (__mIsFirstStream) {
             const pa_buffer_attr* attr = pa_stream_get_buffer_attr(__mpStream);
             uint32_t prebuf = attr->prebuf;