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

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

Issue 2866943002: Give performance_browser_tests lots of love and attention. (Closed)
Patch Set: fix compile error Created 3 years, 7 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
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 206
207 void ThreadSafeCaptureOracle::DidCaptureFrame( 207 void ThreadSafeCaptureOracle::DidCaptureFrame(
208 int frame_number, 208 int frame_number,
209 VideoCaptureDevice::Client::Buffer buffer, 209 VideoCaptureDevice::Client::Buffer buffer,
210 base::TimeTicks capture_begin_time, 210 base::TimeTicks capture_begin_time,
211 base::TimeDelta estimated_frame_duration, 211 base::TimeDelta estimated_frame_duration,
212 scoped_refptr<VideoFrame> frame, 212 scoped_refptr<VideoFrame> frame,
213 base::TimeTicks reference_time, 213 base::TimeTicks reference_time,
214 bool success) { 214 bool success) {
215 TRACE_EVENT_ASYNC_END2("gpu.capture", "Capture", buffer.id, "success",
216 success, "timestamp",
217 reference_time.ToInternalValue());
218
219 base::AutoLock guard(lock_); 215 base::AutoLock guard(lock_);
220 216
221 if (!oracle_.CompleteCapture(frame_number, success, &reference_time)) 217 const bool should_deliver_frame =
218 oracle_.CompleteCapture(frame_number, success, &reference_time);
219
220 // The following is used by
221 // chrome/browser/extension/api/cast_streaming/performance_test.cc, in
222 // addition to the usual runtime tracing.
223 TRACE_EVENT_ASYNC_END2("gpu.capture", "Capture", buffer.id, "success",
224 should_deliver_frame, "timestamp",
225 (reference_time - base::TimeTicks()).InMicroseconds());
226
227 if (!should_deliver_frame || !client_)
222 return; 228 return;
223 229
224 TRACE_EVENT_INSTANT0("gpu.capture", "CaptureSucceeded",
225 TRACE_EVENT_SCOPE_THREAD);
226
227 if (!client_)
228 return; // Capture is stopped.
229
230 frame->metadata()->SetDouble(VideoFrameMetadata::FRAME_RATE, 230 frame->metadata()->SetDouble(VideoFrameMetadata::FRAME_RATE,
231 params_.requested_format.frame_rate); 231 params_.requested_format.frame_rate);
232 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_BEGIN_TIME, 232 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_BEGIN_TIME,
233 capture_begin_time); 233 capture_begin_time);
234 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_END_TIME, 234 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_END_TIME,
235 base::TimeTicks::Now()); 235 base::TimeTicks::Now());
236 frame->metadata()->SetTimeDelta(VideoFrameMetadata::FRAME_DURATION, 236 frame->metadata()->SetTimeDelta(VideoFrameMetadata::FRAME_DURATION,
237 estimated_frame_duration); 237 estimated_frame_duration);
238 frame->metadata()->SetTimeTicks(VideoFrameMetadata::REFERENCE_TIME, 238 frame->metadata()->SetTimeTicks(VideoFrameMetadata::REFERENCE_TIME,
239 reference_time); 239 reference_time);
240 240
241 DCHECK(frame->IsMappable()); 241 DCHECK(frame->IsMappable());
242 media::VideoCaptureFormat format(frame->coded_size(), 242 media::VideoCaptureFormat format(frame->coded_size(),
243 params_.requested_format.frame_rate, 243 params_.requested_format.frame_rate,
244 frame->format(), media::PIXEL_STORAGE_CPU); 244 frame->format(), media::PIXEL_STORAGE_CPU);
245 client_->OnIncomingCapturedBufferExt( 245 client_->OnIncomingCapturedBufferExt(
246 std::move(buffer), format, reference_time, frame->timestamp(), 246 std::move(buffer), format, reference_time, frame->timestamp(),
247 frame->visible_rect(), *frame->metadata()); 247 frame->visible_rect(), *frame->metadata());
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
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/tab_capture/performance.js ('k') | media/cast/receiver/cast_receiver_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698