Fix deprecated API use
kAudioObjectPropertyElementMaster was marked as deprecated and was replaced by kAudioObjectPropertyElementMain in the macOS 12 SDK. This is a constant enum value explicitly defined in the header, so it can be swapped out today and back-deployed without issue. Fixed: 1420428 Change-Id: I396a7c07345747beb98847be41a6c0ce5240d174 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4296462 Commit-Queue: Jamie Walch <jamiewalch@chromium.org> Reviewed-by: Jamie Walch <jamiewalch@chromium.org> Auto-Submit: Avi Drissman <avi@chromium.org> Reviewed-by: Olga Sharonova <olka@chromium.org> Reviewed-by: Leonard Grey <lgrey@chromium.org> Cr-Commit-Position: refs/heads/main@{#1112019}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
57c9f0a016
commit
b87d694c36
@ -23,32 +23,32 @@ namespace media {
|
||||
const AudioObjectPropertyAddress
|
||||
AudioDeviceListenerMac::kDefaultOutputDeviceChangePropertyAddress = {
|
||||
kAudioHardwarePropertyDefaultOutputDevice,
|
||||
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMain};
|
||||
|
||||
const AudioObjectPropertyAddress
|
||||
AudioDeviceListenerMac::kDefaultInputDeviceChangePropertyAddress = {
|
||||
kAudioHardwarePropertyDefaultInputDevice,
|
||||
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMain};
|
||||
|
||||
const AudioObjectPropertyAddress
|
||||
AudioDeviceListenerMac::kDevicesPropertyAddress = {
|
||||
kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
|
||||
const AudioObjectPropertyAddress
|
||||
AudioDeviceListenerMac::kPropertyOutputSampleRateChanged = {
|
||||
kAudioDevicePropertyNominalSampleRate, kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
|
||||
const AudioObjectPropertyAddress
|
||||
AudioDeviceListenerMac::kPropertyOutputSourceChanged = {
|
||||
kAudioDevicePropertyDataSource, kAudioDevicePropertyScopeOutput,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
|
||||
const AudioObjectPropertyAddress
|
||||
AudioDeviceListenerMac::kPropertyInputSourceChanged = {
|
||||
kAudioDevicePropertyDataSource, kAudioDevicePropertyScopeInput,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
|
||||
class AudioDeviceListenerMac::PropertyListener {
|
||||
public:
|
||||
|
@ -72,7 +72,7 @@ class AudioDeviceListenerMacTest : public testing::Test {
|
||||
const AudioObjectPropertyAddress addresses[] = {
|
||||
address,
|
||||
{kAudioHardwarePropertySleepingIsAllowed,
|
||||
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster}};
|
||||
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMain}};
|
||||
|
||||
for (void* context : contexts) {
|
||||
OSStatus status = AudioDeviceListenerMac::SimulateEventForTesting(
|
||||
|
@ -126,7 +126,7 @@ static AudioDeviceID FindFirstOutputSubdevice(
|
||||
AudioDeviceID aggregate_device_id) {
|
||||
const AudioObjectPropertyAddress property_address = {
|
||||
kAudioAggregateDevicePropertyFullSubDeviceList,
|
||||
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMain};
|
||||
base::ScopedCFTypeRef<CFArrayRef> subdevices;
|
||||
UInt32 size = sizeof(subdevices);
|
||||
OSStatus result = AudioObjectGetPropertyData(
|
||||
@ -758,10 +758,10 @@ void AUAudioInputStream::SetVolume(double volume) {
|
||||
Float32 volume_float32 = static_cast<Float32>(volume);
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
kAudioDevicePropertyVolumeScalar, kAudioDevicePropertyScopeInput,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
|
||||
// Try to set the volume for master volume channel.
|
||||
if (IsVolumeSettableOnChannel(kAudioObjectPropertyElementMaster)) {
|
||||
if (IsVolumeSettableOnChannel(kAudioObjectPropertyElementMain)) {
|
||||
OSStatus result = AudioObjectSetPropertyData(
|
||||
input_device_id_, &property_address, 0, nullptr, sizeof(volume_float32),
|
||||
&volume_float32);
|
||||
@ -804,7 +804,7 @@ double AUAudioInputStream::GetVolume() {
|
||||
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
kAudioDevicePropertyVolumeScalar, kAudioDevicePropertyScopeInput,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
|
||||
if (AudioObjectHasProperty(input_device_id_, &property_address)) {
|
||||
// The device supports master volume control, get the volume from the
|
||||
@ -851,7 +851,7 @@ bool AUAudioInputStream::IsMuted() {
|
||||
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
kAudioDevicePropertyMute, kAudioDevicePropertyScopeInput,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
|
||||
if (!AudioObjectHasProperty(input_device_id_, &property_address)) {
|
||||
DLOG(ERROR) << "Device does not support checking master mute state";
|
||||
@ -1154,7 +1154,7 @@ int AUAudioInputStream::HardwareSampleRate() {
|
||||
|
||||
AudioObjectPropertyAddress default_input_device_address = {
|
||||
kAudioHardwarePropertyDefaultInputDevice, kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
OSStatus result = AudioObjectGetPropertyData(kAudioObjectSystemObject,
|
||||
&default_input_device_address, 0,
|
||||
0, &info_size, &device_id);
|
||||
@ -1166,7 +1166,7 @@ int AUAudioInputStream::HardwareSampleRate() {
|
||||
|
||||
AudioObjectPropertyAddress nominal_sample_rate_address = {
|
||||
kAudioDevicePropertyNominalSampleRate, kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
result = AudioObjectGetPropertyData(device_id, &nominal_sample_rate_address,
|
||||
0, 0, &info_size, &nominal_sample_rate);
|
||||
if (result != noErr)
|
||||
@ -1191,7 +1191,7 @@ int AUAudioInputStream::GetNumberOfChannelsFromStream() {
|
||||
// Get the stream format, to be able to read the number of channels.
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
kAudioDevicePropertyStreamFormat, kAudioDevicePropertyScopeInput,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
AudioStreamBasicDescription stream_format;
|
||||
UInt32 size = sizeof(stream_format);
|
||||
OSStatus result = AudioObjectGetPropertyData(
|
||||
|
@ -57,19 +57,19 @@ static bool GetDeviceChannels(AudioUnit audio_unit,
|
||||
|
||||
// Helper method to construct AudioObjectPropertyAddress structure given
|
||||
// property selector and scope. The property element is always set to
|
||||
// kAudioObjectPropertyElementMaster.
|
||||
// kAudioObjectPropertyElementMain.
|
||||
static AudioObjectPropertyAddress GetAudioObjectPropertyAddress(
|
||||
AudioObjectPropertySelector selector,
|
||||
bool is_input) {
|
||||
AudioObjectPropertyScope scope = is_input ? kAudioObjectPropertyScopeInput
|
||||
: kAudioObjectPropertyScopeOutput;
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
selector, scope, kAudioObjectPropertyElementMaster};
|
||||
selector, scope, kAudioObjectPropertyElementMain};
|
||||
return property_address;
|
||||
}
|
||||
|
||||
static const AudioObjectPropertyAddress kNoiseReductionPropertyAddress = {
|
||||
'nzca', kAudioDevicePropertyScopeInput, kAudioObjectPropertyElementMaster};
|
||||
'nzca', kAudioDevicePropertyScopeInput, kAudioObjectPropertyElementMain};
|
||||
|
||||
// Get IO buffer size range from HAL given device id and scope.
|
||||
static OSStatus GetIOBufferFrameSizeRange(AudioDeviceID device_id,
|
||||
@ -98,9 +98,9 @@ static bool HasAudioHardware(AudioObjectPropertySelector selector) {
|
||||
DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread());
|
||||
AudioDeviceID output_device_id = kAudioObjectUnknown;
|
||||
const AudioObjectPropertyAddress property_address = {
|
||||
selector,
|
||||
kAudioObjectPropertyScopeGlobal, // mScope
|
||||
kAudioObjectPropertyElementMaster // mElement
|
||||
selector,
|
||||
kAudioObjectPropertyScopeGlobal, // mScope
|
||||
kAudioObjectPropertyElementMain // mElement
|
||||
};
|
||||
UInt32 output_device_id_size = static_cast<UInt32>(sizeof(output_device_id));
|
||||
OSStatus err = AudioObjectGetPropertyData(kAudioObjectSystemObject,
|
||||
@ -176,10 +176,8 @@ AudioDeviceID AudioManagerMac::GetAudioDeviceIdByUId(
|
||||
const std::string& device_id) {
|
||||
DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread());
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
kAudioHardwarePropertyDevices,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
};
|
||||
kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMain};
|
||||
AudioDeviceID audio_device_id = kAudioObjectUnknown;
|
||||
UInt32 device_size = sizeof(audio_device_id);
|
||||
OSStatus result = -1;
|
||||
@ -233,7 +231,7 @@ static bool GetDefaultDevice(AudioDeviceID* device, bool input) {
|
||||
pa.mSelector = input ? kAudioHardwarePropertyDefaultInputDevice
|
||||
: kAudioHardwarePropertyDefaultOutputDevice;
|
||||
pa.mScope = kAudioObjectPropertyScopeGlobal;
|
||||
pa.mElement = kAudioObjectPropertyElementMaster;
|
||||
pa.mElement = kAudioObjectPropertyElementMain;
|
||||
|
||||
UInt32 size = sizeof(*device);
|
||||
OSStatus result = AudioObjectGetPropertyData(kAudioObjectSystemObject, &pa, 0,
|
||||
@ -262,7 +260,7 @@ static bool GetDeviceTotalChannelCount(AudioDeviceID device,
|
||||
// buffer pointers set to nullptr) which describes the list of streams and the
|
||||
// number of channels in each stream.
|
||||
AudioObjectPropertyAddress pa = {kAudioDevicePropertyStreamConfiguration,
|
||||
scope, kAudioObjectPropertyElementMaster};
|
||||
scope, kAudioObjectPropertyElementMain};
|
||||
|
||||
UInt32 size;
|
||||
OSStatus result = AudioObjectGetPropertyDataSize(device, &pa, 0, 0, &size);
|
||||
@ -647,10 +645,8 @@ int AudioManagerMac::HardwareSampleRateForDevice(AudioDeviceID device_id) {
|
||||
UInt32 info_size = sizeof(nominal_sample_rate);
|
||||
|
||||
static const AudioObjectPropertyAddress kNominalSampleRateAddress = {
|
||||
kAudioDevicePropertyNominalSampleRate,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
};
|
||||
kAudioDevicePropertyNominalSampleRate, kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMain};
|
||||
OSStatus result = AudioObjectGetPropertyData(device_id,
|
||||
&kNominalSampleRateAddress,
|
||||
0,
|
||||
@ -852,10 +848,8 @@ std::string AudioManagerMac::GetDefaultDeviceID(bool is_input) {
|
||||
return std::string();
|
||||
|
||||
const AudioObjectPropertyAddress property_address = {
|
||||
kAudioDevicePropertyDeviceUID,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
};
|
||||
kAudioDevicePropertyDeviceUID, kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMain};
|
||||
CFStringRef device_uid = NULL;
|
||||
UInt32 size = sizeof(device_uid);
|
||||
OSStatus status = AudioObjectGetPropertyData(device_id,
|
||||
|
@ -37,7 +37,7 @@ absl::optional<std::string> GetDeviceStringProperty(
|
||||
UInt32 size = sizeof(property_value);
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
property_selector, kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
|
||||
OSStatus result = AudioObjectGetPropertyData(
|
||||
device_id, &property_address, 0 /* inQualifierDataSize */,
|
||||
@ -63,7 +63,7 @@ absl::optional<uint32_t> GetDeviceUint32Property(
|
||||
AudioObjectPropertySelector property_selector,
|
||||
AudioObjectPropertyScope property_scope) {
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
property_selector, property_scope, kAudioObjectPropertyElementMaster};
|
||||
property_selector, property_scope, kAudioObjectPropertyElementMain};
|
||||
UInt32 property_value;
|
||||
UInt32 size = sizeof(property_value);
|
||||
OSStatus result = AudioObjectGetPropertyData(
|
||||
@ -79,7 +79,7 @@ uint32_t GetDevicePropertySize(AudioObjectID device_id,
|
||||
AudioObjectPropertySelector property_selector,
|
||||
AudioObjectPropertyScope property_scope) {
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
property_selector, property_scope, kAudioObjectPropertyElementMaster};
|
||||
property_selector, property_scope, kAudioObjectPropertyElementMain};
|
||||
UInt32 size = 0;
|
||||
OSStatus result = AudioObjectGetPropertyDataSize(
|
||||
device_id, &property_address, 0 /* inQualifierDataSize */,
|
||||
@ -98,7 +98,7 @@ std::vector<AudioObjectID> GetAudioObjectIDs(
|
||||
AudioObjectPropertySelector property_selector) {
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
property_selector, kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
UInt32 size = 0;
|
||||
OSStatus result = AudioObjectGetPropertyDataSize(
|
||||
audio_object_id, &property_address, 0 /* inQualifierDataSize */,
|
||||
@ -198,7 +198,7 @@ absl::optional<std::string> TranslateDeviceSource(AudioObjectID device_id,
|
||||
UInt32 translation_size = sizeof(AudioValueTranslation);
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
kAudioDevicePropertyDataSourceNameForIDCFString,
|
||||
InputOutputScope(is_input), kAudioObjectPropertyElementMaster};
|
||||
InputOutputScope(is_input), kAudioObjectPropertyElementMain};
|
||||
|
||||
OSStatus result = AudioObjectGetPropertyData(
|
||||
device_id, &property_address, 0 /* inQualifierDataSize */,
|
||||
@ -285,7 +285,7 @@ bool IsPrivateAggregateDevice(AudioObjectID device_id) {
|
||||
|
||||
const AudioObjectPropertyAddress property_address = {
|
||||
kAudioAggregateDevicePropertyComposition, kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster};
|
||||
kAudioObjectPropertyElementMain};
|
||||
CFDictionaryRef dictionary = nullptr;
|
||||
UInt32 size = sizeof(dictionary);
|
||||
OSStatus result = AudioObjectGetPropertyData(
|
||||
@ -385,7 +385,7 @@ base::TimeDelta GetHardwareLatency(AudioUnit audio_unit,
|
||||
|
||||
// Get audio device latency.
|
||||
AudioObjectPropertyAddress property_address = {
|
||||
kAudioDevicePropertyLatency, scope, kAudioObjectPropertyElementMaster};
|
||||
kAudioDevicePropertyLatency, scope, kAudioObjectPropertyElementMain};
|
||||
UInt32 device_latency_frames = 0;
|
||||
size = sizeof(device_latency_frames);
|
||||
result = AudioObjectGetPropertyData(device_id, &property_address, 0, nullptr,
|
||||
|
@ -100,7 +100,7 @@ std::vector<AudioCapturerMac::AudioDeviceInfo>
|
||||
AudioCapturerMac::GetAudioDevices() {
|
||||
AudioObjectPropertyAddress property_address;
|
||||
property_address.mScope = kAudioObjectPropertyScopeGlobal;
|
||||
property_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
property_address.mElement = kAudioObjectPropertyElementMain;
|
||||
|
||||
UInt32 property_size;
|
||||
|
||||
|
Reference in New Issue
Block a user