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