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

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

Issue 2518143004: [Mojo Video Capture] Replace RESOURCE_UTILIZATION with interface ReceiverLoadObserver (Closed)
Patch Set: Fixes for failing bots 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 params_.requested_format.frame_rate); 221 params_.requested_format.frame_rate);
222 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_BEGIN_TIME, 222 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_BEGIN_TIME,
223 capture_begin_time); 223 capture_begin_time);
224 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_END_TIME, 224 frame->metadata()->SetTimeTicks(VideoFrameMetadata::CAPTURE_END_TIME,
225 base::TimeTicks::Now()); 225 base::TimeTicks::Now());
226 frame->metadata()->SetTimeDelta(VideoFrameMetadata::FRAME_DURATION, 226 frame->metadata()->SetTimeDelta(VideoFrameMetadata::FRAME_DURATION,
227 estimated_frame_duration); 227 estimated_frame_duration);
228 frame->metadata()->SetTimeTicks(VideoFrameMetadata::REFERENCE_TIME, 228 frame->metadata()->SetTimeTicks(VideoFrameMetadata::REFERENCE_TIME,
229 reference_time); 229 reference_time);
230 230
231 frame->AddDestructionObserver( 231 client_->OnIncomingCapturedVideoFrame(std::move(buffer), std::move(frame),
232 base::Bind(&ThreadSafeCaptureOracle::DidConsumeFrame, this, 232 frame_number);
233 frame_number, frame->metadata()));
234
235 client_->OnIncomingCapturedVideoFrame(std::move(buffer), std::move(frame));
236 } 233 }
237 } 234 }
238 235
239 void ThreadSafeCaptureOracle::DidConsumeFrame( 236 void ThreadSafeCaptureOracle::OnConsumerReportingUtilization(
240 int frame_number, 237 int frame_number,
241 const media::VideoFrameMetadata* metadata) { 238 double utilization) {
242 // Note: This function may be called on any thread by the VideoFrame 239 base::AutoLock guard(lock_);
miu 2016/12/01 05:25:18 One of these days, I'm going to have to go through
chfremer 2016/12/02 01:28:28 I hope it helps that calls to this method are now
243 // destructor. |metadata| is still valid for read-access at this point. 240 oracle_.RecordConsumerFeedback(frame_number, utilization);
244 double utilization = -1.0;
245 if (metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION,
246 &utilization)) {
247 base::AutoLock guard(lock_);
248 oracle_.RecordConsumerFeedback(frame_number, utilization);
249 }
250 } 241 }
251 242
252 } // namespace media 243 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698