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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::SharedMemoryHandle(), 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)) { |
150 DidCaptureFrame(frame_number, std::move(output_buffer), capture_begin_time, | 150 DidCaptureFrame(frame_number, std::move(output_buffer), capture_begin_time, |
151 estimated_frame_duration, *storage, event_time, false); | 151 estimated_frame_duration, *storage, event_time, false); |
152 return false; | 152 return false; |
153 } | 153 } |
154 | 154 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 | 249 |
250 void ThreadSafeCaptureOracle::OnConsumerReportingUtilization( | 250 void ThreadSafeCaptureOracle::OnConsumerReportingUtilization( |
251 int frame_number, | 251 int frame_number, |
252 double utilization) { | 252 double utilization) { |
253 base::AutoLock guard(lock_); | 253 base::AutoLock guard(lock_); |
254 oracle_.RecordConsumerFeedback(frame_number, utilization); | 254 oracle_.RecordConsumerFeedback(frame_number, utilization); |
255 } | 255 } |
256 | 256 |
257 } // namespace media | 257 } // namespace media |
OLD | NEW |