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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/location.h" |
11 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
12 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
13 #include "content/browser/compositor/image_transport_factory.h" | 14 #include "content/browser/compositor/image_transport_factory.h" |
14 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 15 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
15 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 16 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
16 #include "content/browser/gpu/gpu_data_manager_impl.h" | 17 #include "content/browser/gpu/gpu_data_manager_impl.h" |
17 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" | 18 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h" |
18 #include "content/browser/renderer_host/media/video_capture_controller.h" | 19 #include "content/browser/renderer_host/media/video_capture_controller.h" |
19 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" | 20 #include "content/browser/renderer_host/media/video_capture_gpu_jpeg_decoder.h" |
20 #include "content/common/gpu/client/context_provider_command_buffer.h" | 21 #include "content/common/gpu/client/context_provider_command_buffer.h" |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 FROM_HERE, | 387 FROM_HERE, |
387 base::Bind( | 388 base::Bind( |
388 &VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread, | 389 &VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread, |
389 controller_, | 390 controller_, |
390 base::Passed(&buffer), | 391 base::Passed(&buffer), |
391 frame, | 392 frame, |
392 timestamp)); | 393 timestamp)); |
393 } | 394 } |
394 | 395 |
395 void VideoCaptureDeviceClient::OnError( | 396 void VideoCaptureDeviceClient::OnError( |
| 397 const tracked_objects::Location& from_here, |
396 const std::string& reason) { | 398 const std::string& reason) { |
397 const std::string log_message = base::StringPrintf( | 399 const std::string log_message = base::StringPrintf( |
398 "Error on video capture: %s, OS message: %s", | 400 "Error on %s:%d: %s, OS message: %s", from_here.file_name(), |
399 reason.c_str(), | 401 from_here.line_number(), reason.c_str(), |
400 logging::SystemErrorCodeToString( | 402 logging::SystemErrorCodeToString(logging::GetLastSystemErrorCode()) |
401 logging::GetLastSystemErrorCode()).c_str()); | 403 .c_str()); |
402 DLOG(ERROR) << log_message; | 404 DLOG(ERROR) << log_message; |
403 OnLog(log_message); | 405 OnLog(log_message); |
404 BrowserThread::PostTask(BrowserThread::IO, | 406 BrowserThread::PostTask(BrowserThread::IO, |
405 FROM_HERE, | 407 FROM_HERE, |
406 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); | 408 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); |
407 } | 409 } |
408 | 410 |
409 void VideoCaptureDeviceClient::OnLog( | 411 void VideoCaptureDeviceClient::OnLog( |
410 const std::string& message) { | 412 const std::string& message) { |
411 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 413 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 .GetArea(); | 452 .GetArea(); |
451 } else if (storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER) { | 453 } else if (storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER) { |
452 *y_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kYPlane)); | 454 *y_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kYPlane)); |
453 *u_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kUPlane)); | 455 *u_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kUPlane)); |
454 *v_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kVPlane)); | 456 *v_plane_data = reinterpret_cast<uint8*>(buffer->data(VideoFrame::kVPlane)); |
455 } | 457 } |
456 return buffer.Pass(); | 458 return buffer.Pass(); |
457 } | 459 } |
458 | 460 |
459 } // namespace content | 461 } // namespace content |
OLD | NEW |