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/renderer/media/video_capture_impl.h" | 5 #include "content/renderer/media/video_capture_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "content/child/child_process.h" | 9 #include "content/child/child_process.h" |
10 #include "content/common/media/video_capture_messages.h" | 10 #include "content/common/media/video_capture_messages.h" |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 media::VideoFrame::I420, | 261 media::VideoFrame::I420, |
262 last_frame_format_.frame_size, | 262 last_frame_format_.frame_size, |
263 gfx::Rect(last_frame_format_.frame_size), | 263 gfx::Rect(last_frame_format_.frame_size), |
264 last_frame_format_.frame_size, | 264 last_frame_format_.frame_size, |
265 reinterpret_cast<uint8*>(buffer->buffer->memory()), | 265 reinterpret_cast<uint8*>(buffer->buffer->memory()), |
266 buffer->buffer_size, | 266 buffer->buffer_size, |
267 buffer->buffer->handle(), | 267 buffer->buffer->handle(), |
268 // TODO(sheu): convert VideoCaptureMessageFilter::Delegate to use | 268 // TODO(sheu): convert VideoCaptureMessageFilter::Delegate to use |
269 // base::TimeTicks instead of base::Time. http://crbug.com/249215 | 269 // base::TimeTicks instead of base::Time. http://crbug.com/249215 |
270 timestamp - base::Time::UnixEpoch(), | 270 timestamp - base::Time::UnixEpoch(), |
271 media::BindToLoop( | 271 media::BindToCurrentLoop(base::Bind( |
272 capture_message_loop_proxy_, | 272 &VideoCaptureImpl::DoClientBufferFinishedOnCaptureThread, |
273 base::Bind( | 273 weak_this_factory_.GetWeakPtr(), |
274 &VideoCaptureImpl::DoClientBufferFinishedOnCaptureThread, | 274 buffer_id, |
275 weak_this_factory_.GetWeakPtr(), | 275 buffer))); |
276 buffer_id, | |
277 buffer))); | |
278 | 276 |
279 for (ClientInfo::iterator it = clients_.begin(); it != clients_.end(); ++it) | 277 for (ClientInfo::iterator it = clients_.begin(); it != clients_.end(); ++it) |
280 it->first->OnFrameReady(this, frame); | 278 it->first->OnFrameReady(this, frame); |
281 } | 279 } |
282 | 280 |
283 void VideoCaptureImpl::DoClientBufferFinishedOnCaptureThread( | 281 void VideoCaptureImpl::DoClientBufferFinishedOnCaptureThread( |
284 int buffer_id, | 282 int buffer_id, |
285 const scoped_refptr<ClientBuffer>& buffer) { | 283 const scoped_refptr<ClientBuffer>& buffer) { |
286 DCHECK(capture_message_loop_proxy_->BelongsToCurrentThread()); | 284 DCHECK(capture_message_loop_proxy_->BelongsToCurrentThread()); |
287 Send(new VideoCaptureHostMsg_BufferReady(device_id_, buffer_id)); | 285 Send(new VideoCaptureHostMsg_BufferReady(device_id_, buffer_id)); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 if (it != clients->end()) { | 420 if (it != clients->end()) { |
423 handler->OnStopped(this); | 421 handler->OnStopped(this); |
424 handler->OnRemoved(this); | 422 handler->OnRemoved(this); |
425 clients->erase(it); | 423 clients->erase(it); |
426 found = true; | 424 found = true; |
427 } | 425 } |
428 return found; | 426 return found; |
429 } | 427 } |
430 | 428 |
431 } // namespace content | 429 } // namespace content |
OLD | NEW |