Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Unified Diff: webkit/plugins/ppapi/ppb_video_capture_impl.cc

Issue 8819010: Webcam ppapi flash fix. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/media/video_capture_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_video_capture_impl.cc
===================================================================
--- webkit/plugins/ppapi/ppb_video_capture_impl.cc (revision 113138)
+++ webkit/plugins/ppapi/ppb_video_capture_impl.cc (working copy)
@@ -209,24 +209,25 @@
void PPB_VideoCapture_Impl::OnBufferReady(
media::VideoCapture* capture,
scoped_refptr<media::VideoCapture::VideoFrameBuffer> buffer) {
- if (is_dead_)
- return;
-
- DCHECK(buffer.get());
- for (uint32_t i = 0; i < buffers_.size(); ++i) {
- if (!buffers_[i].in_use) {
- // TODO(piman): it looks like stride isn't actually used/filled.
- DCHECK(buffer->stride == 0);
- size_t size = std::min(static_cast<size_t>(buffers_[i].buffer->size()),
- buffer->buffer_size);
- memcpy(buffers_[i].data, buffer->memory_pointer, size);
- buffers_[i].in_use = true;
- platform_video_capture_->FeedBuffer(buffer);
- ppp_videocapture_->OnBufferReady(pp_instance(), pp_resource(), i);
- return;
+ if (!is_dead_) {
+ DCHECK(buffer.get());
+ for (uint32_t i = 0; i < buffers_.size(); ++i) {
+ if (!buffers_[i].in_use) {
+ // TODO(ihf): Switch to a size calculation based on stride.
+ // Stride is filled out now but not more meaningful than size
+ // until wjia unifies VideoFrameBuffer and media::VideoFrame.
+ size_t size = std::min(static_cast<size_t>(buffers_[i].buffer->size()),
+ buffer->buffer_size);
+ memcpy(buffers_[i].data, buffer->memory_pointer, size);
+ buffers_[i].in_use = true;
+ platform_video_capture_->FeedBuffer(buffer);
+ ppp_videocapture_->OnBufferReady(pp_instance(), pp_resource(), i);
+ return;
+ }
}
}
- // TODO(piman): signal dropped buffers ?
+ // Even after we have stopped and are dead we have to return buffers that
+ // are in flight to us. Otherwise VideoCaptureController will not tear down.
platform_video_capture_->FeedBuffer(buffer);
}
« no previous file with comments | « content/browser/renderer_host/media/video_capture_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698