| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" | 10 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 last_captured_pixel_format_(media::PIXEL_FORMAT_UNKNOWN) {} | 55 last_captured_pixel_format_(media::PIXEL_FORMAT_UNKNOWN) {} |
| 56 | 56 |
| 57 VideoCaptureDeviceClient::~VideoCaptureDeviceClient() {} | 57 VideoCaptureDeviceClient::~VideoCaptureDeviceClient() {} |
| 58 | 58 |
| 59 void VideoCaptureDeviceClient::OnIncomingCapturedData( | 59 void VideoCaptureDeviceClient::OnIncomingCapturedData( |
| 60 const uint8* data, | 60 const uint8* data, |
| 61 int length, | 61 int length, |
| 62 const VideoCaptureFormat& frame_format, | 62 const VideoCaptureFormat& frame_format, |
| 63 int rotation, | 63 int rotation, |
| 64 const base::TimeTicks& timestamp) { | 64 const base::TimeTicks& timestamp) { |
| 65 TRACE_EVENT0("video", "VideoCaptureController::OnIncomingCapturedData"); | 65 TRACE_EVENT0("video", "VideoCaptureDeviceClient::OnIncomingCapturedData"); |
| 66 | 66 |
| 67 if (last_captured_pixel_format_ != frame_format.pixel_format) { | 67 if (last_captured_pixel_format_ != frame_format.pixel_format) { |
| 68 OnLog("Pixel format: " + media::VideoCaptureFormat::PixelFormatToString( | 68 OnLog("Pixel format: " + media::VideoCaptureFormat::PixelFormatToString( |
| 69 frame_format.pixel_format)); | 69 frame_format.pixel_format)); |
| 70 last_captured_pixel_format_ = frame_format.pixel_format; | 70 last_captured_pixel_format_ = frame_format.pixel_format; |
| 71 } | 71 } |
| 72 | 72 |
| 73 if (!frame_format.IsValid()) | 73 if (!frame_format.IsValid()) |
| 74 return; | 74 return; |
| 75 | 75 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 VideoCaptureDeviceClient::OnIncomingCapturedYuvData( | 227 VideoCaptureDeviceClient::OnIncomingCapturedYuvData( |
| 228 const uint8* y_data, | 228 const uint8* y_data, |
| 229 const uint8* u_data, | 229 const uint8* u_data, |
| 230 const uint8* v_data, | 230 const uint8* v_data, |
| 231 size_t y_stride, | 231 size_t y_stride, |
| 232 size_t u_stride, | 232 size_t u_stride, |
| 233 size_t v_stride, | 233 size_t v_stride, |
| 234 const VideoCaptureFormat& frame_format, | 234 const VideoCaptureFormat& frame_format, |
| 235 int clockwise_rotation, | 235 int clockwise_rotation, |
| 236 const base::TimeTicks& timestamp) { | 236 const base::TimeTicks& timestamp) { |
| 237 TRACE_EVENT0("video", "VideoCaptureController::OnIncomingCapturedYuvData"); | 237 TRACE_EVENT0("video", "VideoCaptureDeviceClient::OnIncomingCapturedYuvData"); |
| 238 DCHECK_EQ(frame_format.pixel_format, media::PIXEL_FORMAT_I420); | 238 DCHECK_EQ(frame_format.pixel_format, media::PIXEL_FORMAT_I420); |
| 239 DCHECK_EQ(clockwise_rotation, 0) << "Rotation not supported"; | 239 DCHECK_EQ(clockwise_rotation, 0) << "Rotation not supported"; |
| 240 | 240 |
| 241 scoped_refptr<Buffer> buffer = ReserveOutputBuffer(VideoFrame::I420, | 241 scoped_refptr<Buffer> buffer = ReserveOutputBuffer(VideoFrame::I420, |
| 242 frame_format.frame_size); | 242 frame_format.frame_size); |
| 243 if (!buffer.get()) | 243 if (!buffer.get()) |
| 244 return; | 244 return; |
| 245 | 245 |
| 246 // Blit (copy) here from y,u,v into buffer.data()). Needed so we can return | 246 // Blit (copy) here from y,u,v into buffer.data()). Needed so we can return |
| 247 // the parameter buffer synchronously to the driver. | 247 // the parameter buffer synchronously to the driver. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 357 } |
| 358 | 358 |
| 359 void VideoCaptureDeviceClient::OnLog( | 359 void VideoCaptureDeviceClient::OnLog( |
| 360 const std::string& message) { | 360 const std::string& message) { |
| 361 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 361 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 362 base::Bind(&VideoCaptureController::DoLogOnIOThread, | 362 base::Bind(&VideoCaptureController::DoLogOnIOThread, |
| 363 controller_, message)); | 363 controller_, message)); |
| 364 } | 364 } |
| 365 | 365 |
| 366 } // namespace content | 366 } // namespace content |
| OLD | NEW |