| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "media/capture/content/thread_safe_capture_oracle.h" | 5 #include "media/capture/content/thread_safe_capture_oracle.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 "trigger", VideoCaptureOracle::EventAsString(event), | 129 "trigger", VideoCaptureOracle::EventAsString(event), |
| 130 "atten_util_percent", | 130 "atten_util_percent", |
| 131 base::saturated_cast<int>(attenuated_utilization * 100.0 + 0.5)); | 131 base::saturated_cast<int>(attenuated_utilization * 100.0 + 0.5)); |
| 132 } | 132 } |
| 133 | 133 |
| 134 TRACE_EVENT_ASYNC_BEGIN2("gpu.capture", "Capture", output_buffer.id(), | 134 TRACE_EVENT_ASYNC_BEGIN2("gpu.capture", "Capture", output_buffer.id(), |
| 135 "frame_number", frame_number, "trigger", | 135 "frame_number", frame_number, "trigger", |
| 136 VideoCaptureOracle::EventAsString(event)); | 136 VideoCaptureOracle::EventAsString(event)); |
| 137 | 137 |
| 138 auto output_buffer_access = | 138 auto output_buffer_access = |
| 139 output_buffer.handle_provider()->GetHandleForInProcessAccess(); | 139 output_buffer.handle_provider->GetHandleForInProcessAccess(); |
| 140 DCHECK_EQ(media::PIXEL_STORAGE_CPU, params_.requested_format.pixel_storage); | 140 DCHECK_EQ(media::PIXEL_STORAGE_CPU, params_.requested_format.pixel_storage); |
| 141 *storage = VideoFrame::WrapExternalSharedMemory( | 141 *storage = VideoFrame::WrapExternalSharedMemory( |
| 142 params_.requested_format.pixel_format, coded_size, | 142 params_.requested_format.pixel_format, coded_size, |
| 143 gfx::Rect(visible_size), visible_size, output_buffer_access->data(), | 143 gfx::Rect(visible_size), visible_size, output_buffer_access->data(), |
| 144 output_buffer_access->mapped_size(), base::SharedMemory::NULLHandle(), 0u, | 144 output_buffer_access->mapped_size(), base::SharedMemory::NULLHandle(), 0u, |
| 145 base::TimeDelta()); | 145 base::TimeDelta()); |
| 146 // If creating the VideoFrame wrapper failed, call DidCaptureFrame() with | 146 // If creating the VideoFrame wrapper failed, call DidCaptureFrame() with |
| 147 // !success to execute the required post-capture steps (tracing, notification | 147 // !success to execute the required post-capture steps (tracing, notification |
| 148 // of failure to VideoCaptureOracle, etc.). | 148 // of failure to VideoCaptureOracle, etc.). |
| 149 if (!(*storage)) { | 149 if (!(*storage)) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 242 } |
| 243 | 243 |
| 244 void ThreadSafeCaptureOracle::OnConsumerReportingUtilization( | 244 void ThreadSafeCaptureOracle::OnConsumerReportingUtilization( |
| 245 int frame_number, | 245 int frame_number, |
| 246 double utilization) { | 246 double utilization) { |
| 247 base::AutoLock guard(lock_); | 247 base::AutoLock guard(lock_); |
| 248 oracle_.RecordConsumerFeedback(frame_number, utilization); | 248 oracle_.RecordConsumerFeedback(frame_number, utilization); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace media | 251 } // namespace media |
| OLD | NEW |