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

Side by Side Diff: webrtc/api/androidvideotracksource.cc

Issue 2325563002: New method TimestampAligner::TranslateTimestamp (Closed)
Patch Set: Log (unlikely) duplicate timestamps. Improve comments. Created 4 years, 3 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/base/timestampaligner.h » ('j') | webrtc/base/timestampaligner.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 int* out_width, 230 int* out_width,
231 int* out_height, 231 int* out_height,
232 int* crop_width, 232 int* crop_width,
233 int* crop_height, 233 int* crop_height,
234 int* crop_x, 234 int* crop_x,
235 int* crop_y, 235 int* crop_y,
236 int64_t* translated_camera_time_us) { 236 int64_t* translated_camera_time_us) {
237 RTC_DCHECK(camera_thread_checker_.CalledOnValidThread()); 237 RTC_DCHECK(camera_thread_checker_.CalledOnValidThread());
238 238
239 int64_t system_time_us = rtc::TimeMicros(); 239 int64_t system_time_us = rtc::TimeMicros();
240 240 *translated_camera_time_us =
241 int64_t offset_us = 241 timestamp_aligner_.TranslateTimestamp(camera_time_us, system_time_us);
242 timestamp_aligner_.UpdateOffset(camera_time_us, system_time_us);
243 242
244 if (!broadcaster_.frame_wanted()) { 243 if (!broadcaster_.frame_wanted()) {
245 return false; 244 return false;
246 } 245 }
247 246
248 if (!video_adapter_.AdaptFrameResolution( 247 if (!video_adapter_.AdaptFrameResolution(
249 width, height, camera_time_us * rtc::kNumNanosecsPerMicrosec, 248 width, height, camera_time_us * rtc::kNumNanosecsPerMicrosec,
perkj_webrtc 2016/09/12 09:33:46 use translated_camera_time_us here?
nisse-webrtc 2016/09/12 12:04:20 No, camera_time:us is supposedly of better accurac
250 crop_width, crop_height, out_width, out_height)) { 249 crop_width, crop_height, out_width, out_height)) {
251 // VideoAdapter dropped the frame. 250 // VideoAdapter dropped the frame.
252 return false; 251 return false;
253 } 252 }
254 *crop_x = (width - *crop_width) / 2; 253 *crop_x = (width - *crop_width) / 2;
255 *crop_y = (height - *crop_height) / 2; 254 *crop_y = (height - *crop_height) / 2;
256 255
257 *translated_camera_time_us = timestamp_aligner_.ClipTimestamp(
258 camera_time_us + offset_us, system_time_us);
259 return true; 256 return true;
260 } 257 }
261 258
262 } // namespace webrtc 259 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/timestampaligner.h » ('j') | webrtc/base/timestampaligner.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698