diff options
-rw-r--r-- | include/media/AudioSystem.h | 1 | ||||
-rw-r--r-- | media/libmedia/AudioRecord.cpp | 6 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 4 |
3 files changed, 3 insertions, 8 deletions
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index 66f4b84..61d62b0 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -126,6 +126,7 @@ public: // necessary to check returned status before using the returned values. static status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, audio_stream_type_t stream = AUDIO_STREAM_DEFAULT); + // return the number of input frames lost by HAL implementation, or 0 if the handle is invalid static unsigned int getInputFramesLost(audio_io_handle_t ioHandle); static int newAudioSessionId(); diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index f8813c9..01ce2a4 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -432,10 +432,8 @@ status_t AudioRecord::getPosition(uint32_t *position) const unsigned int AudioRecord::getInputFramesLost() const { - if (mActive) - return AudioSystem::getInputFramesLost(mInput); - else - return 0; + // no need to check mActive, because if inactive this will return 0, which is what we want + return AudioSystem::getInputFramesLost(mInput); } // ------------------------------------------------------------------------- diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 765127a..2ed3324 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -978,10 +978,6 @@ size_t AudioFlinger::getInputBufferSize(uint32_t sampleRate, audio_format_t form unsigned int AudioFlinger::getInputFramesLost(audio_io_handle_t ioHandle) const { - if (ioHandle == 0) { - return 0; - } - Mutex::Autolock _l(mLock); RecordThread *recordThread = checkRecordThread_l(ioHandle); |