| 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/browser/renderer_host/media/video_capture_controller.h" | 5 #include "content/browser/renderer_host/media/video_capture_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/metrics/sparse_histogram.h" | 13 #include "base/metrics/sparse_histogram.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/strings/stringprintf.h" |
| 15 #include "content/browser/renderer_host/media/media_stream_manager.h" | 16 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 16 #include "content/browser/renderer_host/media/video_capture_manager.h" | 17 #include "content/browser/renderer_host/media/video_capture_manager.h" |
| 17 #include "content/common/gpu/client/gl_helper.h" | 18 #include "content/common/gpu/client/gl_helper.h" |
| 18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 19 #include "gpu/command_buffer/common/mailbox_holder.h" | 20 #include "gpu/command_buffer/common/mailbox_holder.h" |
| 20 #include "media/base/video_frame.h" | 21 #include "media/base/video_frame.h" |
| 21 #include "media/base/video_util.h" | 22 #include "media/base/video_util.h" |
| 22 #include "media/base/yuv_convert.h" | 23 #include "media/base/yuv_convert.h" |
| 23 #include "third_party/libyuv/include/libyuv.h" | 24 #include "third_party/libyuv/include/libyuv.h" |
| 24 | 25 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 &VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread, | 510 &VideoCaptureController::DoIncomingCapturedVideoFrameOnIOThread, |
| 510 controller_, | 511 controller_, |
| 511 buffer, | 512 buffer, |
| 512 buffer_format, | 513 buffer_format, |
| 513 frame, | 514 frame, |
| 514 timestamp)); | 515 timestamp)); |
| 515 } | 516 } |
| 516 | 517 |
| 517 void VideoCaptureController::VideoCaptureDeviceClient::OnError( | 518 void VideoCaptureController::VideoCaptureDeviceClient::OnError( |
| 518 const std::string& reason) { | 519 const std::string& reason) { |
| 519 MediaStreamManager::SendMessageToNativeLog( | 520 const std::string log_message = base::StringPrintf( |
| 520 "Error on video capture: " + reason); | 521 "Error on video capture: %s, OS message: %s", |
| 522 reason.c_str(), |
| 523 logging::SystemErrorCodeToString( |
| 524 logging::GetLastSystemErrorCode()).c_str()); |
| 525 DLOG(ERROR) << log_message; |
| 526 MediaStreamManager::SendMessageToNativeLog(log_message); |
| 521 BrowserThread::PostTask(BrowserThread::IO, | 527 BrowserThread::PostTask(BrowserThread::IO, |
| 522 FROM_HERE, | 528 FROM_HERE, |
| 523 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); | 529 base::Bind(&VideoCaptureController::DoErrorOnIOThread, controller_)); |
| 524 } | 530 } |
| 525 | 531 |
| 526 void VideoCaptureController::VideoCaptureDeviceClient::OnLog( | 532 void VideoCaptureController::VideoCaptureDeviceClient::OnLog( |
| 527 const std::string& message) { | 533 const std::string& message) { |
| 528 MediaStreamManager::SendMessageToNativeLog("Video capture: " + message); | 534 MediaStreamManager::SendMessageToNativeLog("Video capture: " + message); |
| 529 } | 535 } |
| 530 | 536 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 } | 683 } |
| 678 return NULL; | 684 return NULL; |
| 679 } | 685 } |
| 680 | 686 |
| 681 int VideoCaptureController::GetClientCount() { | 687 int VideoCaptureController::GetClientCount() { |
| 682 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 688 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 683 return controller_clients_.size(); | 689 return controller_clients_.size(); |
| 684 } | 690 } |
| 685 | 691 |
| 686 } // namespace content | 692 } // namespace content |
| OLD | NEW |