OLD | NEW |
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 Loading... |
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, |
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 |
OLD | NEW |