From 79ba28cd297aaf12bf1d5e1101ba01238012fe1d Mon Sep 17 00:00:00 2001 From: Shashi Kumar Date: Tue, 27 Mar 2012 16:24:29 +0530 Subject: frameworks/base: Added more log messages in LPAPlayer - Added more log messages in LPAPlayer for better debugging (cherry picked from commit 585d32158ab2c13009dbb015f47551c235cdb1f3) Change-Id: I8f7968da367aaefe2ead70b848237cdc452e8842 --- media/libstagefright/LPAPlayer.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/media/libstagefright/LPAPlayer.cpp b/media/libstagefright/LPAPlayer.cpp index 1359d3f3343..0ee527b6bae 100644 --- a/media/libstagefright/LPAPlayer.cpp +++ b/media/libstagefright/LPAPlayer.cpp @@ -743,10 +743,13 @@ void LPAPlayer::decoderThreadEntry() { audio_register_memory(); while (1) { + LOGV("mem_request_mutex locking: %d", __LINE__); pthread_mutex_lock(&mem_request_mutex); - + LOGV("mem_request_mutex locked: %d", __LINE__); if (killDecoderThread) { + LOGV("mem_request_mutex unlocking: %d", __LINE__); pthread_mutex_unlock(&mem_request_mutex); + LOGV("mem_request_mutex unlocked: %d", __LINE__); break; } @@ -760,22 +763,30 @@ void LPAPlayer::decoderThreadEntry() { mReachedEOS, bIsA2DPEnabled, mAudioSinkOpen, asyncReset, mIsDriverStarted); LOGV("decoderThreadEntry: waiting on decoder_cv"); pthread_cond_wait(&decoder_cv, &mem_request_mutex); + LOGV("mem_request_mutex unlocking: %d", __LINE__); pthread_mutex_unlock(&mem_request_mutex); LOGV("decoderThreadEntry: received a signal to wake up"); + LOGV("mem_request_mutex unlocked: %d", __LINE__); continue; } List::iterator it = memBuffersRequestQueue.begin(); BuffersAllocated buf = *it; memBuffersRequestQueue.erase(it); + LOGV("mem_request_mutex unlocking: %d", __LINE__); pthread_mutex_unlock(&mem_request_mutex); + LOGV("mem_request_mutex unlocked: %d", __LINE__); //Queue the buffers back to Request queue if (mReachedEOS || (bIsA2DPEnabled && !mAudioSinkOpen) || asyncReset || a2dpDisconnectPause) { LOGV("%s: mReachedEOS %d bIsA2DPEnabled %d ", __func__, mReachedEOS, bIsA2DPEnabled); + LOGV("mem_request_mutex locking: %d", __LINE__); pthread_mutex_lock(&mem_request_mutex); + LOGV("mem_request_mutex locked: %d", __LINE__); memBuffersRequestQueue.push_back(buf); + LOGV("mem_request_mutex unlocking: %d", __LINE__); pthread_mutex_unlock(&mem_request_mutex); + LOGV("mem_request_mutex unlocked: %d", __LINE__); } //Queue up the buffers for writing either for A2DP or LPA Driver else { @@ -817,9 +828,13 @@ void LPAPlayer::decoderThreadEntry() { } } else { /* Put the buffer back into requestQ */ + LOGV("mem_request_mutex locking: %d", __LINE__); pthread_mutex_lock(&mem_request_mutex); + LOGV("mem_request_mutex locked: %d", __LINE__); memBuffersRequestQueue.push_back(buf); + LOGV("mem_request_mutex unlocking: %d", __LINE__); pthread_mutex_unlock(&mem_request_mutex); + LOGV("mem_request_mutex unlocked: %d", __LINE__); /* This is zero byte buffer - no need to put in response Q*/ if (mObserver && mReachedEOS && memBuffersResponseQueue.empty()) { LOGV("Posting EOS event to AwesomePlayer"); @@ -975,9 +990,13 @@ void LPAPlayer::eventThreadEntry() { pthread_mutex_unlock(&mem_response_mutex); // Post buffer to request Q + LOGV("mem_request_mutex locking: %d", __LINE__); pthread_mutex_lock(&mem_request_mutex); + LOGV("mem_request_mutex locked: %d", __LINE__); memBuffersRequestQueue.push_back(buf); + LOGV("mem_request_mutex unlocking: %d", __LINE__); pthread_mutex_unlock(&mem_request_mutex); + LOGV("mem_request_mutex unlocked: %d", __LINE__); pthread_cond_signal(&decoder_cv); } @@ -1086,7 +1105,9 @@ void LPAPlayer::A2DPThreadEntry() { LOGV("A2DPThreadEntry:: received signal to wake up"); // A2DP got disabled -- Queue up everything back to Request Queue if (!bIsA2DPEnabled) { + LOGV("mem_request_mutex locking: %d", __LINE__); pthread_mutex_lock(&mem_request_mutex); + LOGV("mem_request_mutex locked: %d", __LINE__); while (!memBuffersResponseQueue.empty()) { LOGV("BUF transfer"); List::iterator it = memBuffersResponseQueue.begin(); @@ -1094,7 +1115,9 @@ void LPAPlayer::A2DPThreadEntry() { memBuffersRequestQueue.push_back(buf); memBuffersResponseQueue.erase(it); } + LOGV("mem_request_mutex unlocking: %d", __LINE__); pthread_mutex_unlock(&mem_request_mutex); + LOGV("mem_request_mutex unlocked: %d", __LINE__); } pthread_mutex_unlock(&mem_response_mutex); } @@ -1178,10 +1201,14 @@ void LPAPlayer::A2DPThreadEntry() { LOGV("Posting EOS event to AwesomePlayer"); mObserver->postAudioEOS(); } + LOGV("mem_request_mutex locking: %d", __LINE__); pthread_mutex_lock(&mem_request_mutex); + LOGV("mem_request_mutex locked: %d", __LINE__); memBuffersRequestQueue.push_back(buf); if (killA2DPThread) { + LOGV("mem_request_mutex unlocking: %d", __LINE__); pthread_mutex_unlock(&mem_request_mutex); + LOGV("mem_request_mutex unlocked: %d", __LINE__); break; } //flush out old buffer @@ -1197,7 +1224,9 @@ void LPAPlayer::A2DPThreadEntry() { } pthread_mutex_unlock(&mem_response_mutex); } + LOGV("mem_request_mutex unlocking: %d", __LINE__); pthread_mutex_unlock(&mem_request_mutex); + LOGV("mem_request_mutex unlocked: %d", __LINE__); // Signal decoder thread when a buffer is put back to request Q pthread_cond_signal(&decoder_cv); } @@ -1557,10 +1586,14 @@ void LPAPlayer::requestAndWaitForDecoderThreadExit() { if (!decoderThreadAlive) return; + LOGV("mem_request_mutex locking: %d", __LINE__); pthread_mutex_lock(&mem_request_mutex); + LOGV("mem_request_mutex locked: %d", __LINE__); killDecoderThread = true; pthread_cond_signal(&decoder_cv); + LOGV("mem_request_mutex unlocking: %d", __LINE__); pthread_mutex_unlock(&mem_request_mutex); + LOGV("mem_request_mutex unlocked: %d", __LINE__); pthread_join(decoderThread,NULL); LOGV("decoder thread killed"); -- cgit v1.2.3