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

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

Issue 2566983007: [Mojo Video Capture] Replace method OnIncomingCapturedVideoFrame with OnIncomingCapturedBufferExt (Closed)
Patch Set: Created 4 years 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 base::TimeDelta estimated_frame_duration, 204 base::TimeDelta estimated_frame_duration,
205 scoped_refptr<VideoFrame> frame, 205 scoped_refptr<VideoFrame> frame,
206 base::TimeTicks reference_time, 206 base::TimeTicks reference_time,
207 bool success) { 207 bool success) {
208 TRACE_EVENT_ASYNC_END2("gpu.capture", "Capture", buffer.get(), "success", 208 TRACE_EVENT_ASYNC_END2("gpu.capture", "Capture", buffer.get(), "success",
209 success, "timestamp", 209 success, "timestamp",
210 reference_time.ToInternalValue()); 210 reference_time.ToInternalValue());
211 211
212 base::AutoLock guard(lock_); 212 base::AutoLock guard(lock_);
213 213
214 if (oracle_.CompleteCapture(frame_number, success, &reference_time)) { 214 if (oracle_.CompleteCapture(frame_number, success, &reference_time)) {
mcasas 2016/12/14 21:04:27 nit: This should use early return: if !(oracle_.
chfremer 2016/12/14 21:42:29 Done.
215 TRACE_EVENT_INSTANT0("gpu.capture", "CaptureSucceeded", 215 TRACE_EVENT_INSTANT0("gpu.capture", "CaptureSucceeded",
216 TRACE_EVENT_SCOPE_THREAD); 216 TRACE_EVENT_SCOPE_THREAD);
217 217
218 if (!client_) 218 if (!client_)
219 return; // Capture is stopped. 219 return; // Capture is stopped.
220 220
221 frame->metadata()->SetDouble(VideoFrameMetadata::FRAME_RATE, 221 frame->metadata()->SetDouble(VideoFrameMetadata::FRAME_RATE,
222 params_.requested_format.frame_rate); 222 params_.requested_format.frame_rate);
223 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_BEGIN_TIME, 223 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_BEGIN_TIME,
224 capture_begin_time); 224 capture_begin_time);
225 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_END_TIME, 225 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_END_TIME,
226 base::TimeTicks::Now()); 226 base::TimeTicks::Now());
227 frame->metadata()->SetTimeDelta(VideoFrameMetadata::FRAME_DURATION, 227 frame->metadata()->SetTimeDelta(VideoFrameMetadata::FRAME_DURATION,
228 estimated_frame_duration); 228 estimated_frame_duration);
229 frame->metadata()->SetTimeTicks(VideoFrameMetadata::REFERENCE_TIME, 229 frame->metadata()->SetTimeTicks(VideoFrameMetadata::REFERENCE_TIME,
230 reference_time); 230 reference_time);
231 231
232 client_->OnIncomingCapturedVideoFrame(std::move(buffer), std::move(frame)); 232 media::VideoCaptureFormat format(frame->coded_size(),
233 params_.requested_format.frame_rate,
234 frame->format(), media::PIXEL_STORAGE_CPU);
mcasas 2016/12/14 21:04:27 Are we sure that media::PIXEL_STORAGE_CPU is alway
chfremer 2016/12/14 21:42:29 Good point. Right now we are sure, because it is t
235 client_->OnIncomingCapturedBufferExt(
236 std::move(buffer), format, frame->visible_rect(), reference_time,
237 frame->timestamp(), *frame->metadata());
233 } 238 }
234 } 239 }
235 240
236 void ThreadSafeCaptureOracle::OnConsumerReportingUtilization( 241 void ThreadSafeCaptureOracle::OnConsumerReportingUtilization(
237 int frame_number, 242 int frame_number,
238 double utilization) { 243 double utilization) {
239 base::AutoLock guard(lock_); 244 base::AutoLock guard(lock_);
240 oracle_.RecordConsumerFeedback(frame_number, utilization); 245 oracle_.RecordConsumerFeedback(frame_number, utilization);
241 } 246 }
242 247
243 } // namespace media 248 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698