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

Side by Side Diff: content/renderer/media/video_capture_impl_unittest.cc

Issue 2045813003: Decouple capture timestamp and reference time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "content/child/child_process.h" 10 #include "content/child/child_process.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 video_capture_impl_->StopCapture(client_id); 161 video_capture_impl_->StopCapture(client_id);
162 } 162 }
163 163
164 void NewBuffer(int buffer_id, const base::SharedMemory& shm) { 164 void NewBuffer(int buffer_id, const base::SharedMemory& shm) {
165 video_capture_impl_->OnBufferCreated( 165 video_capture_impl_->OnBufferCreated(
166 base::SharedMemory::DuplicateHandle(shm.handle()), 166 base::SharedMemory::DuplicateHandle(shm.handle()),
167 shm.mapped_size(), buffer_id); 167 shm.mapped_size(), buffer_id);
168 } 168 }
169 169
170 void BufferReceived(int buffer_id, const gfx::Size& size) { 170 void BufferReceived(int buffer_id, const gfx::Size& size) {
171 base::TimeTicks now = base::TimeTicks::Now();
172 base::TimeDelta timestamp =
173 base::TimeDelta::FromInternalValue(now.ToInternalValue());
miu 2016/06/07 20:03:47 It'd be a bit cleaner to do this instead: base:
qiangchen 2016/06/08 18:04:30 Done. But with reference time moved into metadata
171 video_capture_impl_->OnBufferReceived( 174 video_capture_impl_->OnBufferReceived(
172 buffer_id, base::TimeTicks::Now(), base::DictionaryValue(), 175 buffer_id, now, timestamp, base::DictionaryValue(),
173 media::PIXEL_FORMAT_I420, media::VideoFrame::STORAGE_SHMEM, size, 176 media::PIXEL_FORMAT_I420, media::VideoFrame::STORAGE_SHMEM, size,
174 gfx::Rect(size)); 177 gfx::Rect(size));
175 } 178 }
176 179
177 void BufferDestroyed(int buffer_id) { 180 void BufferDestroyed(int buffer_id) {
178 video_capture_impl_->OnBufferDestroyed(buffer_id); 181 video_capture_impl_->OnBufferDestroyed(buffer_id);
179 } 182 }
180 183
181 void DeInit() { 184 void DeInit() {
182 video_capture_impl_->DeInit(); 185 video_capture_impl_->DeInit();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 StartCapture(0, params_small_); 375 StartCapture(0, params_small_);
373 376
374 // Receive state change message from browser. 377 // Receive state change message from browser.
375 video_capture_impl_->ReceiveStateChangeMessage(VIDEO_CAPTURE_STATE_ERROR); 378 video_capture_impl_->ReceiveStateChangeMessage(VIDEO_CAPTURE_STATE_ERROR);
376 379
377 StopCapture(0); 380 StopCapture(0);
378 DeInit(); 381 DeInit();
379 } 382 }
380 383
381 } // namespace content 384 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698