| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 frame_info->coded_size.height()); | 440 frame_info->coded_size.height()); |
| 441 double frame_rate = 0.0f; | 441 double frame_rate = 0.0f; |
| 442 if (video_capture_format_) { | 442 if (video_capture_format_) { |
| 443 media::VideoFrameMetadata metadata; | 443 media::VideoFrameMetadata metadata; |
| 444 metadata.MergeInternalValuesFrom(*frame_info->metadata); | 444 metadata.MergeInternalValuesFrom(*frame_info->metadata); |
| 445 if (!metadata.GetDouble(VideoFrameMetadata::FRAME_RATE, &frame_rate)) { | 445 if (!metadata.GetDouble(VideoFrameMetadata::FRAME_RATE, &frame_rate)) { |
| 446 frame_rate = video_capture_format_->frame_rate; | 446 frame_rate = video_capture_format_->frame_rate; |
| 447 } | 447 } |
| 448 } | 448 } |
| 449 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.FrameRate", frame_rate); | 449 UMA_HISTOGRAM_COUNTS("Media.VideoCapture.FrameRate", frame_rate); |
| 450 OnLog("First frame received at VideoCaptureController"); |
| 450 has_received_frames_ = true; | 451 has_received_frames_ = true; |
| 451 } | 452 } |
| 452 } | 453 } |
| 453 | 454 |
| 454 void VideoCaptureController::OnBufferRetired(int buffer_id) { | 455 void VideoCaptureController::OnBufferRetired(int buffer_id) { |
| 455 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 456 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 456 | 457 |
| 457 auto buffer_context_iter = FindUnretiredBufferContextFromBufferId(buffer_id); | 458 auto buffer_context_iter = FindUnretiredBufferContextFromBufferId(buffer_id); |
| 458 DCHECK(buffer_context_iter != buffer_contexts_.end()); | 459 DCHECK(buffer_context_iter != buffer_contexts_.end()); |
| 459 | 460 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 477 MediaStreamManager::SendMessageToNativeLog("Video capture: " + message); | 478 MediaStreamManager::SendMessageToNativeLog("Video capture: " + message); |
| 478 } | 479 } |
| 479 | 480 |
| 480 void VideoCaptureController::OnStarted() { | 481 void VideoCaptureController::OnStarted() { |
| 481 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 482 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 482 state_ = VIDEO_CAPTURE_STATE_STARTED; | 483 state_ = VIDEO_CAPTURE_STATE_STARTED; |
| 483 PerformForClientsWithOpenSession(base::Bind(&CallOnStarted)); | 484 PerformForClientsWithOpenSession(base::Bind(&CallOnStarted)); |
| 484 } | 485 } |
| 485 | 486 |
| 486 void VideoCaptureController::OnStartedUsingGpuDecode() { | 487 void VideoCaptureController::OnStartedUsingGpuDecode() { |
| 488 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 489 OnLog("StartedUsingGpuDecode"); |
| 487 PerformForClientsWithOpenSession(base::Bind(&CallOnStartedUsingGpuDecode)); | 490 PerformForClientsWithOpenSession(base::Bind(&CallOnStartedUsingGpuDecode)); |
| 488 } | 491 } |
| 489 | 492 |
| 490 void VideoCaptureController::OnDeviceLaunched( | 493 void VideoCaptureController::OnDeviceLaunched( |
| 491 std::unique_ptr<LaunchedVideoCaptureDevice> device) { | 494 std::unique_ptr<LaunchedVideoCaptureDevice> device) { |
| 492 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 495 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 493 launched_device_ = std::move(device); | 496 launched_device_ = std::move(device); |
| 494 for (auto& entry : buffer_contexts_) | 497 for (auto& entry : buffer_contexts_) |
| 495 entry.set_consumer_feedback_observer(launched_device_.get()); | 498 entry.set_consumer_feedback_observer(launched_device_.get()); |
| 496 if (device_launch_observer_) { | 499 if (device_launch_observer_) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 EventHandlerAction action) { | 668 EventHandlerAction action) { |
| 666 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 669 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 667 for (const auto& client : controller_clients_) { | 670 for (const auto& client : controller_clients_) { |
| 668 if (client->session_closed) | 671 if (client->session_closed) |
| 669 continue; | 672 continue; |
| 670 action.Run(client->event_handler, client->controller_id); | 673 action.Run(client->event_handler, client->controller_id); |
| 671 } | 674 } |
| 672 } | 675 } |
| 673 | 676 |
| 674 } // namespace content | 677 } // namespace content |
| OLD | NEW |