| 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_host.h" | 5 #include "content/browser/renderer_host/media/video_capture_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/browser/browser_main_loop.h" | 9 #include "content/browser/browser_main_loop.h" |
| 10 #include "content/browser/renderer_host/media/media_stream_manager.h" | 10 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 BrowserThread::PostTask( | 70 BrowserThread::PostTask( |
| 71 BrowserThread::IO, FROM_HERE, | 71 BrowserThread::IO, FROM_HERE, |
| 72 base::Bind(&VideoCaptureHost::DoSendFreeBufferOnIOThread, | 72 base::Bind(&VideoCaptureHost::DoSendFreeBufferOnIOThread, |
| 73 this, controller_id, buffer_id)); | 73 this, controller_id, buffer_id)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void VideoCaptureHost::OnBufferReady( | 76 void VideoCaptureHost::OnBufferReady( |
| 77 const VideoCaptureControllerID& controller_id, | 77 const VideoCaptureControllerID& controller_id, |
| 78 int buffer_id, | 78 int buffer_id, |
| 79 const media::VideoCaptureFormat& frame_format, | 79 const media::VideoCaptureFormat& frame_format, |
| 80 const gfx::Rect& visible_rect, |
| 80 base::TimeTicks timestamp) { | 81 base::TimeTicks timestamp) { |
| 81 BrowserThread::PostTask( | 82 BrowserThread::PostTask( |
| 82 BrowserThread::IO, | 83 BrowserThread::IO, |
| 83 FROM_HERE, | 84 FROM_HERE, |
| 84 base::Bind(&VideoCaptureHost::DoSendFilledBufferOnIOThread, | 85 base::Bind(&VideoCaptureHost::DoSendFilledBufferOnIOThread, |
| 85 this, | 86 this, |
| 86 controller_id, | 87 controller_id, |
| 87 buffer_id, | 88 buffer_id, |
| 88 frame_format, | 89 frame_format, |
| 90 visible_rect, |
| 89 timestamp)); | 91 timestamp)); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void VideoCaptureHost::OnMailboxBufferReady( | 94 void VideoCaptureHost::OnMailboxBufferReady( |
| 93 const VideoCaptureControllerID& controller_id, | 95 const VideoCaptureControllerID& controller_id, |
| 94 int buffer_id, | 96 int buffer_id, |
| 95 const gpu::MailboxHolder& mailbox_holder, | 97 const gpu::MailboxHolder& mailbox_holder, |
| 96 const media::VideoCaptureFormat& frame_format, | 98 const media::VideoCaptureFormat& frame_format, |
| 97 base::TimeTicks timestamp) { | 99 base::TimeTicks timestamp) { |
| 98 BrowserThread::PostTask( | 100 BrowserThread::PostTask( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 if (entries_.find(controller_id) == entries_.end()) | 138 if (entries_.find(controller_id) == entries_.end()) |
| 137 return; | 139 return; |
| 138 | 140 |
| 139 Send(new VideoCaptureMsg_FreeBuffer(controller_id.device_id, buffer_id)); | 141 Send(new VideoCaptureMsg_FreeBuffer(controller_id.device_id, buffer_id)); |
| 140 } | 142 } |
| 141 | 143 |
| 142 void VideoCaptureHost::DoSendFilledBufferOnIOThread( | 144 void VideoCaptureHost::DoSendFilledBufferOnIOThread( |
| 143 const VideoCaptureControllerID& controller_id, | 145 const VideoCaptureControllerID& controller_id, |
| 144 int buffer_id, | 146 int buffer_id, |
| 145 const media::VideoCaptureFormat& format, | 147 const media::VideoCaptureFormat& format, |
| 148 const gfx::Rect& visible_rect, |
| 146 base::TimeTicks timestamp) { | 149 base::TimeTicks timestamp) { |
| 147 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 150 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 148 | 151 |
| 149 if (entries_.find(controller_id) == entries_.end()) | 152 if (entries_.find(controller_id) == entries_.end()) |
| 150 return; | 153 return; |
| 151 | 154 |
| 152 Send(new VideoCaptureMsg_BufferReady( | 155 Send(new VideoCaptureMsg_BufferReady( |
| 153 controller_id.device_id, buffer_id, format, timestamp)); | 156 controller_id.device_id, buffer_id, format, visible_rect, timestamp)); |
| 154 } | 157 } |
| 155 | 158 |
| 156 void VideoCaptureHost::DoSendFilledMailboxBufferOnIOThread( | 159 void VideoCaptureHost::DoSendFilledMailboxBufferOnIOThread( |
| 157 const VideoCaptureControllerID& controller_id, | 160 const VideoCaptureControllerID& controller_id, |
| 158 int buffer_id, | 161 int buffer_id, |
| 159 const gpu::MailboxHolder& mailbox_holder, | 162 const gpu::MailboxHolder& mailbox_holder, |
| 160 const media::VideoCaptureFormat& format, | 163 const media::VideoCaptureFormat& format, |
| 161 base::TimeTicks timestamp) { | 164 base::TimeTicks timestamp) { |
| 162 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 165 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 163 | 166 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 return; | 354 return; |
| 352 | 355 |
| 353 if (it->second) { | 356 if (it->second) { |
| 354 media_stream_manager_->video_capture_manager()->StopCaptureForClient( | 357 media_stream_manager_->video_capture_manager()->StopCaptureForClient( |
| 355 it->second.get(), controller_id, this, on_error); | 358 it->second.get(), controller_id, this, on_error); |
| 356 } | 359 } |
| 357 entries_.erase(it); | 360 entries_.erase(it); |
| 358 } | 361 } |
| 359 | 362 |
| 360 } // namespace content | 363 } // namespace content |
| OLD | NEW |