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

Unified Diff: webrtc/modules/video_capture/objc/device_info.mm

Issue 2375273004: Reland of Unify the macOS and iOS capturer implementations (Closed)
Patch Set: fix gyp build Created 4 years, 3 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
Index: webrtc/modules/video_capture/objc/device_info.mm
diff --git a/webrtc/modules/video_capture/ios/device_info_ios.mm b/webrtc/modules/video_capture/objc/device_info.mm
similarity index 81%
rename from webrtc/modules/video_capture/ios/device_info_ios.mm
rename to webrtc/modules/video_capture/objc/device_info.mm
index 307e5d3605a8c343fc1b0ebed3870e9fa3efe8eb..2535f1c69e32cb6b661dcaedf470792cd8246784 100644
--- a/webrtc/modules/video_capture/ios/device_info_ios.mm
+++ b/webrtc/modules/video_capture/objc/device_info.mm
@@ -16,26 +16,22 @@
#include <string>
-#include "webrtc/modules/video_capture/ios/device_info_ios.h"
-#include "webrtc/modules/video_capture/ios/device_info_ios_objc.h"
+#include "webrtc/modules/video_capture/objc/device_info.h"
+#include "webrtc/modules/video_capture/objc/device_info_objc.h"
#include "webrtc/modules/video_capture/video_capture_impl.h"
#include "webrtc/system_wrappers/include/trace.h"
using namespace webrtc;
using namespace videocapturemodule;
-static NSArray *camera_presets = @[AVCaptureSessionPreset352x288,
- AVCaptureSessionPreset640x480,
- AVCaptureSessionPreset1280x720,
- AVCaptureSessionPreset1920x1080];
+static NSArray* camera_presets = @[
+ AVCaptureSessionPreset352x288, AVCaptureSessionPreset640x480,
+ AVCaptureSessionPreset1280x720
+];
-
-#define IOS_UNSUPPORTED() \
- WEBRTC_TRACE(kTraceError, \
- kTraceVideoCapture, \
- _id, \
- "%s is not supported on the iOS platform.", \
- __FUNCTION__); \
+#define IOS_UNSUPPORTED() \
+ WEBRTC_TRACE(kTraceError, kTraceVideoCapture, _id, \
+ "%s is not supported on the iOS platform.", __FUNCTION__); \
return -1;
VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo(
@@ -56,10 +52,10 @@ int32_t DeviceInfoIos::Init() {
int deviceCount = [DeviceInfoIosObjC captureDeviceCount];
for (int i = 0; i < deviceCount; i++) {
- AVCaptureDevice *avDevice = [DeviceInfoIosObjC captureDeviceForIndex:i];
+ AVCaptureDevice* avDevice = [DeviceInfoIosObjC captureDeviceForIndex:i];
VideoCaptureCapabilities capabilityVector;
- for (NSString *preset in camera_presets) {
+ for (NSString* preset in camera_presets) {
BOOL support = [avDevice supportsAVCaptureSessionPreset:preset];
if (support) {
VideoCaptureCapability capability =
@@ -73,8 +69,8 @@ int32_t DeviceInfoIos::Init() {
this->GetDeviceName(i, deviceNameUTF8, 256, deviceId, 256);
std::string deviceIdCopy(deviceId);
std::pair<std::string, VideoCaptureCapabilities> mapPair =
- std::pair<std::string, VideoCaptureCapabilities>
- (deviceIdCopy, capabilityVector);
+ std::pair<std::string, VideoCaptureCapabilities>(deviceIdCopy,
+ capabilityVector);
_capabilitiesMap.insert(mapPair);
}
@@ -100,9 +96,7 @@ int32_t DeviceInfoIos::GetDeviceName(uint32_t deviceNumber,
strncpy(deviceNameUTF8, [deviceName UTF8String], deviceNameUTF8Length);
deviceNameUTF8[deviceNameUTF8Length - 1] = '\0';
- strncpy(deviceUniqueIdUTF8,
- [deviceUniqueId UTF8String],
- deviceUniqueIdUTF8Length);
+ strncpy(deviceUniqueIdUTF8, deviceUniqueId.UTF8String, deviceUniqueIdUTF8Length);
deviceUniqueIdUTF8[deviceUniqueIdUTF8Length - 1] = '\0';
if (productUniqueIdUTF8) {
« no previous file with comments | « webrtc/modules/video_capture/objc/device_info.h ('k') | webrtc/modules/video_capture/objc/device_info_objc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698