From 493404d8c396e15ed73455acd39aa0f1940996e2 Mon Sep 17 00:00:00 2001 From: Eric Laurent Date: Tue, 21 Apr 2015 15:07:36 -0700 Subject: audio policy: fix AudioTrack output device selection Have AudioTrack::setOutputDevice() set CBLK_INVALID flag instead of calling restoreTrack_l(). This allows restoreTrack_l() to be called in a safe context. Allow device change while the AudioTrack is active by forcing a new device selection in startOutput() if the output route for this session was changed. Remove some warnings. Change-Id: I2d921a63c9bfa0e122233645e2d6d39f95f5f17d --- .../audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'services/audiopolicy/common') diff --git a/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp index 9573583..0715eea 100644 --- a/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp +++ b/services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp @@ -52,6 +52,9 @@ bool DeviceDescriptor::equals(const sp& other) const // - are of the same type (a device type cannot be AUDIO_DEVICE_NONE) // - have the same address or one device does not specify the address // - have the same channel mask or one device does not specify the channel mask + if (other == 0) { + return false; + } return (mDeviceType == other->mDeviceType) && (mAddress == "" || other->mAddress == "" || mAddress == other->mAddress) && (mChannelMask == 0 || other->mChannelMask == 0 || -- cgit v1.1