OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 <assert.h> | 11 #include <assert.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 | 13 |
14 #include "webrtc/modules/video_capture/device_info_impl.h" | 14 #include "webrtc/modules/video_capture/device_info_impl.h" |
15 #include "webrtc/modules/video_capture/video_capture_config.h" | 15 #include "webrtc/modules/video_capture/video_capture_config.h" |
16 #include "webrtc/system_wrappers/include/logging.h" | |
17 | 16 |
18 #ifndef abs | 17 #ifndef abs |
19 #define abs(a) (a>=0?a:-a) | 18 #define abs(a) (a>=0?a:-a) |
20 #endif | 19 #endif |
21 | 20 |
22 namespace webrtc | 21 namespace webrtc |
23 { | 22 { |
24 namespace videocapturemodule | 23 namespace videocapturemodule |
25 { | 24 { |
26 DeviceInfoImpl::DeviceInfoImpl() | 25 DeviceInfoImpl::DeviceInfoImpl() |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 _apiLock.AcquireLockShared(); | 99 _apiLock.AcquireLockShared(); |
101 return -1; | 100 return -1; |
102 } | 101 } |
103 _apiLock.ReleaseLockExclusive(); | 102 _apiLock.ReleaseLockExclusive(); |
104 _apiLock.AcquireLockShared(); | 103 _apiLock.AcquireLockShared(); |
105 } | 104 } |
106 | 105 |
107 // Make sure the number is valid | 106 // Make sure the number is valid |
108 if (deviceCapabilityNumber >= (unsigned int) _captureCapabilities.size()) | 107 if (deviceCapabilityNumber >= (unsigned int) _captureCapabilities.size()) |
109 { | 108 { |
110 LOG(LS_ERROR) << "Invalid deviceCapabilityNumber " | |
111 << deviceCapabilityNumber << ">= number of capabilities (" | |
112 << _captureCapabilities.size() << ")."; | |
113 return -1; | 109 return -1; |
114 } | 110 } |
115 | 111 |
116 capability = _captureCapabilities[deviceCapabilityNumber]; | 112 capability = _captureCapabilities[deviceCapabilityNumber]; |
117 return 0; | 113 return 0; |
118 } | 114 } |
119 | 115 |
120 int32_t DeviceInfoImpl::GetBestMatchedCapability( | 116 int32_t DeviceInfoImpl::GetBestMatchedCapability( |
121 const char*deviceUniqueIdUTF8, | 117 const char*deviceUniqueIdUTF8, |
122 const VideoCaptureCapability& requested, | 118 const VideoCaptureCapability& requested, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 { | 231 { |
236 bestWidth = capability.width; | 232 bestWidth = capability.width; |
237 bestHeight = capability.height; | 233 bestHeight = capability.height; |
238 bestFrameRate = capability.maxFPS; | 234 bestFrameRate = capability.maxFPS; |
239 bestRawType = capability.rawType; | 235 bestRawType = capability.rawType; |
240 bestformatIndex = tmp; | 236 bestformatIndex = tmp; |
241 } | 237 } |
242 }// else height not good | 238 }// else height not good |
243 }//end for | 239 }//end for |
244 | 240 |
245 LOG(LS_VERBOSE) << "Best camera format: " << bestWidth << "x" << bestHeight | |
246 << "@" << bestFrameRate | |
247 << "fps, color format: " << bestRawType; | |
248 | |
249 // Copy the capability | 241 // Copy the capability |
250 if (bestformatIndex < 0) | 242 if (bestformatIndex < 0) |
251 return -1; | 243 return -1; |
252 resulting = _captureCapabilities[bestformatIndex]; | 244 resulting = _captureCapabilities[bestformatIndex]; |
253 return bestformatIndex; | 245 return bestformatIndex; |
254 } | 246 } |
255 | 247 |
256 //Default implementation. This should be overridden by Mobile implementations. | 248 //Default implementation. This should be overridden by Mobile implementations. |
257 int32_t DeviceInfoImpl::GetOrientation(const char* deviceUniqueIdUTF8, | 249 int32_t DeviceInfoImpl::GetOrientation(const char* deviceUniqueIdUTF8, |
258 VideoRotation& orientation) { | 250 VideoRotation& orientation) { |
259 orientation = kVideoRotation_0; | 251 orientation = kVideoRotation_0; |
260 return -1; | 252 return -1; |
261 } | 253 } |
262 } // namespace videocapturemodule | 254 } // namespace videocapturemodule |
263 } // namespace webrtc | 255 } // namespace webrtc |
OLD | NEW |