Merge "audio policy: fix crash in findPreferredDevice() on duplicating outputs" into rvc-dev

gugelfrei
Eric Laurent 4 years ago committed by Android (Google) Code Review
commit 9b8c695c48

@ -34,6 +34,8 @@ public:
virtual audio_patch_handle_t getPatchHandle() const = 0; virtual audio_patch_handle_t getPatchHandle() const = 0;
virtual void setPatchHandle(audio_patch_handle_t handle) = 0; virtual void setPatchHandle(audio_patch_handle_t handle) = 0;
virtual bool isMmap() = 0;
}; };
template <class IoDescriptor, class Filter> template <class IoDescriptor, class Filter>
@ -48,7 +50,7 @@ sp<DeviceDescriptor> findPreferredDevice(
// created when the mmap stream is opened). This client is never active. // created when the mmap stream is opened). This client is never active.
// On non MMAP IOs, the preferred device is honored only if all active clients have // On non MMAP IOs, the preferred device is honored only if all active clients have
// a preferred device in which case the first client drives the selection. // a preferred device in which case the first client drives the selection.
if (desc->getPolicyAudioPort()->isMmap()) { if (desc->isMmap()) {
// The client list is never empty on a MMAP IO // The client list is never empty on a MMAP IO
return devices.getDeviceFromId( return devices.getDeviceFromId(
desc->clientsList(false /*activeOnly*/)[0]->preferredDeviceId()); desc->clientsList(false /*activeOnly*/)[0]->preferredDeviceId());

@ -92,6 +92,12 @@ public:
audio_config_base_t getConfig() const override; audio_config_base_t getConfig() const override;
audio_patch_handle_t getPatchHandle() const override; audio_patch_handle_t getPatchHandle() const override;
void setPatchHandle(audio_patch_handle_t handle) override; void setPatchHandle(audio_patch_handle_t handle) override;
bool isMmap() override {
if (getPolicyAudioPort() != nullptr) {
return getPolicyAudioPort()->isMmap();
}
return false;
}
status_t open(const audio_config_t *config, status_t open(const audio_config_t *config,
const sp<DeviceDescriptor> &device, const sp<DeviceDescriptor> &device,

@ -268,6 +268,12 @@ public:
audio_config_base_t getConfig() const override; audio_config_base_t getConfig() const override;
audio_patch_handle_t getPatchHandle() const override; audio_patch_handle_t getPatchHandle() const override;
void setPatchHandle(audio_patch_handle_t handle) override; void setPatchHandle(audio_patch_handle_t handle) override;
bool isMmap() override {
if (getPolicyAudioPort() != nullptr) {
return getPolicyAudioPort()->isMmap();
}
return false;
}
TrackClientVector clientsList(bool activeOnly = false, TrackClientVector clientsList(bool activeOnly = false,
product_strategy_t strategy = PRODUCT_STRATEGY_NONE, product_strategy_t strategy = PRODUCT_STRATEGY_NONE,

Loading…
Cancel
Save