Permalink
Browse files

Log a potential deadlock issue in audio MIO for recording

When the number of bytes returned from audio driver is <= 0,
the existing audio MIO terminates the audio recording thread
in the MIO immediately. but when the application tries to
terminate the audio recording via stop or reset, the stop
or reset can potentially wait forever.

This is not verified, thus I enable the logging first to get
confirmation should this happens.

bug - 2484098
  • Loading branch information...
1 parent d88ab3a commit fe5c20c9b209c48ded8a1ceee510b75046f46e6a James Dong committed Mar 3, 2010
Showing with 8 additions and 2 deletions.
  1. +8 −2 android/author/android_audio_input.cpp
@@ -1190,9 +1190,15 @@ int AndroidAudioInput::audin_thread_func() {
}
int numOfBytes = record->read(data, kBufferSize);
- //LOGV("read %d bytes", numOfBytes);
- if (numOfBytes <= 0)
+ if (numOfBytes <= 0) {
+ // FIXME:
+ // When numOfBytes is not greater than 0, instead of terminating the audio
+ // recording thread immediately, wait for next incoming audio frame or stop/reset
+ // command to terminate the thread. Lets log the case to see whether the deadlock
+ // root cause is here. To resolve the problem, change the break to continue.
+ LOGW("numOfBytes (%d) <= 0.", numOfBytes);
break;
+ }
if (iFirstFrameReceived == false) {
iFirstFrameReceived = true;

0 comments on commit fe5c20c

Please sign in to comment.