| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 #if defined(WEBRTC_IOS) | 11 #if defined(WEBRTC_IOS) |
| 12 | 12 |
| 13 #import <AVFoundation/AVFoundation.h> | 13 #import <AVFoundation/AVFoundation.h> |
| 14 #import <Foundation/Foundation.h> | 14 #import <Foundation/Foundation.h> |
| 15 #import <sys/sysctl.h> | 15 #import <sys/sysctl.h> |
| 16 #import <UIKit/UIKit.h> | 16 #import <UIKit/UIKit.h> |
| 17 | 17 |
| 18 #include <memory> | 18 #include <memory> |
| 19 | 19 |
| 20 #include "webrtc/base/checks.h" | 20 #include "webrtc/base/checks.h" |
| 21 #include "webrtc/base/logging.h" | 21 #include "webrtc/base/logging.h" |
| 22 #include "webrtc/modules/audio_device/ios/helpers_ios.h" | 22 #include "webrtc/sdk/objc/Framework/Classes/helpers.h" |
| 23 | 23 |
| 24 namespace webrtc { | 24 namespace webrtc { |
| 25 namespace ios { | 25 namespace ios { |
| 26 | 26 |
| 27 bool isOperatingSystemAtLeastVersion(double version) { | 27 bool isOperatingSystemAtLeastVersion(double version) { |
| 28 return GetSystemVersion() >= version; | 28 return GetSystemVersion() >= version; |
| 29 } | 29 } |
| 30 | 30 |
| 31 // Internal helper method used by GetDeviceName() to return device name. | 31 // Internal helper method used by GetDeviceName() to return device name. |
| 32 const char* LookUpRealName(const char* raw_name) { | 32 const char* LookUpRealName(const char* raw_name) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 for (auto& d : device_names) { | 81 for (auto& d : device_names) { |
| 82 if (strcmp(d.raw_name, raw_name) == 0) | 82 if (strcmp(d.raw_name, raw_name) == 0) |
| 83 return d.real_name; | 83 return d.real_name; |
| 84 } | 84 } |
| 85 LOG(LS_WARNING) << "Failed to find device name (" << raw_name << ")"; | 85 LOG(LS_WARNING) << "Failed to find device name (" << raw_name << ")"; |
| 86 return ""; | 86 return ""; |
| 87 } | 87 } |
| 88 | 88 |
| 89 // TODO(henrika): move to shared location. | |
| 90 // See https://code.google.com/p/webrtc/issues/detail?id=4773 for details. | |
| 91 NSString* NSStringFromStdString(const std::string& stdString) { | 89 NSString* NSStringFromStdString(const std::string& stdString) { |
| 92 // std::string may contain null termination character so we construct | 90 // std::string may contain null termination character so we construct |
| 93 // using length. | 91 // using length. |
| 94 return [[NSString alloc] initWithBytes:stdString.data() | 92 return [[NSString alloc] initWithBytes:stdString.data() |
| 95 length:stdString.length() | 93 length:stdString.length() |
| 96 encoding:NSUTF8StringEncoding]; | 94 encoding:NSUTF8StringEncoding]; |
| 97 } | 95 } |
| 98 | 96 |
| 99 std::string StdStringFromNSString(NSString* nsString) { | 97 std::string StdStringFromNSString(NSString* nsString) { |
| 100 NSData* charData = [nsString dataUsingEncoding:NSUTF8StringEncoding]; | 98 NSData* charData = [nsString dataUsingEncoding:NSUTF8StringEncoding]; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 LOG(LS_WARNING) << "webrtc::ios::GetLowPowerModeEnabled() is not " | 186 LOG(LS_WARNING) << "webrtc::ios::GetLowPowerModeEnabled() is not " |
| 189 "supported. Requires at least iOS 9.0"; | 187 "supported. Requires at least iOS 9.0"; |
| 190 return false; | 188 return false; |
| 191 } | 189 } |
| 192 #endif | 190 #endif |
| 193 | 191 |
| 194 } // namespace ios | 192 } // namespace ios |
| 195 } // namespace webrtc | 193 } // namespace webrtc |
| 196 | 194 |
| 197 #endif // defined(WEBRTC_IOS) | 195 #endif // defined(WEBRTC_IOS) |
| OLD | NEW |