summaryrefslogtreecommitdiffstats
path: root/include/media/AudioSystem.h
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2015-05-01 19:10:25 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-01 19:10:26 +0000
commitcc85abcf4ac398dca240db356b8b4db052b415a4 (patch)
tree65f9eccab6b0d9b9f3dcee48e2c44326b0edbef4 /include/media/AudioSystem.h
parent0bbf8b213ad96051357e3ad6d6d2808bfa31a59a (diff)
parent73e26b661af50be2c0a4ff6c9ac85f7347a8b235 (diff)
downloadframeworks_av-cc85abcf4ac398dca240db356b8b4db052b415a4.zip
frameworks_av-cc85abcf4ac398dca240db356b8b4db052b415a4.tar.gz
frameworks_av-cc85abcf4ac398dca240db356b8b4db052b415a4.tar.bz2
Merge "AudioSystem: refactor audio config cache and callbacks" into mnc-dev
Diffstat (limited to 'include/media/AudioSystem.h')
-rw-r--r--include/media/AudioSystem.h55
1 files changed, 20 insertions, 35 deletions
diff --git a/include/media/AudioSystem.h b/include/media/AudioSystem.h
index b427036..0cbcdb1 100644
--- a/include/media/AudioSystem.h
+++ b/include/media/AudioSystem.h
@@ -19,6 +19,7 @@
#include <hardware/audio_effect.h>
#include <media/AudioPolicy.h>
+#include <media/AudioIoDescriptor.h>
#include <media/IAudioFlingerClient.h>
#include <media/IAudioPolicyServiceClient.h>
#include <system/audio.h>
@@ -157,33 +158,6 @@ public:
// or no HW sync source is used.
static audio_hw_sync_t getAudioHwSyncForSession(audio_session_t sessionId);
- // types of io configuration change events received with ioConfigChanged()
- enum io_config_event {
- OUTPUT_OPENED,
- OUTPUT_CLOSED,
- OUTPUT_CONFIG_CHANGED,
- INPUT_OPENED,
- INPUT_CLOSED,
- INPUT_CONFIG_CHANGED,
- STREAM_CONFIG_CHANGED,
- NUM_CONFIG_EVENTS
- };
-
- // audio output descriptor used to cache output configurations in client process to avoid
- // frequent calls through IAudioFlinger
- class OutputDescriptor {
- public:
- OutputDescriptor()
- : samplingRate(0), format(AUDIO_FORMAT_DEFAULT), channelMask(0), frameCount(0), latency(0)
- {}
-
- uint32_t samplingRate;
- audio_format_t format;
- audio_channel_mask_t channelMask;
- size_t frameCount;
- uint32_t latency;
- };
-
// Events used to synchronize actions between audio sessions.
// For instance SYNC_EVENT_PRESENTATION_COMPLETE can be used to delay recording start until
// playback is complete on another audio session.
@@ -366,9 +340,16 @@ private:
class AudioFlingerClient: public IBinder::DeathRecipient, public BnAudioFlingerClient
{
public:
- AudioFlingerClient() {
+ AudioFlingerClient() :
+ mInBuffSize(0), mInSamplingRate(0),
+ mInFormat(AUDIO_FORMAT_DEFAULT), mInChannelMask(AUDIO_CHANNEL_NONE) {
}
+ void clearIoCache();
+ status_t getInputBufferSize(uint32_t sampleRate, audio_format_t format,
+ audio_channel_mask_t channelMask, size_t* buffSize);
+ sp<AudioIoDescriptor> getIoDescriptor(audio_io_handle_t ioHandle);
+
// DeathRecipient
virtual void binderDied(const wp<IBinder>& who);
@@ -376,7 +357,17 @@ private:
// indicate a change in the configuration of an output or input: keeps the cached
// values for output/input parameters up-to-date in client process
- virtual void ioConfigChanged(int event, audio_io_handle_t ioHandle, const void *param2);
+ virtual void ioConfigChanged(audio_io_config_event event,
+ const sp<AudioIoDescriptor>& ioDesc);
+ private:
+ Mutex mLock;
+ DefaultKeyedVector<audio_io_handle_t, sp<AudioIoDescriptor> > mIoDescriptors;
+
+ // cached values for recording getInputBufferSize() queries
+ size_t mInBuffSize; // zero indicates cache is invalid
+ uint32_t mInSamplingRate;
+ audio_format_t mInFormat;
+ audio_channel_mask_t mInChannelMask;
};
class AudioPolicyServiceClient: public IBinder::DeathRecipient,
@@ -408,8 +399,6 @@ private:
friend class AudioPolicyServiceClient;
static Mutex gLock; // protects gAudioFlinger and gAudioErrorCallback,
- static Mutex gLockCache; // protects gOutputs, gPrevInSamplingRate, gPrevInFormat,
- // gPrevInChannelMask and gInBuffSize
static Mutex gLockAPS; // protects gAudioPolicyService and gAudioPolicyServiceClient
static sp<IAudioFlinger> gAudioFlinger;
static audio_error_callback gAudioErrorCallback;
@@ -422,10 +411,6 @@ private:
static audio_channel_mask_t gPrevInChannelMask;
static sp<IAudioPolicyService> gAudioPolicyService;
-
- // list of output descriptors containing cached parameters
- // (sampling rate, framecount, channel count...)
- static DefaultKeyedVector<audio_io_handle_t, OutputDescriptor *> gOutputs;
};
}; // namespace android