Chromium Code Reviews| 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 "content/browser/renderer_host/media/video_capture_controller.h" | 5 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 int length, | 114 int length, |
| 115 base::TimeTicks timestamp, | 115 base::TimeTicks timestamp, |
| 116 int rotation, | 116 int rotation, |
| 117 const VideoCaptureFormat& frame_format) | 117 const VideoCaptureFormat& frame_format) |
| 118 OVERRIDE; | 118 OVERRIDE; |
| 119 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, | 119 virtual void OnIncomingCapturedBuffer(const scoped_refptr<Buffer>& buffer, |
| 120 media::VideoFrame::Format format, | 120 media::VideoFrame::Format format, |
| 121 const gfx::Size& dimensions, | 121 const gfx::Size& dimensions, |
| 122 base::TimeTicks timestamp, | 122 base::TimeTicks timestamp, |
| 123 int frame_rate) OVERRIDE; | 123 int frame_rate) OVERRIDE; |
| 124 virtual void OnError() OVERRIDE; | 124 virtual void OnError(const std::string& reason) OVERRIDE; |
| 125 | 125 |
| 126 private: | 126 private: |
| 127 scoped_refptr<Buffer> DoReserveOutputBuffer(media::VideoFrame::Format format, | 127 scoped_refptr<Buffer> DoReserveOutputBuffer(media::VideoFrame::Format format, |
| 128 const gfx::Size& dimensions); | 128 const gfx::Size& dimensions); |
| 129 | 129 |
| 130 // The controller to which we post events. | 130 // The controller to which we post events. |
| 131 const base::WeakPtr<VideoCaptureController> controller_; | 131 const base::WeakPtr<VideoCaptureController> controller_; |
| 132 | 132 |
| 133 // The pool of shared-memory buffers used for capturing. | 133 // The pool of shared-memory buffers used for capturing. |
| 134 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; | 134 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 FROM_HERE, | 421 FROM_HERE, |
| 422 base::Bind( | 422 base::Bind( |
| 423 &VideoCaptureController::DoIncomingCapturedI420BufferOnIOThread, | 423 &VideoCaptureController::DoIncomingCapturedI420BufferOnIOThread, |
| 424 controller_, | 424 controller_, |
| 425 buffer, | 425 buffer, |
| 426 dimensions, | 426 dimensions, |
| 427 frame_rate, | 427 frame_rate, |
| 428 timestamp)); | 428 timestamp)); |
| 429 } | 429 } |
| 430 | 430 |
| 431 void VideoCaptureController::VideoCaptureDeviceClient::OnError() { | 431 void VideoCaptureController::VideoCaptureDeviceClient::OnError( |
| 432 const std::string& reason) { | |
| 433 MediaStreamManager::AddLogMessage("Error on video capture: " + reason); | |
|
perkj_chrome
2014/01/22 10:03:29
I think you should add an identifier - the session
vrk (LEFT CHROMIUM)
2014/01/22 18:30:30
I'm not sure if it's worth doing this. Here's my r
vrk (LEFT CHROMIUM)
2014/01/23 21:46:32
Talked offline. I looked into this, and I don't th
| |
| 432 BrowserThread::PostTask(BrowserThread::IO, | 434 BrowserThread::PostTask(BrowserThread::IO, |
| 433 FROM_HERE, | 435 FROM_HERE, |
| 434 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); | 436 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); |
| 435 } | 437 } |
| 436 | 438 |
| 437 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> | 439 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> |
| 438 VideoCaptureController::VideoCaptureDeviceClient::DoReserveOutputBuffer( | 440 VideoCaptureController::VideoCaptureDeviceClient::DoReserveOutputBuffer( |
| 439 media::VideoFrame::Format format, | 441 media::VideoFrame::Format format, |
| 440 const gfx::Size& dimensions) { | 442 const gfx::Size& dimensions) { |
| 441 // The capture pipeline expects I420 for now. | 443 // The capture pipeline expects I420 for now. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 } | 572 } |
| 571 return NULL; | 573 return NULL; |
| 572 } | 574 } |
| 573 | 575 |
| 574 int VideoCaptureController::GetClientCount() { | 576 int VideoCaptureController::GetClientCount() { |
| 575 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 577 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 576 return controller_clients_.size(); | 578 return controller_clients_.size(); |
| 577 } | 579 } |
| 578 | 580 |
| 579 } // namespace content | 581 } // namespace content |
| OLD | NEW |