OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/media/devices/macdevicemanager.h" | 11 #include "webrtc/media/devices/macdevicemanager.h" |
12 | 12 |
| 13 #include <memory> |
| 14 |
13 #include <CoreAudio/CoreAudio.h> | 15 #include <CoreAudio/CoreAudio.h> |
14 #include <QuickTime/QuickTime.h> | 16 #include <QuickTime/QuickTime.h> |
15 | 17 |
16 #include "webrtc/base/logging.h" | 18 #include "webrtc/base/logging.h" |
17 #include "webrtc/base/stringutils.h" | 19 #include "webrtc/base/stringutils.h" |
18 #include "webrtc/base/thread.h" | 20 #include "webrtc/base/thread.h" |
19 #include "webrtc/media/base/mediacommon.h" | 21 #include "webrtc/media/base/mediacommon.h" |
20 | 22 |
21 class DeviceWatcherImpl; | 23 class DeviceWatcherImpl; |
22 | 24 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 UInt32 propsize; | 97 UInt32 propsize; |
96 OSErr err = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, | 98 OSErr err = AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, |
97 &propsize, NULL); | 99 &propsize, NULL); |
98 if (0 != err) { | 100 if (0 != err) { |
99 LOG(LS_ERROR) << "Couldn't get information about property, " | 101 LOG(LS_ERROR) << "Couldn't get information about property, " |
100 << "so no device list acquired."; | 102 << "so no device list acquired."; |
101 return false; | 103 return false; |
102 } | 104 } |
103 | 105 |
104 size_t num_devices = propsize / sizeof(AudioDeviceID); | 106 size_t num_devices = propsize / sizeof(AudioDeviceID); |
105 rtc::scoped_ptr<AudioDeviceID[]> device_ids( | 107 std::unique_ptr<AudioDeviceID[]> device_ids( |
106 new AudioDeviceID[num_devices]); | 108 new AudioDeviceID[num_devices]); |
107 | 109 |
108 err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, | 110 err = AudioHardwareGetProperty(kAudioHardwarePropertyDevices, |
109 &propsize, device_ids.get()); | 111 &propsize, device_ids.get()); |
110 if (0 != err) { | 112 if (0 != err) { |
111 LOG(LS_ERROR) << "Failed to get device ids, " | 113 LOG(LS_ERROR) << "Failed to get device ids, " |
112 << "so no device listing acquired."; | 114 << "so no device listing acquired."; |
113 return false; | 115 return false; |
114 } | 116 } |
115 | 117 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 172 } |
171 | 173 |
172 void MacDeviceWatcher::Stop() { | 174 void MacDeviceWatcher::Stop() { |
173 if (impl_) { | 175 if (impl_) { |
174 ReleaseDeviceWatcherCallback(impl_); | 176 ReleaseDeviceWatcherCallback(impl_); |
175 impl_ = NULL; | 177 impl_ = NULL; |
176 } | 178 } |
177 } | 179 } |
178 | 180 |
179 }; // namespace cricket | 181 }; // namespace cricket |
OLD | NEW |