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

Side by Side Diff: webrtc/media/base/fakevideocapturer.h

Issue 1865283002: Use microsecond timestamp in cricket::VideoFrame. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add missing override, intending to reland. Created 4 years, 8 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
« no previous file with comments | « no previous file | webrtc/media/base/videobroadcaster.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 13 matching lines...) Expand all
24 #include "webrtc/media/engine/webrtcvideoframefactory.h" 24 #include "webrtc/media/engine/webrtcvideoframefactory.h"
25 #endif 25 #endif
26 26
27 namespace cricket { 27 namespace cricket {
28 28
29 // Fake video capturer that allows the test to manually pump in frames. 29 // Fake video capturer that allows the test to manually pump in frames.
30 class FakeVideoCapturer : public cricket::VideoCapturer { 30 class FakeVideoCapturer : public cricket::VideoCapturer {
31 public: 31 public:
32 FakeVideoCapturer(bool is_screencast) 32 FakeVideoCapturer(bool is_screencast)
33 : running_(false), 33 : running_(false),
34 initial_unix_timestamp_(time(NULL) * rtc::kNumNanosecsPerSec), 34 initial_timestamp_(rtc::TimeNanos()),
35 next_timestamp_(rtc::kNumNanosecsPerMillisec), 35 next_timestamp_(rtc::kNumNanosecsPerMillisec),
36 is_screencast_(is_screencast), 36 is_screencast_(is_screencast),
37 rotation_(webrtc::kVideoRotation_0) { 37 rotation_(webrtc::kVideoRotation_0) {
38 #ifdef HAVE_WEBRTC_VIDEO 38 #ifdef HAVE_WEBRTC_VIDEO
39 set_frame_factory(new cricket::WebRtcVideoFrameFactory()); 39 set_frame_factory(new cricket::WebRtcVideoFrameFactory());
40 #endif 40 #endif
41 // Default supported formats. Use ResetSupportedFormats to over write. 41 // Default supported formats. Use ResetSupportedFormats to over write.
42 std::vector<cricket::VideoFormat> formats; 42 std::vector<cricket::VideoFormat> formats;
43 formats.push_back(cricket::VideoFormat(1280, 720, 43 formats.push_back(cricket::VideoFormat(1280, 720,
44 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); 44 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 if (size == 0u) { 93 if (size == 0u) {
94 return false; // Width and/or Height were zero. 94 return false; // Width and/or Height were zero.
95 } 95 }
96 96
97 cricket::CapturedFrame frame; 97 cricket::CapturedFrame frame;
98 frame.width = width; 98 frame.width = width;
99 frame.height = height; 99 frame.height = height;
100 frame.fourcc = fourcc; 100 frame.fourcc = fourcc;
101 frame.data_size = size; 101 frame.data_size = size;
102 frame.time_stamp = initial_unix_timestamp_ + next_timestamp_; 102 frame.time_stamp = initial_timestamp_ + next_timestamp_;
103 next_timestamp_ += timestamp_interval; 103 next_timestamp_ += timestamp_interval;
104 104
105 std::unique_ptr<char[]> data(new char[size]); 105 std::unique_ptr<char[]> data(new char[size]);
106 frame.data = data.get(); 106 frame.data = data.get();
107 // Copy something non-zero into the buffer so Validate wont complain that 107 // Copy something non-zero into the buffer so Validate wont complain that
108 // the frame is all duplicate. 108 // the frame is all duplicate.
109 memset(frame.data, 1, size / 2); 109 memset(frame.data, 1, size / 2);
110 memset(reinterpret_cast<uint8_t*>(frame.data) + (size / 2), 2, 110 memset(reinterpret_cast<uint8_t*>(frame.data) + (size / 2), 2,
111 size - (size / 2)); 111 size - (size / 2));
112 memcpy(frame.data, reinterpret_cast<const uint8_t*>(&fourcc), 4); 112 memcpy(frame.data, reinterpret_cast<const uint8_t*>(&fourcc), 4);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 void SetRotation(webrtc::VideoRotation rotation) { 148 void SetRotation(webrtc::VideoRotation rotation) {
149 rotation_ = rotation; 149 rotation_ = rotation;
150 } 150 }
151 151
152 webrtc::VideoRotation GetRotation() { return rotation_; } 152 webrtc::VideoRotation GetRotation() { return rotation_; }
153 153
154 private: 154 private:
155 bool running_; 155 bool running_;
156 int64_t initial_unix_timestamp_; 156 int64_t initial_timestamp_;
157 int64_t next_timestamp_; 157 int64_t next_timestamp_;
158 const bool is_screencast_; 158 const bool is_screencast_;
159 webrtc::VideoRotation rotation_; 159 webrtc::VideoRotation rotation_;
160 }; 160 };
161 161
162 } // namespace cricket 162 } // namespace cricket
163 163
164 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_ 164 #endif // WEBRTC_MEDIA_BASE_FAKEVIDEOCAPTURER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/media/base/videobroadcaster.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698