From a121f90f388343dc48793cbc7eb899aba42e7664 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 3 Jun 2014 13:32:54 -0700 Subject: audio policy: new setAudioPortConfig implementation Rewrite setAudioPortConfig() to take advantage of the new AudioPortConfig class. The configuration is now checked against AudioPort capabilities and stored in the AudioPortConfig. Fix a bug where the config mask was not set properly when calling setAudioPortConfig at the PatchPanel interface. Remove debug log in IAudioPolicyService. Bug: 14815883. Change-Id: I7eb7683a96e049581c13f2a212486507883d008d --- services/audiopolicy/AudioPolicyManager.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'services/audiopolicy/AudioPolicyManager.h') diff --git a/services/audiopolicy/AudioPolicyManager.h b/services/audiopolicy/AudioPolicyManager.h index db0da24..4327949 100644 --- a/services/audiopolicy/AudioPolicyManager.h +++ b/services/audiopolicy/AudioPolicyManager.h @@ -195,20 +195,23 @@ protected: class AudioGain: public RefBase { public: - AudioGain(); + AudioGain(int index, bool useInChannelMask); virtual ~AudioGain() {} void dump(int fd, int spaces, int index) const; + void getDefaultConfig(struct audio_gain_config *config); + status_t checkConfig(const struct audio_gain_config *config); + int mIndex; struct audio_gain mGain; + bool mUseInChannelMask; }; class AudioPort: public virtual RefBase { public: AudioPort(const String8& name, audio_port_type_t type, - audio_port_role_t role, const sp& module) : - mName(name), mType(type), mRole(role), mModule(module) {} + audio_port_role_t role, const sp& module); virtual ~AudioPort() {} virtual void toAudioPort(struct audio_port *port) const; @@ -219,14 +222,20 @@ protected: void loadInChannels(char *name); audio_gain_mode_t loadGainMode(char *name); - void loadGain(cnode *root); + void loadGain(cnode *root, int index); void loadGains(cnode *root); + status_t checkSamplingRate(uint32_t samplingRate) const; + status_t checkChannelMask(audio_channel_mask_t channelMask) const; + status_t checkFormat(audio_format_t format) const; + status_t checkGain(const struct audio_gain_config *gainConfig, int index) const; + void dump(int fd, int spaces) const; String8 mName; audio_port_type_t mType; audio_port_role_t mRole; + bool mUseInChannelMask; // by convention, "0' in the first entry in mSamplingRates, mChannelMasks or mFormats // indicates the supported parameters should be read from the output stream // after it is opened for the first time @@ -243,6 +252,8 @@ protected: AudioPortConfig(); virtual ~AudioPortConfig() {} + status_t applyAudioPortConfig(const struct audio_port_config *config, + struct audio_port_config *backupConfig = NULL); virtual void toAudioPortConfig(struct audio_port_config *dstConfig, const struct audio_port_config *srcConfig = NULL) const = 0; sp mAudioPort; -- cgit v1.1