Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Unified Diff: webrtc/modules/utility/source/helpers_ios.mm

Issue 1723163002: Adds low complexity audio mode for single core CPUs (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/utility/include/helpers_ios.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/utility/source/helpers_ios.mm
diff --git a/webrtc/modules/utility/source/helpers_ios.mm b/webrtc/modules/utility/source/helpers_ios.mm
index 2d0ac098c1daeefd8cf86de8687bd9f4138b3de1..4b28cee3dc97e0f3afd132d95f121d35b6d27a32 100644
--- a/webrtc/modules/utility/source/helpers_ios.mm
+++ b/webrtc/modules/utility/source/helpers_ios.mm
@@ -23,6 +23,64 @@
namespace webrtc {
namespace ios {
+// Internal helper method used by GetDeviceName() to return device name.
+const char* LookUpRealName(const char* raw_name) {
+ // Lookup table which maps raw device names to real (human readable) names.
+ struct {
+ const char* raw_name;
+ const char* real_name;
+ } device_names[] = {
+ {"iPhone1,1", "iPhone 1G"},
+ {"iPhone1,2", "iPhone 3G"},
+ {"iPhone2,1", "iPhone 3GS"},
+ {"iPhone3,1", "iPhone 4"},
+ {"iPhone3,3", "Verizon iPhone 4"},
+ {"iPhone4,1", "iPhone 4S"},
+ {"iPhone5,1", "iPhone 5 (GSM)"},
+ {"iPhone5,2", "iPhone 5 (GSM+CDMA)"},
+ {"iPhone5,3", "iPhone 5c (GSM)"},
+ {"iPhone5,4", "iPhone 5c (GSM+CDMA)"},
+ {"iPhone6,1", "iPhone 5s (GSM)"},
+ {"iPhone6,2", "iPhone 5s (GSM+CDMA)"},
+ {"iPhone7,1", "iPhone 6 Plus"},
+ {"iPhone7,2", "iPhone 6"},
+ {"iPhone8,1", "iPhone 6s"},
+ {"iPhone8,2", "iPhone 6s Plus"},
+ {"iPod1,1", "iPod Touch 1G"},
+ {"iPod2,1", "iPod Touch 2G"},
+ {"iPod3,1", "iPod Touch 3G"},
+ {"iPod4,1", "iPod Touch 4G"},
+ {"iPod5,1", "iPod Touch 5G"},
+ {"iPad1,1", "iPad"},
+ {"iPad2,1", "iPad 2 (WiFi)"},
+ {"iPad2,2", "iPad 2 (GSM)"},
+ {"iPad2,3", "iPad 2 (CDMA)"},
+ {"iPad2,4", "iPad 2 (WiFi)"},
+ {"iPad2,5", "iPad Mini (WiFi)"},
+ {"iPad2,6", "iPad Mini (GSM)"},
+ {"iPad2,7", "iPad Mini (GSM+CDMA)"},
+ {"iPad3,1", "iPad 3 (WiFi)"},
+ {"iPad3,2", "iPad 3 (GSM+CDMA)"},
+ {"iPad3,3", "iPad 3 (GSM)"},
+ {"iPad3,4", "iPad 4 (WiFi)"},
+ {"iPad3,5", "iPad 4 (GSM)"},
+ {"iPad3,6", "iPad 4 (GSM+CDMA)"},
+ {"iPad4,1", "iPad Air (WiFi)"},
+ {"iPad4,2", "iPad Air (Cellular)"},
+ {"iPad4,4", "iPad mini 2G (WiFi)"},
+ {"iPad4,5", "iPad mini 2G (Cellular)"},
+ {"i386", "Simulator"},
+ {"x86_64", "Simulator"},
+ };
+
+ for (auto& d : device_names) {
+ if (strcmp(d.raw_name, raw_name) == 0)
+ return d.real_name;
+ }
+ LOG(LS_WARNING) << "Failed to find device name (" << raw_name << ")";
+ return "";
+}
+
// TODO(henrika): move to shared location.
// See https://code.google.com/p/webrtc/issues/detail?id=4773 for details.
NSString* NSStringFromStdString(const std::string& stdString) {
@@ -89,91 +147,30 @@ std::string GetDeviceName() {
rtc::scoped_ptr<char[]> machine;
machine.reset(new char[size]);
sysctlbyname("hw.machine", machine.get(), &size, NULL, 0);
- std::string raw_name(machine.get());
- if (!raw_name.compare("iPhone1,1"))
- return std::string("iPhone 1G");
- if (!raw_name.compare("iPhone1,2"))
- return std::string("iPhone 3G");
- if (!raw_name.compare("iPhone2,1"))
- return std::string("iPhone 3GS");
- if (!raw_name.compare("iPhone3,1"))
- return std::string("iPhone 4");
- if (!raw_name.compare("iPhone3,3"))
- return std::string("Verizon iPhone 4");
- if (!raw_name.compare("iPhone4,1"))
- return std::string("iPhone 4S");
- if (!raw_name.compare("iPhone5,1"))
- return std::string("iPhone 5 (GSM)");
- if (!raw_name.compare("iPhone5,2"))
- return std::string("iPhone 5 (GSM+CDMA)");
- if (!raw_name.compare("iPhone5,3"))
- return std::string("iPhone 5c (GSM)");
- if (!raw_name.compare("iPhone5,4"))
- return std::string("iPhone 5c (GSM+CDMA)");
- if (!raw_name.compare("iPhone6,1"))
- return std::string("iPhone 5s (GSM)");
- if (!raw_name.compare("iPhone6,2"))
- return std::string("iPhone 5s (GSM+CDMA)");
- if (!raw_name.compare("iPhone7,1"))
- return std::string("iPhone 6 Plus");
- if (!raw_name.compare("iPhone7,2"))
- return std::string("iPhone 6");
- if (!raw_name.compare("iPhone8,1"))
- return std::string("iPhone 6s");
- if (!raw_name.compare("iPhone8,2"))
- return std::string("iPhone 6s Plus");
- if (!raw_name.compare("iPod1,1"))
- return std::string("iPod Touch 1G");
- if (!raw_name.compare("iPod2,1"))
- return std::string("iPod Touch 2G");
- if (!raw_name.compare("iPod3,1"))
- return std::string("iPod Touch 3G");
- if (!raw_name.compare("iPod4,1"))
- return std::string("iPod Touch 4G");
- if (!raw_name.compare("iPod5,1"))
- return std::string("iPod Touch 5G");
- if (!raw_name.compare("iPad1,1"))
- return std::string("iPad");
- if (!raw_name.compare("iPad2,1"))
- return std::string("iPad 2 (WiFi)");
- if (!raw_name.compare("iPad2,2"))
- return std::string("iPad 2 (GSM)");
- if (!raw_name.compare("iPad2,3"))
- return std::string("iPad 2 (CDMA)");
- if (!raw_name.compare("iPad2,4"))
- return std::string("iPad 2 (WiFi)");
- if (!raw_name.compare("iPad2,5"))
- return std::string("iPad Mini (WiFi)");
- if (!raw_name.compare("iPad2,6"))
- return std::string("iPad Mini (GSM)");
- if (!raw_name.compare("iPad2,7"))
- return std::string("iPad Mini (GSM+CDMA)");
- if (!raw_name.compare("iPad3,1"))
- return std::string("iPad 3 (WiFi)");
- if (!raw_name.compare("iPad3,2"))
- return std::string("iPad 3 (GSM+CDMA)");
- if (!raw_name.compare("iPad3,3"))
- return std::string("iPad 3 (GSM)");
- if (!raw_name.compare("iPad3,4"))
- return std::string("iPad 4 (WiFi)");
- if (!raw_name.compare("iPad3,5"))
- return std::string("iPad 4 (GSM)");
- if (!raw_name.compare("iPad3,6"))
- return std::string("iPad 4 (GSM+CDMA)");
- if (!raw_name.compare("iPad4,1"))
- return std::string("iPad Air (WiFi)");
- if (!raw_name.compare("iPad4,2"))
- return std::string("iPad Air (Cellular)");
- if (!raw_name.compare("iPad4,4"))
- return std::string("iPad mini 2G (WiFi)");
- if (!raw_name.compare("iPad4,5"))
- return std::string("iPad mini 2G (Cellular)");
- if (!raw_name.compare("i386"))
- return std::string("Simulator");
- if (!raw_name.compare("x86_64"))
- return std::string("Simulator");
- LOG(LS_WARNING) << "Failed to find device name (" << raw_name << ")";
- return raw_name;
+ return std::string(LookUpRealName(machine.get()));
+}
+
+std::string GetProcessName() {
+ NSString* processName = [NSProcessInfo processInfo].processName;
tkchin_webrtc 2016/02/23 17:39:27 The conversion to std::string seems unneeded becau
henrika_webrtc 2016/02/24 11:52:47 Filed https://bugs.chromium.org/p/webrtc/issues/de
+ return StdStringFromNSString(processName);
+}
+
+int GetProcessID() {
+ return [NSProcessInfo processInfo].processIdentifier;
+}
+
+std::string GetOSVersionString() {
+ NSString* osVersion =
+ [NSProcessInfo processInfo].operatingSystemVersionString;
+ return StdStringFromNSString(osVersion);
+}
+
+int GetProcessorCount() {
+ return [NSProcessInfo processInfo].processorCount;
+}
+
+bool GetLowPowerModeEnabled() {
+ return [NSProcessInfo processInfo].lowPowerModeEnabled;
}
} // namespace ios
« no previous file with comments | « webrtc/modules/utility/include/helpers_ios.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698