diff options
author | Glenn Kasten <gkasten@google.com> | 2014-01-17 10:25:08 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2014-03-25 15:38:25 -0700 |
commit | 85d109a4b0eddd76a8c5cee170bc2bcc99d00118 (patch) | |
tree | 063a73398f17da98b0a9ecc5923ab05bbc3fc5d9 | |
parent | 1392eb3d1802e9f894f87d7a7387207d1b6faca1 (diff) | |
download | frameworks_av-85d109a4b0eddd76a8c5cee170bc2bcc99d00118.zip frameworks_av-85d109a4b0eddd76a8c5cee170bc2bcc99d00118.tar.gz frameworks_av-85d109a4b0eddd76a8c5cee170bc2bcc99d00118.tar.bz2 |
Document AudioSystem::newAudioSessionId() failures
Change-Id: Iaa168722f362c36bdfa87fe20dc0a59b43cf1ca3
-rw-r--r-- | include/media/AudioSystem.h | 6 | ||||
-rw-r--r-- | media/libmedia/AudioSystem.cpp | 2 | ||||
-rw-r--r-- | media/libmedia/IAudioFlinger.cpp | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h index 28fdfd4..3faaa7e 100644 --- a/include/media/AudioSystem.h +++ b/include/media/AudioSystem.h @@ -141,7 +141,13 @@ public: // return the number of input frames lost by HAL implementation, or 0 if the handle is invalid static uint32_t getInputFramesLost(audio_io_handle_t ioHandle); + // Allocate a new audio session ID and return that new ID. + // If unable to contact AudioFlinger, returns AUDIO_SESSION_ALLOCATE instead. + // FIXME If AudioFlinger were to ever exhaust the session ID namespace, + // this method could fail by returning either AUDIO_SESSION_ALLOCATE + // or an unspecified existing session ID. static int newAudioSessionId(); + static void acquireAudioSessionId(int audioSession, pid_t pid); static void releaseAudioSessionId(int audioSession, pid_t pid); diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp index 140fb66..c418466 100644 --- a/media/libmedia/AudioSystem.cpp +++ b/media/libmedia/AudioSystem.cpp @@ -431,7 +431,7 @@ uint32_t AudioSystem::getInputFramesLost(audio_io_handle_t ioHandle) int AudioSystem::newAudioSessionId() { const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); - if (af == 0) return 0; + if (af == 0) return AUDIO_SESSION_ALLOCATE; return af->newAudioSessionId(); } diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index 762681e..f28b82d 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -599,7 +599,7 @@ public: Parcel data, reply; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); status_t status = remote()->transact(NEW_AUDIO_SESSION_ID, data, &reply); - int id = 0; + int id = AUDIO_SESSION_ALLOCATE; if (status == NO_ERROR) { id = reply.readInt32(); } |