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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 int length, | 124 int length, |
125 const VideoCaptureFormat& frame_format, | 125 const VideoCaptureFormat& frame_format, |
126 int rotation, | 126 int rotation, |
127 base::TimeTicks timestamp) OVERRIDE; | 127 base::TimeTicks timestamp) OVERRIDE; |
128 virtual void OnIncomingCapturedVideoFrame( | 128 virtual void OnIncomingCapturedVideoFrame( |
129 const scoped_refptr<Buffer>& buffer, | 129 const scoped_refptr<Buffer>& buffer, |
130 const VideoCaptureFormat& buffer_format, | 130 const VideoCaptureFormat& buffer_format, |
131 const scoped_refptr<media::VideoFrame>& frame, | 131 const scoped_refptr<media::VideoFrame>& frame, |
132 base::TimeTicks timestamp) OVERRIDE; | 132 base::TimeTicks timestamp) OVERRIDE; |
133 virtual void OnError(const std::string& reason) OVERRIDE; | 133 virtual void OnError(const std::string& reason) OVERRIDE; |
| 134 virtual void OnLog(const std::string& message) OVERRIDE; |
134 | 135 |
135 private: | 136 private: |
136 scoped_refptr<Buffer> DoReserveOutputBuffer(media::VideoFrame::Format format, | 137 scoped_refptr<Buffer> DoReserveOutputBuffer(media::VideoFrame::Format format, |
137 const gfx::Size& dimensions); | 138 const gfx::Size& dimensions); |
138 | 139 |
139 // The controller to which we post events. | 140 // The controller to which we post events. |
140 const base::WeakPtr<VideoCaptureController> controller_; | 141 const base::WeakPtr<VideoCaptureController> controller_; |
141 | 142 |
142 // The pool of shared-memory buffers used for capturing. | 143 // The pool of shared-memory buffers used for capturing. |
143 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; | 144 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 481 |
481 void VideoCaptureController::VideoCaptureDeviceClient::OnError( | 482 void VideoCaptureController::VideoCaptureDeviceClient::OnError( |
482 const std::string& reason) { | 483 const std::string& reason) { |
483 MediaStreamManager::SendMessageToNativeLog( | 484 MediaStreamManager::SendMessageToNativeLog( |
484 "Error on video capture: " + reason); | 485 "Error on video capture: " + reason); |
485 BrowserThread::PostTask(BrowserThread::IO, | 486 BrowserThread::PostTask(BrowserThread::IO, |
486 FROM_HERE, | 487 FROM_HERE, |
487 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); | 488 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); |
488 } | 489 } |
489 | 490 |
| 491 void VideoCaptureController::VideoCaptureDeviceClient::OnLog( |
| 492 const std::string& message) { |
| 493 MediaStreamManager::SendMessageToNativeLog("Video capture: " + message); |
| 494 } |
| 495 |
490 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> | 496 scoped_refptr<media::VideoCaptureDevice::Client::Buffer> |
491 VideoCaptureController::VideoCaptureDeviceClient::DoReserveOutputBuffer( | 497 VideoCaptureController::VideoCaptureDeviceClient::DoReserveOutputBuffer( |
492 media::VideoFrame::Format format, | 498 media::VideoFrame::Format format, |
493 const gfx::Size& dimensions) { | 499 const gfx::Size& dimensions) { |
494 size_t frame_bytes = 0; | 500 size_t frame_bytes = 0; |
495 if (format == media::VideoFrame::NATIVE_TEXTURE) { | 501 if (format == media::VideoFrame::NATIVE_TEXTURE) { |
496 DCHECK_EQ(dimensions.width(), 0); | 502 DCHECK_EQ(dimensions.width(), 0); |
497 DCHECK_EQ(dimensions.height(), 0); | 503 DCHECK_EQ(dimensions.height(), 0); |
498 } else { | 504 } else { |
499 // The capture pipeline expects I420 for now. | 505 // The capture pipeline expects I420 for now. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 } | 641 } |
636 return NULL; | 642 return NULL; |
637 } | 643 } |
638 | 644 |
639 int VideoCaptureController::GetClientCount() { | 645 int VideoCaptureController::GetClientCount() { |
640 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 646 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
641 return controller_clients_.size(); | 647 return controller_clients_.size(); |
642 } | 648 } |
643 | 649 |
644 } // namespace content | 650 } // namespace content |
OLD | NEW |