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

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: Metadata over parameter 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 = now - base::TimeTicks();
173
174 int64_t internal_value = now.ToInternalValue();
miu 2016/06/08 19:24:44 This might break in the future if VideoFrameMetada
qiangchen 2016/06/08 20:08:55 Done.
175 base::DictionaryValue metadata;
176 metadata.SetWithoutPathExpansion(
177 base::IntToString(
178 static_cast<int>(media::VideoFrameMetadata::REFERENCE_TIME)),
179 base::BinaryValue::CreateWithCopiedBuffer(
180 reinterpret_cast<const char*>(&internal_value),
181 sizeof(internal_value)));
182
171 video_capture_impl_->OnBufferReceived( 183 video_capture_impl_->OnBufferReceived(
172 buffer_id, base::TimeTicks::Now(), base::DictionaryValue(), 184 buffer_id, timestamp, metadata, media::PIXEL_FORMAT_I420,
173 media::PIXEL_FORMAT_I420, media::VideoFrame::STORAGE_SHMEM, size, 185 media::VideoFrame::STORAGE_SHMEM, size, gfx::Rect(size));
174 gfx::Rect(size));
175 } 186 }
176 187
177 void BufferDestroyed(int buffer_id) { 188 void BufferDestroyed(int buffer_id) {
178 video_capture_impl_->OnBufferDestroyed(buffer_id); 189 video_capture_impl_->OnBufferDestroyed(buffer_id);
179 } 190 }
180 191
181 void DeInit() { 192 void DeInit() {
182 video_capture_impl_->DeInit(); 193 video_capture_impl_->DeInit();
183 } 194 }
184 195
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 StartCapture(0, params_small_); 383 StartCapture(0, params_small_);
373 384
374 // Receive state change message from browser. 385 // Receive state change message from browser.
375 video_capture_impl_->ReceiveStateChangeMessage(VIDEO_CAPTURE_STATE_ERROR); 386 video_capture_impl_->ReceiveStateChangeMessage(VIDEO_CAPTURE_STATE_ERROR);
376 387
377 StopCapture(0); 388 StopCapture(0);
378 DeInit(); 389 DeInit();
379 } 390 }
380 391
381 } // namespace content 392 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698