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

Side by Side Diff: media/capture/video/fake_video_capture_device.cc

Issue 2673373003: getUserMeida: report device starting states (Closed)
Patch Set: address comments on PS#3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/video/fake_video_capture_device.h" 5 #include "media/capture/video/fake_video_capture_device.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 if (buffer_ownership_ == BufferOwnership::CLIENT_BUFFERS) 227 if (buffer_ownership_ == BufferOwnership::CLIENT_BUFFERS)
228 BeepAndScheduleNextCapture( 228 BeepAndScheduleNextCapture(
229 base::TimeTicks::Now(), 229 base::TimeTicks::Now(),
230 base::Bind(&FakeVideoCaptureDevice::CaptureUsingClientBuffers, 230 base::Bind(&FakeVideoCaptureDevice::CaptureUsingClientBuffers,
231 weak_factory_.GetWeakPtr())); 231 weak_factory_.GetWeakPtr()));
232 else if (buffer_ownership_ == BufferOwnership::OWN_BUFFERS) 232 else if (buffer_ownership_ == BufferOwnership::OWN_BUFFERS)
233 BeepAndScheduleNextCapture( 233 BeepAndScheduleNextCapture(
234 base::TimeTicks::Now(), 234 base::TimeTicks::Now(),
235 base::Bind(&FakeVideoCaptureDevice::CaptureUsingOwnBuffers, 235 base::Bind(&FakeVideoCaptureDevice::CaptureUsingOwnBuffers,
236 weak_factory_.GetWeakPtr())); 236 weak_factory_.GetWeakPtr()));
237
238 client_->OnStarted();
237 } 239 }
238 240
239 void FakeVideoCaptureDevice::StopAndDeAllocate() { 241 void FakeVideoCaptureDevice::StopAndDeAllocate() {
240 DCHECK(thread_checker_.CalledOnValidThread()); 242 DCHECK(thread_checker_.CalledOnValidThread());
241 client_.reset(); 243 client_.reset();
242 } 244 }
243 245
244 void FakeVideoCaptureDevice::GetPhotoCapabilities( 246 void FakeVideoCaptureDevice::GetPhotoCapabilities(
245 GetPhotoCapabilitiesCallback callback) { 247 GetPhotoCapabilitiesCallback callback) {
246 mojom::PhotoCapabilitiesPtr photo_capabilities = 248 mojom::PhotoCapabilitiesPtr photo_capabilities =
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 // Don't accumulate any debt if we are lagging behind - just post the next 371 // Don't accumulate any debt if we are lagging behind - just post the next
370 // frame immediately and continue as normal. 372 // frame immediately and continue as normal.
371 const base::TimeTicks next_execution_time = 373 const base::TimeTicks next_execution_time =
372 std::max(current_time, expected_execution_time + frame_interval); 374 std::max(current_time, expected_execution_time + frame_interval);
373 const base::TimeDelta delay = next_execution_time - current_time; 375 const base::TimeDelta delay = next_execution_time - current_time;
374 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 376 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
375 FROM_HERE, base::Bind(next_capture, next_execution_time), delay); 377 FROM_HERE, base::Bind(next_capture, next_execution_time), delay);
376 } 378 }
377 379
378 } // namespace media 380 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698