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 // Notes about usage of this object by VideoCaptureImplManager. | 5 // Notes about usage of this object by VideoCaptureImplManager. |
6 // | 6 // |
7 // VideoCaptureImplManager access this object by using a Unretained() | 7 // VideoCaptureImplManager access this object by using a Unretained() |
8 // binding and tasks on the IO thread. It is then important that | 8 // binding and tasks on the IO thread. It is then important that |
9 // VideoCaptureImpl never post task to itself. All operations must be | 9 // VideoCaptureImpl never post task to itself. All operations must be |
10 // synchronous. | 10 // synchronous. |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 Send(new VideoCaptureHostMsg_BufferReady(device_id_, buffer_id, 0)); | 271 Send(new VideoCaptureHostMsg_BufferReady(device_id_, buffer_id, 0)); |
272 return; | 272 return; |
273 } | 273 } |
274 | 274 |
275 last_frame_format_ = format; | 275 last_frame_format_ = format; |
276 if (first_frame_timestamp_.is_null()) | 276 if (first_frame_timestamp_.is_null()) |
277 first_frame_timestamp_ = timestamp; | 277 first_frame_timestamp_ = timestamp; |
278 | 278 |
279 scoped_refptr<media::VideoFrame> frame = media::VideoFrame::WrapNativeTexture( | 279 scoped_refptr<media::VideoFrame> frame = media::VideoFrame::WrapNativeTexture( |
280 make_scoped_ptr(new gpu::MailboxHolder(mailbox_holder)), | 280 make_scoped_ptr(new gpu::MailboxHolder(mailbox_holder)), |
281 media::BindToCurrentLoop(base::Bind( | 281 media::BindToCurrentLoop( |
282 &VideoCaptureImpl::OnClientBufferFinished, weak_factory_.GetWeakPtr(), | 282 base::Bind(&VideoCaptureImpl::OnClientBufferFinished, |
283 buffer_id, scoped_refptr<ClientBuffer>())), | 283 weak_factory_.GetWeakPtr(), |
284 last_frame_format_.frame_size, gfx::Rect(last_frame_format_.frame_size), | 284 buffer_id, |
285 last_frame_format_.frame_size, timestamp - first_frame_timestamp_, | 285 scoped_refptr<ClientBuffer>())), |
286 base::Bind(&NullReadPixelsCB), false); | 286 last_frame_format_.frame_size, |
| 287 gfx::Rect(last_frame_format_.frame_size), |
| 288 last_frame_format_.frame_size, |
| 289 timestamp - first_frame_timestamp_, |
| 290 base::Bind(&NullReadPixelsCB)); |
287 | 291 |
288 for (ClientInfoMap::iterator it = clients_.begin(); it != clients_.end(); | 292 for (ClientInfoMap::iterator it = clients_.begin(); it != clients_.end(); |
289 ++it) { | 293 ++it) { |
290 it->second.deliver_frame_cb.Run(frame, format, timestamp); | 294 it->second.deliver_frame_cb.Run(frame, format, timestamp); |
291 } | 295 } |
292 } | 296 } |
293 | 297 |
294 void VideoCaptureImpl::OnClientBufferFinished( | 298 void VideoCaptureImpl::OnClientBufferFinished( |
295 int buffer_id, | 299 int buffer_id, |
296 const scoped_refptr<ClientBuffer>& /* ignored_buffer */, | 300 const scoped_refptr<ClientBuffer>& /* ignored_buffer */, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 ClientInfoMap::iterator it = clients->find(client_id); | 437 ClientInfoMap::iterator it = clients->find(client_id); |
434 if (it != clients->end()) { | 438 if (it != clients->end()) { |
435 it->second.state_update_cb.Run(VIDEO_CAPTURE_STATE_STOPPED); | 439 it->second.state_update_cb.Run(VIDEO_CAPTURE_STATE_STOPPED); |
436 clients->erase(it); | 440 clients->erase(it); |
437 found = true; | 441 found = true; |
438 } | 442 } |
439 return found; | 443 return found; |
440 } | 444 } |
441 | 445 |
442 } // namespace content | 446 } // namespace content |
OLD | NEW |