| 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/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 | 301 |
| 302 DCHECK_EQ(capture_format_.frame_size.width(), | 302 DCHECK_EQ(capture_format_.frame_size.width(), |
| 303 frame_format.frame_size.width()); | 303 frame_format.frame_size.width()); |
| 304 DCHECK_EQ(capture_format_.frame_size.height(), | 304 DCHECK_EQ(capture_format_.frame_size.height(), |
| 305 frame_format.frame_size.height()); | 305 frame_format.frame_size.height()); |
| 306 | 306 |
| 307 client_->OnIncomingCapturedFrame(video_frame, | 307 client_->OnIncomingCapturedFrame(video_frame, |
| 308 video_frame_length, | 308 video_frame_length, |
| 309 base::Time::Now(), | 309 base::TimeTicks::Now(), |
| 310 0, | 310 0, |
| 311 capture_format_); | 311 capture_format_); |
| 312 } | 312 } |
| 313 | 313 |
| 314 void VideoCaptureDeviceMac::ReceiveError(const std::string& reason) { | 314 void VideoCaptureDeviceMac::ReceiveError(const std::string& reason) { |
| 315 loop_proxy_->PostTask(FROM_HERE, | 315 loop_proxy_->PostTask(FROM_HERE, |
| 316 base::Bind(&VideoCaptureDeviceMac::SetErrorState, weak_this_, | 316 base::Bind(&VideoCaptureDeviceMac::SetErrorState, weak_this_, |
| 317 reason)); | 317 reason)); |
| 318 } | 318 } |
| 319 | 319 |
| 320 void VideoCaptureDeviceMac::SetErrorState(const std::string& reason) { | 320 void VideoCaptureDeviceMac::SetErrorState(const std::string& reason) { |
| 321 DCHECK_EQ(loop_proxy_, base::MessageLoopProxy::current()); | 321 DCHECK_EQ(loop_proxy_, base::MessageLoopProxy::current()); |
| 322 DLOG(ERROR) << reason; | 322 DLOG(ERROR) << reason; |
| 323 state_ = kError; | 323 state_ = kError; |
| 324 client_->OnError(); | 324 client_->OnError(); |
| 325 } | 325 } |
| 326 | 326 |
| 327 bool VideoCaptureDeviceMac::UpdateCaptureResolution() { | 327 bool VideoCaptureDeviceMac::UpdateCaptureResolution() { |
| 328 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() | 328 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() |
| 329 width:capture_format_.frame_size.width() | 329 width:capture_format_.frame_size.width() |
| 330 frameRate:capture_format_.frame_rate]) { | 330 frameRate:capture_format_.frame_rate]) { |
| 331 ReceiveError("Could not configure capture device."); | 331 ReceiveError("Could not configure capture device."); |
| 332 return false; | 332 return false; |
| 333 } | 333 } |
| 334 return true; | 334 return true; |
| 335 } | 335 } |
| 336 | 336 |
| 337 } // namespace media | 337 } // namespace media |
| OLD | NEW |