| Index: content/browser/renderer_host/media/video_capture_device_impl.cc
|
| diff --git a/content/browser/renderer_host/media/video_capture_device_impl.cc b/content/browser/renderer_host/media/video_capture_device_impl.cc
|
| index 045eda6092d0608c640ccf57bb4d4b9489356617..8c6267436c9fb0aae2701f37eec21f2b3ddec8d3 100644
|
| --- a/content/browser/renderer_host/media/video_capture_device_impl.cc
|
| +++ b/content/browser/renderer_host/media/video_capture_device_impl.cc
|
| @@ -155,10 +155,10 @@ void ThreadSafeCaptureOracle::Stop() {
|
| client_.reset();
|
| }
|
|
|
| -void ThreadSafeCaptureOracle::ReportError() {
|
| +void ThreadSafeCaptureOracle::ReportError(const std::string& reason) {
|
| base::AutoLock guard(lock_);
|
| if (client_)
|
| - client_->OnError();
|
| + client_->OnError(reason);
|
| }
|
|
|
| void ThreadSafeCaptureOracle::DidCaptureFrame(
|
| @@ -190,22 +190,25 @@ void VideoCaptureDeviceImpl::AllocateAndStart(
|
| scoped_ptr<media::VideoCaptureDevice::Client> client) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| + std::stringstream error_msg;
|
| if (state_ != kIdle) {
|
| DVLOG(1) << "Allocate() invoked when not in state Idle.";
|
| return;
|
| }
|
|
|
| if (params.requested_format.frame_rate <= 0) {
|
| - DVLOG(1) << "invalid frame_rate: " << params.requested_format.frame_rate;
|
| - client->OnError();
|
| + error_msg << "invalid frame_rate: " << params.requested_format.frame_rate;
|
| + DVLOG(1) << error_msg;
|
| + client->OnError(error_msg.str());
|
| return;
|
| }
|
|
|
| if (params.requested_format.frame_size.width() < kMinFrameWidth ||
|
| params.requested_format.frame_size.height() < kMinFrameHeight) {
|
| - DVLOG(1) << "invalid frame size: "
|
| + error_msg << "invalid frame size: "
|
| << params.requested_format.frame_size.ToString();
|
| - client->OnError();
|
| + DVLOG(1) << error_msg;
|
| + client->OnError(error_msg.str());
|
| return;
|
| }
|
|
|
| @@ -252,8 +255,9 @@ void VideoCaptureDeviceImpl::StopAndDeAllocate() {
|
| void VideoCaptureDeviceImpl::CaptureStarted(bool success) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| if (!success) {
|
| - DVLOG(1) << "Failed to start capture machine.";
|
| - Error();
|
| + std::stringstream reason("Failed to start capture machine.");
|
| + DVLOG(1) << reason;
|
| + Error(reason.str());
|
| }
|
| }
|
|
|
| @@ -291,14 +295,14 @@ void VideoCaptureDeviceImpl::TransitionStateTo(State next_state) {
|
| state_ = next_state;
|
| }
|
|
|
| -void VideoCaptureDeviceImpl::Error() {
|
| +void VideoCaptureDeviceImpl::Error(const std::string& reason) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| if (state_ == kIdle)
|
| return;
|
|
|
| if (oracle_proxy_)
|
| - oracle_proxy_->ReportError();
|
| + oracle_proxy_->ReportError(reason);
|
|
|
| StopAndDeAllocate();
|
| TransitionStateTo(kError);
|
|
|