| 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 <Foundation/Foundation.h> | 14 #import <Foundation/Foundation.h> |
| 14 #import <sys/sysctl.h> | 15 #import <sys/sysctl.h> |
| 15 #import <UIKit/UIKit.h> | 16 #import <UIKit/UIKit.h> |
| 16 | 17 |
| 17 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 18 #include "webrtc/base/logging.h" | 19 #include "webrtc/base/logging.h" |
| 19 #include "webrtc/base/scoped_ptr.h" | 20 #include "webrtc/base/scoped_ptr.h" |
| 20 #include "webrtc/modules/utility/interface/helpers_ios.h" | 21 #include "webrtc/modules/utility/interface/helpers_ios.h" |
| 21 | 22 |
| 22 namespace webrtc { | 23 namespace webrtc { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 50 return true; | 51 return true; |
| 51 } | 52 } |
| 52 | 53 |
| 53 // TODO(henrika): see if it is possible to move to GetThreadName in | 54 // TODO(henrika): see if it is possible to move to GetThreadName in |
| 54 // platform_thread.h and base it on pthread methods instead. | 55 // platform_thread.h and base it on pthread methods instead. |
| 55 std::string GetCurrentThreadDescription() { | 56 std::string GetCurrentThreadDescription() { |
| 56 NSString* name = [NSString stringWithFormat:@"%@", [NSThread currentThread]]; | 57 NSString* name = [NSString stringWithFormat:@"%@", [NSThread currentThread]]; |
| 57 return StdStringFromNSString(name); | 58 return StdStringFromNSString(name); |
| 58 } | 59 } |
| 59 | 60 |
| 61 std::string GetAudioSessionCategory() { |
| 62 NSString* category = [[AVAudioSession sharedInstance] category]; |
| 63 return StdStringFromNSString(category); |
| 64 } |
| 65 |
| 60 std::string GetSystemName() { | 66 std::string GetSystemName() { |
| 61 NSString* osName = [[UIDevice currentDevice] systemName]; | 67 NSString* osName = [[UIDevice currentDevice] systemName]; |
| 62 return StdStringFromNSString(osName); | 68 return StdStringFromNSString(osName); |
| 63 } | 69 } |
| 64 | 70 |
| 65 std::string GetSystemVersion() { | 71 std::string GetSystemVersion() { |
| 66 NSString* osVersion = [[UIDevice currentDevice] systemVersion]; | 72 NSString* osVersion = [[UIDevice currentDevice] systemVersion]; |
| 67 return StdStringFromNSString(osVersion); | 73 return StdStringFromNSString(osVersion); |
| 68 } | 74 } |
| 69 | 75 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 if (!raw_name.compare("iPhone5,4")) | 111 if (!raw_name.compare("iPhone5,4")) |
| 106 return std::string("iPhone 5c (GSM+CDMA)"); | 112 return std::string("iPhone 5c (GSM+CDMA)"); |
| 107 if (!raw_name.compare("iPhone6,1")) | 113 if (!raw_name.compare("iPhone6,1")) |
| 108 return std::string("iPhone 5s (GSM)"); | 114 return std::string("iPhone 5s (GSM)"); |
| 109 if (!raw_name.compare("iPhone6,2")) | 115 if (!raw_name.compare("iPhone6,2")) |
| 110 return std::string("iPhone 5s (GSM+CDMA)"); | 116 return std::string("iPhone 5s (GSM+CDMA)"); |
| 111 if (!raw_name.compare("iPhone7,1")) | 117 if (!raw_name.compare("iPhone7,1")) |
| 112 return std::string("iPhone 6 Plus"); | 118 return std::string("iPhone 6 Plus"); |
| 113 if (!raw_name.compare("iPhone7,2")) | 119 if (!raw_name.compare("iPhone7,2")) |
| 114 return std::string("iPhone 6"); | 120 return std::string("iPhone 6"); |
| 121 if (!raw_name.compare("iPhone8,1")) |
| 122 return std::string("iPhone 6s"); |
| 123 if (!raw_name.compare("iPhone8,2")) |
| 124 return std::string("iPhone 6s Plus"); |
| 115 if (!raw_name.compare("iPod1,1")) | 125 if (!raw_name.compare("iPod1,1")) |
| 116 return std::string("iPod Touch 1G"); | 126 return std::string("iPod Touch 1G"); |
| 117 if (!raw_name.compare("iPod2,1")) | 127 if (!raw_name.compare("iPod2,1")) |
| 118 return std::string("iPod Touch 2G"); | 128 return std::string("iPod Touch 2G"); |
| 119 if (!raw_name.compare("iPod3,1")) | 129 if (!raw_name.compare("iPod3,1")) |
| 120 return std::string("iPod Touch 3G"); | 130 return std::string("iPod Touch 3G"); |
| 121 if (!raw_name.compare("iPod4,1")) | 131 if (!raw_name.compare("iPod4,1")) |
| 122 return std::string("iPod Touch 4G"); | 132 return std::string("iPod Touch 4G"); |
| 123 if (!raw_name.compare("iPod5,1")) | 133 if (!raw_name.compare("iPod5,1")) |
| 124 return std::string("iPod Touch 5G"); | 134 return std::string("iPod Touch 5G"); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 155 if (!raw_name.compare("iPad4,2")) | 165 if (!raw_name.compare("iPad4,2")) |
| 156 return std::string("iPad Air (Cellular)"); | 166 return std::string("iPad Air (Cellular)"); |
| 157 if (!raw_name.compare("iPad4,4")) | 167 if (!raw_name.compare("iPad4,4")) |
| 158 return std::string("iPad mini 2G (WiFi)"); | 168 return std::string("iPad mini 2G (WiFi)"); |
| 159 if (!raw_name.compare("iPad4,5")) | 169 if (!raw_name.compare("iPad4,5")) |
| 160 return std::string("iPad mini 2G (Cellular)"); | 170 return std::string("iPad mini 2G (Cellular)"); |
| 161 if (!raw_name.compare("i386")) | 171 if (!raw_name.compare("i386")) |
| 162 return std::string("Simulator"); | 172 return std::string("Simulator"); |
| 163 if (!raw_name.compare("x86_64")) | 173 if (!raw_name.compare("x86_64")) |
| 164 return std::string("Simulator"); | 174 return std::string("Simulator"); |
| 165 LOG(LS_WARNING) << "Failed to find device name"; | 175 LOG(LS_WARNING) << "Failed to find device name (" << raw_name << ")"; |
| 166 return raw_name; | 176 return raw_name; |
| 167 } | 177 } |
| 168 | 178 |
| 169 } // namespace ios | 179 } // namespace ios |
| 170 } // namespace webrtc | 180 } // namespace webrtc |
| 171 | 181 |
| 172 #endif // defined(WEBRTC_IOS) | 182 #endif // defined(WEBRTC_IOS) |
| OLD | NEW |