| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/video/capture/mac/video_capture_device_mac.h" | 5 #include "media/video/capture/mac/video_capture_device_mac.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 if (state_ != kIdle) { | 182 if (state_ != kIdle) { |
| 183 return; | 183 return; |
| 184 } | 184 } |
| 185 int width = params.requested_format.frame_size.width(); | 185 int width = params.requested_format.frame_size.width(); |
| 186 int height = params.requested_format.frame_size.height(); | 186 int height = params.requested_format.frame_size.height(); |
| 187 int frame_rate = params.requested_format.frame_rate; | 187 int frame_rate = params.requested_format.frame_rate; |
| 188 | 188 |
| 189 // QTKit API can scale captured frame to any size requested, which would lead | 189 // QTKit API can scale captured frame to any size requested, which would lead |
| 190 // to undesired aspect ratio changes. Try to open the camera with a known | 190 // to undesired aspect ratio changes. Try to open the camera with a known |
| 191 // supported format and let the client crop/pad the captured frames. | 191 // supported format and let the client crop/pad the captured frames. |
| 192 GetBestMatchSupportedResolution(&width, &height); | 192 if (!AVFoundationGlue::IsAVFoundationSupported()) |
| 193 GetBestMatchSupportedResolution(&width, &height); |
| 193 | 194 |
| 194 client_ = client.Pass(); | 195 client_ = client.Pass(); |
| 195 NSString* deviceId = | 196 NSString* deviceId = |
| 196 [NSString stringWithUTF8String:device_name_.id().c_str()]; | 197 [NSString stringWithUTF8String:device_name_.id().c_str()]; |
| 197 | 198 |
| 198 [capture_device_ setFrameReceiver:this]; | 199 [capture_device_ setFrameReceiver:this]; |
| 199 | 200 |
| 200 if (![capture_device_ setCaptureDevice:deviceId]) { | 201 if (![capture_device_ setCaptureDevice:deviceId]) { |
| 201 SetErrorState("Could not open capture device."); | 202 SetErrorState("Could not open capture device."); |
| 202 return; | 203 return; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() | 376 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() |
| 376 width:capture_format_.frame_size.width() | 377 width:capture_format_.frame_size.width() |
| 377 frameRate:capture_format_.frame_rate]) { | 378 frameRate:capture_format_.frame_rate]) { |
| 378 ReceiveError("Could not configure capture device."); | 379 ReceiveError("Could not configure capture device."); |
| 379 return false; | 380 return false; |
| 380 } | 381 } |
| 381 return true; | 382 return true; |
| 382 } | 383 } |
| 383 | 384 |
| 384 } // namespace media | 385 } // namespace media |
| OLD | NEW |