[UTC][audio-io][Non-ACR] change waiting logic of stream callback due to platform...
authorSeungbae Shin <seungbae.shin@samsung.com>
Thu, 5 Jan 2017 12:35:09 +0000 (21:35 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 6 Jan 2017 05:29:00 +0000 (21:29 -0800)
As platform code updated due to request of removing initial latency in audio-io,
stream callback invoked earlier than waiting lock logic, therefore deadlock happens.
code changed to handle even callback invoked earlier than expected.

Change-Id: Ic512e372c4be3ee2e1a0a6870bcaab17c5c51ce8

src/utc/audio-io/utc-media-audio-output.c

index 65387c2c6fe0e221df9148d62226199f20deb2cb..0cf0e5de5397037f0db2e86f8f5c115a763fccef 100755 (executable)
@@ -282,7 +282,8 @@ int utc_media_audio_out_write_p(void)
     if (size == 0)  size = 8096;
 
     pthread_mutex_lock(&mutex);
-    pthread_cond_wait(&cond, &mutex);
+    if (td.callback_ret == -1)
+        pthread_cond_wait(&cond, &mutex);
     assert_eq(td.callback_ret, AUDIO_IO_ERROR_NONE);
     pthread_mutex_unlock(&mutex);
 
@@ -840,7 +841,8 @@ int utc_media_audio_out_set_stream_cb_p(void)
     assert_eq(ret, AUDIO_IO_ERROR_NONE);
 
     pthread_mutex_lock(&mutex);
-    pthread_cond_wait(&cond, &mutex);
+    if (td.callback_ret == -1)
+        pthread_cond_wait(&cond, &mutex);
     assert_eq(td.callback_ret, AUDIO_IO_ERROR_NONE);
     pthread_mutex_unlock(&mutex);