diff options
author | Glenn Kasten <gkasten@google.com> | 2014-01-13 09:59:31 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2014-01-14 18:12:46 -0800 |
commit | 5f972c031d4061f4f037c9fda1ea4bd9b6a756cd (patch) | |
tree | f70d82aa480a0cbe854395362aba76fbb58315dc /media/libmedia/IAudioFlinger.cpp | |
parent | 5b27ccd67c845aa20a12a1fb58339e7e81e3d536 (diff) | |
download | frameworks_av-5f972c031d4061f4f037c9fda1ea4bd9b6a756cd.zip frameworks_av-5f972c031d4061f4f037c9fda1ea4bd9b6a756cd.tar.gz frameworks_av-5f972c031d4061f4f037c9fda1ea4bd9b6a756cd.tar.bz2 |
AudioRecord::getInputFramesLost() cleanup
Fixed bug that if the binder call failed (for example if the
IAudioFlinger binder is dead), then getInputFramesLost was returning
garbage. Now it correctly returns zero, which is the error value for
this method.
The type declarations for getInputFramesLost were inconsistent:
a mixture of unsigned int, size_t, and uint32_t. Now it returns uint32_t
everywhere, which is what the underlying HAL API returns.
Added a FIXME about the side effect behavior. This will need review
for multi-client.
Change-Id: Ifa2e117a87dbd0c1f2c892a31d1c3dd919bf1a0a
Diffstat (limited to 'media/libmedia/IAudioFlinger.cpp')
-rw-r--r-- | media/libmedia/IAudioFlinger.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index c9c8d58..3aaff88 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -564,13 +564,16 @@ public: return status; } - virtual size_t getInputFramesLost(audio_io_handle_t ioHandle) const + virtual uint32_t getInputFramesLost(audio_io_handle_t ioHandle) const { Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); data.writeInt32((int32_t) ioHandle); - remote()->transact(GET_INPUT_FRAMES_LOST, data, &reply); - return reply.readInt32(); + status_t status = remote()->transact(GET_INPUT_FRAMES_LOST, data, &reply); + if (status != NO_ERROR) { + return 0; + } + return (uint32_t) reply.readInt32(); } virtual int newAudioSessionId() @@ -1044,7 +1047,7 @@ status_t BnAudioFlinger::onTransact( case GET_INPUT_FRAMES_LOST: { CHECK_INTERFACE(IAudioFlinger, data, reply); audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32(); - reply->writeInt32(getInputFramesLost(ioHandle)); + reply->writeInt32((int32_t) getInputFramesLost(ioHandle)); return NO_ERROR; } break; case NEW_AUDIO_SESSION_ID: { |