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

Side by Side Diff: webrtc/test/frame_generator_capturer.cc

Issue 2911193002: Implement timing frames. (Closed)
Patch Set: Fix capture timestamp issues which cause capture time from the future Created 3 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 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 new InsertFrameTask(this, 1000 / framerate_fps)), 153 new InsertFrameTask(this, 1000 / framerate_fps)),
154 1000 / framerate_fps); 154 1000 / framerate_fps);
155 155
156 return true; 156 return true;
157 } 157 }
158 158
159 void FrameGeneratorCapturer::InsertFrame() { 159 void FrameGeneratorCapturer::InsertFrame() {
160 rtc::CritScope cs(&lock_); 160 rtc::CritScope cs(&lock_);
161 if (sending_) { 161 if (sending_) {
162 VideoFrame* frame = frame_generator_->NextFrame(); 162 VideoFrame* frame = frame_generator_->NextFrame();
163 frame->set_timestamp_us(rtc::TimeMicros()); 163 frame->set_timestamp_us(clock_->TimeInMicroseconds());
ilnik 2017/06/01 12:33:37 For consistency.
nisse-webrtc 2017/06/02 12:04:55 I'd rather move in the opposite direction. The fra
ilnik 2017/06/02 13:02:21 I believe we should use clock_ instead of wallcloc
sprang_webrtc 2017/06/09 11:02:01 Agree that we should move towards rtc::TimeMicros
164 frame->set_ntp_time_ms(clock_->CurrentNtpInMilliseconds()); 164 frame->set_ntp_time_ms(clock_->CurrentNtpInMilliseconds());
165 frame->set_rotation(fake_rotation_); 165 frame->set_rotation(fake_rotation_);
166 if (first_frame_capture_time_ == -1) { 166 if (first_frame_capture_time_ == -1) {
167 first_frame_capture_time_ = frame->ntp_time_ms(); 167 first_frame_capture_time_ = frame->ntp_time_ms();
168 } 168 }
169 169
170 if (sink_) { 170 if (sink_) {
171 rtc::Optional<VideoFrame> out_frame = AdaptFrame(*frame); 171 rtc::Optional<VideoFrame> out_frame = AdaptFrame(*frame);
172 if (out_frame) 172 if (out_frame)
173 sink_->OnFrame(*out_frame); 173 sink_->OnFrame(*out_frame);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 235
236 int FrameGeneratorCapturer::GetCurrentConfiguredFramerate() { 236 int FrameGeneratorCapturer::GetCurrentConfiguredFramerate() {
237 rtc::CritScope cs(&lock_); 237 rtc::CritScope cs(&lock_);
238 if (wanted_fps_ && *wanted_fps_ < target_fps_) 238 if (wanted_fps_ && *wanted_fps_ < target_fps_)
239 return *wanted_fps_; 239 return *wanted_fps_;
240 return target_fps_; 240 return target_fps_;
241 } 241 }
242 242
243 } // namespace test 243 } // namespace test
244 } // namespace webrtc 244 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698