Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_device_client.h" | 5 #include "content/browser/renderer_host/media/video_capture_device_client.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 rotation_mode = libyuv::kRotate270; | 131 rotation_mode = libyuv::kRotate270; |
| 132 | 132 |
| 133 const gfx::Size dimensions(destination_width, destination_height); | 133 const gfx::Size dimensions(destination_width, destination_height); |
| 134 const media::VideoPixelStorage output_pixel_storage = | 134 const media::VideoPixelStorage output_pixel_storage = |
| 135 use_gpu_memory_buffers_ ? media::PIXEL_STORAGE_GPUMEMORYBUFFER | 135 use_gpu_memory_buffers_ ? media::PIXEL_STORAGE_GPUMEMORYBUFFER |
| 136 : media::PIXEL_STORAGE_CPU; | 136 : media::PIXEL_STORAGE_CPU; |
| 137 uint8_t *y_plane_data, *u_plane_data, *v_plane_data; | 137 uint8_t *y_plane_data, *u_plane_data, *v_plane_data; |
| 138 std::unique_ptr<Buffer> buffer( | 138 std::unique_ptr<Buffer> buffer( |
| 139 ReserveI420OutputBuffer(dimensions, output_pixel_storage, &y_plane_data, | 139 ReserveI420OutputBuffer(dimensions, output_pixel_storage, &y_plane_data, |
| 140 &u_plane_data, &v_plane_data)); | 140 &u_plane_data, &v_plane_data)); |
| 141 if (!buffer.get()) { | 141 #if DCHECK_IS_ON() |
| 142 DLOG(WARNING) << "Failed to reserve I420 output buffer."; | 142 dropped_frame_counter_ = buffer.get() ? 0 : dropped_frame_counter_ + 1; |
| 143 DCHECK_LT(dropped_frame_counter_, 150u) | |
|
mcasas
2016/07/13 00:31:36
I'd recommend defining a constant
static const i
emircan
2016/07/13 17:51:14
Changed |dropped_frame_counter_| to int and declar
emircan
2016/07/13 18:24:55
Nvm. I just realized OnError is a call within this
| |
| 144 << " Dropped too many consecutive captured frames."; | |
| 145 #endif | |
| 146 // Failed to reserve I420 output buffer, so drop the frame. | |
|
mcasas
2016/07/13 00:31:36
nit: Shift l.146 two spaces left.
emircan
2016/07/13 17:51:14
Done.
| |
| 147 if (!buffer.get()) | |
| 143 return; | 148 return; |
| 144 } | |
| 145 | 149 |
| 146 const int yplane_stride = dimensions.width(); | 150 const int yplane_stride = dimensions.width(); |
| 147 const int uv_plane_stride = yplane_stride / 2; | 151 const int uv_plane_stride = yplane_stride / 2; |
| 148 int crop_x = 0; | 152 int crop_x = 0; |
| 149 int crop_y = 0; | 153 int crop_y = 0; |
| 150 libyuv::FourCC origin_colorspace = libyuv::FOURCC_ANY; | 154 libyuv::FourCC origin_colorspace = libyuv::FOURCC_ANY; |
| 151 | 155 |
| 152 bool flip = false; | 156 bool flip = false; |
| 153 switch (frame_format.pixel_format) { | 157 switch (frame_format.pixel_format) { |
| 154 case media::PIXEL_FORMAT_UNKNOWN: // Color format not set. | 158 case media::PIXEL_FORMAT_UNKNOWN: // Color format not set. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kUPlane)); | 421 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kUPlane)); |
| 418 *v_plane_data = | 422 *v_plane_data = |
| 419 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kVPlane)); | 423 reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kVPlane)); |
| 420 return buffer; | 424 return buffer; |
| 421 } | 425 } |
| 422 NOTREACHED(); | 426 NOTREACHED(); |
| 423 return std::unique_ptr<Buffer>(); | 427 return std::unique_ptr<Buffer>(); |
| 424 } | 428 } |
| 425 | 429 |
| 426 } // namespace content | 430 } // namespace content |
| OLD | NEW |