| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 private: | 55 private: |
| 56 virtual ~PoolBuffer() { pool_->RelinquishProducerReservation(id()); } | 56 virtual ~PoolBuffer() { pool_->RelinquishProducerReservation(id()); } |
| 57 | 57 |
| 58 const scoped_refptr<VideoCaptureBufferPool> pool_; | 58 const scoped_refptr<VideoCaptureBufferPool> pool_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 class SyncPointClientImpl : public media::VideoFrame::SyncPointClient { | 61 class SyncPointClientImpl : public media::VideoFrame::SyncPointClient { |
| 62 public: | 62 public: |
| 63 explicit SyncPointClientImpl(GLHelper* gl_helper) : gl_helper_(gl_helper) {} | 63 explicit SyncPointClientImpl(GLHelper* gl_helper) : gl_helper_(gl_helper) {} |
| 64 virtual ~SyncPointClientImpl() {} | 64 virtual ~SyncPointClientImpl() {} |
| 65 virtual uint32 InsertSyncPoint() OVERRIDE { | 65 virtual uint32 InsertSyncPoint() override { |
| 66 return gl_helper_->InsertSyncPoint(); | 66 return gl_helper_->InsertSyncPoint(); |
| 67 } | 67 } |
| 68 virtual void WaitSyncPoint(uint32 sync_point) OVERRIDE { | 68 virtual void WaitSyncPoint(uint32 sync_point) override { |
| 69 gl_helper_->WaitSyncPoint(sync_point); | 69 gl_helper_->WaitSyncPoint(sync_point); |
| 70 } | 70 } |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 GLHelper* gl_helper_; | 73 GLHelper* gl_helper_; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 void ReturnVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, | 76 void ReturnVideoFrame(const scoped_refptr<media::VideoFrame>& video_frame, |
| 77 uint32 sync_point) { | 77 uint32 sync_point) { |
| 78 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 78 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 : public media::VideoCaptureDevice::Client { | 154 : public media::VideoCaptureDevice::Client { |
| 155 public: | 155 public: |
| 156 explicit VideoCaptureDeviceClient( | 156 explicit VideoCaptureDeviceClient( |
| 157 const base::WeakPtr<VideoCaptureController>& controller, | 157 const base::WeakPtr<VideoCaptureController>& controller, |
| 158 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool); | 158 const scoped_refptr<VideoCaptureBufferPool>& buffer_pool); |
| 159 virtual ~VideoCaptureDeviceClient(); | 159 virtual ~VideoCaptureDeviceClient(); |
| 160 | 160 |
| 161 // VideoCaptureDevice::Client implementation. | 161 // VideoCaptureDevice::Client implementation. |
| 162 virtual scoped_refptr<Buffer> ReserveOutputBuffer( | 162 virtual scoped_refptr<Buffer> ReserveOutputBuffer( |
| 163 media::VideoFrame::Format format, | 163 media::VideoFrame::Format format, |
| 164 const gfx::Size& size) OVERRIDE; | 164 const gfx::Size& size) override; |
| 165 virtual void OnIncomingCapturedData(const uint8* data, | 165 virtual void OnIncomingCapturedData(const uint8* data, |
| 166 int length, | 166 int length, |
| 167 const VideoCaptureFormat& frame_format, | 167 const VideoCaptureFormat& frame_format, |
| 168 int rotation, | 168 int rotation, |
| 169 base::TimeTicks timestamp) OVERRIDE; | 169 base::TimeTicks timestamp) override; |
| 170 virtual void OnIncomingCapturedVideoFrame( | 170 virtual void OnIncomingCapturedVideoFrame( |
| 171 const scoped_refptr<Buffer>& buffer, | 171 const scoped_refptr<Buffer>& buffer, |
| 172 const VideoCaptureFormat& buffer_format, | 172 const VideoCaptureFormat& buffer_format, |
| 173 const scoped_refptr<media::VideoFrame>& frame, | 173 const scoped_refptr<media::VideoFrame>& frame, |
| 174 base::TimeTicks timestamp) OVERRIDE; | 174 base::TimeTicks timestamp) override; |
| 175 virtual void OnError(const std::string& reason) OVERRIDE; | 175 virtual void OnError(const std::string& reason) override; |
| 176 virtual void OnLog(const std::string& message) OVERRIDE; | 176 virtual void OnLog(const std::string& message) override; |
| 177 | 177 |
| 178 private: | 178 private: |
| 179 scoped_refptr<Buffer> DoReserveOutputBuffer(media::VideoFrame::Format format, | 179 scoped_refptr<Buffer> DoReserveOutputBuffer(media::VideoFrame::Format format, |
| 180 const gfx::Size& dimensions); | 180 const gfx::Size& dimensions); |
| 181 | 181 |
| 182 // The controller to which we post events. | 182 // The controller to which we post events. |
| 183 const base::WeakPtr<VideoCaptureController> controller_; | 183 const base::WeakPtr<VideoCaptureController> controller_; |
| 184 | 184 |
| 185 // The pool of shared-memory buffers used for capturing. | 185 // The pool of shared-memory buffers used for capturing. |
| 186 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; | 186 const scoped_refptr<VideoCaptureBufferPool> buffer_pool_; |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 714 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 715 int active_client_count = 0; | 715 int active_client_count = 0; |
| 716 for (ControllerClient* client : controller_clients_) { | 716 for (ControllerClient* client : controller_clients_) { |
| 717 if (!client->paused) | 717 if (!client->paused) |
| 718 ++active_client_count; | 718 ++active_client_count; |
| 719 } | 719 } |
| 720 return active_client_count; | 720 return active_client_count; |
| 721 } | 721 } |
| 722 | 722 |
| 723 } // namespace content | 723 } // namespace content |
| OLD | NEW |