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 <IOKit/IOCFPlugIn.h> | 7 #include <IOKit/IOCFPlugIn.h> |
8 #include <IOKit/usb/IOUSBLib.h> | 8 #include <IOKit/usb/IOUSBLib.h> |
9 #include <IOKit/usb/USBSpec.h> | 9 #include <IOKit/usb/USBSpec.h> |
10 | 10 |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 | 552 |
553 void VideoCaptureDeviceMac::ReceiveError(const std::string& reason) { | 553 void VideoCaptureDeviceMac::ReceiveError(const std::string& reason) { |
554 task_runner_->PostTask(FROM_HERE, | 554 task_runner_->PostTask(FROM_HERE, |
555 base::Bind(&VideoCaptureDeviceMac::SetErrorState, | 555 base::Bind(&VideoCaptureDeviceMac::SetErrorState, |
556 weak_factory_.GetWeakPtr(), | 556 weak_factory_.GetWeakPtr(), |
557 reason)); | 557 reason)); |
558 } | 558 } |
559 | 559 |
560 void VideoCaptureDeviceMac::SetErrorState(const std::string& reason) { | 560 void VideoCaptureDeviceMac::SetErrorState(const std::string& reason) { |
561 DCHECK(task_runner_->BelongsToCurrentThread()); | 561 DCHECK(task_runner_->BelongsToCurrentThread()); |
562 DLOG(ERROR) << reason; | |
563 state_ = kError; | 562 state_ = kError; |
564 client_->OnError(reason); | 563 client_->OnError(reason); |
565 } | 564 } |
566 | 565 |
567 void VideoCaptureDeviceMac::LogMessage(const std::string& message) { | 566 void VideoCaptureDeviceMac::LogMessage(const std::string& message) { |
568 DCHECK(task_runner_->BelongsToCurrentThread()); | 567 DCHECK(task_runner_->BelongsToCurrentThread()); |
569 if (client_) | 568 if (client_) |
570 client_->OnLog(message); | 569 client_->OnLog(message); |
571 } | 570 } |
572 | 571 |
573 bool VideoCaptureDeviceMac::UpdateCaptureResolution() { | 572 bool VideoCaptureDeviceMac::UpdateCaptureResolution() { |
574 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() | 573 if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height() |
575 width:capture_format_.frame_size.width() | 574 width:capture_format_.frame_size.width() |
576 frameRate:capture_format_.frame_rate]) { | 575 frameRate:capture_format_.frame_rate]) { |
577 ReceiveError("Could not configure capture device."); | 576 ReceiveError("Could not configure capture device."); |
578 return false; | 577 return false; |
579 } | 578 } |
580 return true; | 579 return true; |
581 } | 580 } |
582 | 581 |
583 } // namespace media | 582 } // namespace media |
OLD | NEW |