| 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/pepper/pepper_video_capture_host.h" | 5 #include "content/renderer/pepper/pepper_video_capture_host.h" |
| 6 | 6 |
| 7 #include "content/renderer/pepper/host_globals.h" | 7 #include "content/renderer/pepper/host_globals.h" |
| 8 #include "content/renderer/pepper/pepper_media_device_manager.h" | 8 #include "content/renderer/pepper/pepper_media_device_manager.h" |
| 9 #include "content/renderer/pepper/pepper_platform_video_capture.h" | 9 #include "content/renderer/pepper/pepper_platform_video_capture.h" |
| 10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 for (uint32_t i = 0; i < buffers_.size(); ++i) { | 132 for (uint32_t i = 0; i < buffers_.size(); ++i) { |
| 133 if (!buffers_[i].in_use) { | 133 if (!buffers_[i].in_use) { |
| 134 DCHECK_EQ(frame->format(), media::VideoFrame::I420); | 134 DCHECK_EQ(frame->format(), media::VideoFrame::I420); |
| 135 if (buffers_[i].buffer->size() < | 135 if (buffers_[i].buffer->size() < |
| 136 media::VideoFrame::AllocationSize(frame->format(), | 136 media::VideoFrame::AllocationSize(frame->format(), |
| 137 frame->coded_size())) { | 137 frame->coded_size())) { |
| 138 // TODO(ihf): handle size mismatches gracefully here. | 138 // TODO(ihf): handle size mismatches gracefully here. |
| 139 return; | 139 return; |
| 140 } | 140 } |
| 141 uint8* dst = reinterpret_cast<uint8*>(buffers_[i].data); | 141 uint8* dst = reinterpret_cast<uint8*>(buffers_[i].data); |
| 142 COMPILE_ASSERT(media::VideoFrame::kYPlane == 0, y_plane_should_be_0); | 142 static_assert(media::VideoFrame::kYPlane == 0, "y plane should be 0"); |
| 143 COMPILE_ASSERT(media::VideoFrame::kUPlane == 1, u_plane_should_be_1); | 143 static_assert(media::VideoFrame::kUPlane == 1, "u plane should be 1"); |
| 144 COMPILE_ASSERT(media::VideoFrame::kVPlane == 2, v_plane_should_be_2); | 144 static_assert(media::VideoFrame::kVPlane == 2, "v plane should be 2"); |
| 145 for (size_t j = 0; j < media::VideoFrame::NumPlanes(frame->format()); | 145 for (size_t j = 0; j < media::VideoFrame::NumPlanes(frame->format()); |
| 146 ++j) { | 146 ++j) { |
| 147 const uint8* src = frame->data(j); | 147 const uint8* src = frame->data(j); |
| 148 const size_t row_bytes = frame->row_bytes(j); | 148 const size_t row_bytes = frame->row_bytes(j); |
| 149 const size_t src_stride = frame->stride(j); | 149 const size_t src_stride = frame->stride(j); |
| 150 for (int k = 0; k < frame->rows(j); ++k) { | 150 for (int k = 0; k < frame->rows(j); ++k) { |
| 151 memcpy(dst, src, row_bytes); | 151 memcpy(dst, src, row_bytes); |
| 152 dst += row_bytes; | 152 dst += row_bytes; |
| 153 src += src_stride; | 153 src += src_stride; |
| 154 } | 154 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 } | 414 } |
| 415 | 415 |
| 416 PepperVideoCaptureHost::BufferInfo::BufferInfo() | 416 PepperVideoCaptureHost::BufferInfo::BufferInfo() |
| 417 : in_use(false), data(NULL), buffer() { | 417 : in_use(false), data(NULL), buffer() { |
| 418 } | 418 } |
| 419 | 419 |
| 420 PepperVideoCaptureHost::BufferInfo::~BufferInfo() { | 420 PepperVideoCaptureHost::BufferInfo::~BufferInfo() { |
| 421 } | 421 } |
| 422 | 422 |
| 423 } // namespace content | 423 } // namespace content |
| OLD | NEW |