Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: media/capture/content/thread_safe_capture_oracle.cc

Issue 2686763002: [Mojo Video Capture] Split OnIncomingCapturedVideoFrame() to OnNewBuffer() and OnFrameReadyInBuffer( (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/capture/BUILD.gn ('k') | media/capture/mojo/OWNERS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } // End of critical section. 124 } // End of critical section.
125 125
126 if (attenuated_utilization >= 1.0) { 126 if (attenuated_utilization >= 1.0) {
127 TRACE_EVENT_INSTANT2( 127 TRACE_EVENT_INSTANT2(
128 "gpu.capture", "NearlyPipelineLimited", TRACE_EVENT_SCOPE_THREAD, 128 "gpu.capture", "NearlyPipelineLimited", TRACE_EVENT_SCOPE_THREAD,
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 200
201 void ThreadSafeCaptureOracle::DidCaptureFrame( 201 void ThreadSafeCaptureOracle::DidCaptureFrame(
202 int frame_number, 202 int frame_number,
203 VideoCaptureDevice::Client::Buffer buffer, 203 VideoCaptureDevice::Client::Buffer buffer,
204 base::TimeTicks capture_begin_time, 204 base::TimeTicks capture_begin_time,
205 base::TimeDelta estimated_frame_duration, 205 base::TimeDelta estimated_frame_duration,
206 scoped_refptr<VideoFrame> frame, 206 scoped_refptr<VideoFrame> frame,
207 base::TimeTicks reference_time, 207 base::TimeTicks reference_time,
208 bool success) { 208 bool success) {
209 TRACE_EVENT_ASYNC_END2("gpu.capture", "Capture", buffer.id(), "success", 209 TRACE_EVENT_ASYNC_END2("gpu.capture", "Capture", buffer.id, "success",
210 success, "timestamp", 210 success, "timestamp",
211 reference_time.ToInternalValue()); 211 reference_time.ToInternalValue());
212 212
213 base::AutoLock guard(lock_); 213 base::AutoLock guard(lock_);
214 214
215 if (!oracle_.CompleteCapture(frame_number, success, &reference_time)) 215 if (!oracle_.CompleteCapture(frame_number, success, &reference_time))
216 return; 216 return;
217 217
218 TRACE_EVENT_INSTANT0("gpu.capture", "CaptureSucceeded", 218 TRACE_EVENT_INSTANT0("gpu.capture", "CaptureSucceeded",
219 TRACE_EVENT_SCOPE_THREAD); 219 TRACE_EVENT_SCOPE_THREAD);
(...skipping 22 matching lines...) Expand all
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
OLDNEW
« no previous file with comments | « media/capture/BUILD.gn ('k') | media/capture/mojo/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698