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

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

Issue 1983193002: Decouple capture timestamp and reference time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve Comments Created 4 years, 7 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 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/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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 const std::string& reason)); 67 const std::string& reason));
68 68
69 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb) 69 explicit MockClient(base::Callback<void(const VideoCaptureFormat&)> frame_cb)
70 : frame_cb_(frame_cb) {} 70 : frame_cb_(frame_cb) {}
71 71
72 // Client virtual methods for capturing using Device Buffers. 72 // Client virtual methods for capturing using Device Buffers.
73 void OnIncomingCapturedData(const uint8_t* data, 73 void OnIncomingCapturedData(const uint8_t* data,
74 int length, 74 int length,
75 const VideoCaptureFormat& format, 75 const VideoCaptureFormat& format,
76 int rotation, 76 int rotation,
77 const base::TimeTicks& timestamp) { 77 base::TimeTicks reference_time,
78 base::TimeDelta timestamp) override {
78 frame_cb_.Run(format); 79 frame_cb_.Run(format);
79 } 80 }
80 // Virtual methods for capturing using Client's Buffers. 81 // Virtual methods for capturing using Client's Buffers.
81 std::unique_ptr<Buffer> ReserveOutputBuffer( 82 std::unique_ptr<Buffer> ReserveOutputBuffer(
82 const gfx::Size& dimensions, 83 const gfx::Size& dimensions,
83 media::VideoPixelFormat format, 84 media::VideoPixelFormat format,
84 media::VideoPixelStorage storage) { 85 media::VideoPixelStorage storage) {
85 EXPECT_TRUE((format == media::PIXEL_FORMAT_ARGB && 86 EXPECT_TRUE((format == media::PIXEL_FORMAT_ARGB &&
86 storage == media::PIXEL_STORAGE_CPU) || 87 storage == media::PIXEL_STORAGE_CPU) ||
87 (format == media::PIXEL_FORMAT_I420 && 88 (format == media::PIXEL_FORMAT_I420 &&
88 storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER)); 89 storage == media::PIXEL_STORAGE_GPUMEMORYBUFFER));
89 EXPECT_GT(dimensions.GetArea(), 0); 90 EXPECT_GT(dimensions.GetArea(), 0);
90 const VideoCaptureFormat frame_format(dimensions, 0.0, format); 91 const VideoCaptureFormat frame_format(dimensions, 0.0, format);
91 return base::WrapUnique( 92 return base::WrapUnique(
92 new MockBuffer(0, frame_format.ImageAllocationSize())); 93 new MockBuffer(0, frame_format.ImageAllocationSize()));
93 } 94 }
94 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, 95 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer,
95 const VideoCaptureFormat& frame_format, 96 const VideoCaptureFormat& frame_format,
96 const base::TimeTicks& timestamp) { 97 base::TimeTicks reference_time,
98 base::TimeDelta timestamp) {
97 frame_cb_.Run(frame_format); 99 frame_cb_.Run(frame_format);
98 } 100 }
99 void OnIncomingCapturedVideoFrame( 101 void OnIncomingCapturedVideoFrame(
100 std::unique_ptr<Buffer> buffer, 102 std::unique_ptr<Buffer> buffer,
101 const scoped_refptr<media::VideoFrame>& frame, 103 const scoped_refptr<media::VideoFrame>& frame,
102 const base::TimeTicks& timestamp) { 104 base::TimeTicks reference_time) {
103 VideoCaptureFormat format(frame->natural_size(), 30.0, 105 VideoCaptureFormat format(frame->natural_size(), 30.0,
104 PIXEL_FORMAT_I420); 106 PIXEL_FORMAT_I420);
105 frame_cb_.Run(format); 107 frame_cb_.Run(format);
106 } 108 }
107 std::unique_ptr<Buffer> ResurrectLastOutputBuffer( 109 std::unique_ptr<Buffer> ResurrectLastOutputBuffer(
108 const gfx::Size& dimensions, 110 const gfx::Size& dimensions,
109 media::VideoPixelFormat format, 111 media::VideoPixelFormat format,
110 media::VideoPixelStorage storage) { 112 media::VideoPixelStorage storage) {
111 return std::unique_ptr<Buffer>(); 113 return std::unique_ptr<Buffer>();
112 } 114 }
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 321 }
320 } 322 }
321 323
322 INSTANTIATE_TEST_CASE_P(, 324 INSTANTIATE_TEST_CASE_P(,
323 FakeVideoCaptureDeviceCommandLineTest, 325 FakeVideoCaptureDeviceCommandLineTest,
324 Values(CommandLineTestData{"fps=-1", 5}, 326 Values(CommandLineTestData{"fps=-1", 5},
325 CommandLineTestData{"fps=29.97", 29.97f}, 327 CommandLineTestData{"fps=29.97", 29.97f},
326 CommandLineTestData{"fps=60", 60}, 328 CommandLineTestData{"fps=60", 60},
327 CommandLineTestData{"fps=1000", 60})); 329 CommandLineTestData{"fps=1000", 60}));
328 }; // namespace media 330 }; // namespace media
OLDNEW
« no previous file with comments | « media/capture/video/fake_video_capture_device.cc ('k') | media/capture/video/file_video_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698