OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 int height, | 218 int height, |
219 int64_t camera_time_us, | 219 int64_t camera_time_us, |
220 int64_t system_time_us, | 220 int64_t system_time_us, |
221 int* out_width, | 221 int* out_width, |
222 int* out_height, | 222 int* out_height, |
223 int* crop_width, | 223 int* crop_width, |
224 int* crop_height, | 224 int* crop_height, |
225 int* crop_x, | 225 int* crop_x, |
226 int* crop_y, | 226 int* crop_y, |
227 int64_t* translated_camera_time_us) { | 227 int64_t* translated_camera_time_us) { |
228 int64_t offset_us = | 228 if (translated_camera_time_us) { |
229 translated_camera_time_us | 229 *translated_camera_time_us = |
230 ? timestamp_aligner_.UpdateOffset(camera_time_us, system_time_us) | 230 timestamp_aligner_.TranslateTimestamp(camera_time_us, system_time_us); |
231 : 0; | 231 } |
232 | |
233 if (!broadcaster_.frame_wanted()) { | 232 if (!broadcaster_.frame_wanted()) { |
234 return false; | 233 return false; |
235 } | 234 } |
236 | 235 |
237 if (enable_video_adapter_ && !IsScreencast()) { | 236 if (enable_video_adapter_ && !IsScreencast()) { |
238 if (!video_adapter_.AdaptFrameResolution( | 237 if (!video_adapter_.AdaptFrameResolution( |
239 width, height, camera_time_us * rtc::kNumNanosecsPerMicrosec, | 238 width, height, camera_time_us * rtc::kNumNanosecsPerMicrosec, |
perkj_webrtc
2016/09/12 09:33:46
use translated time?
| |
240 crop_width, crop_height, out_width, out_height)) { | 239 crop_width, crop_height, out_width, out_height)) { |
241 // VideoAdapter dropped the frame. | 240 // VideoAdapter dropped the frame. |
242 return false; | 241 return false; |
243 } | 242 } |
244 *crop_x = (width - *crop_width) / 2; | 243 *crop_x = (width - *crop_width) / 2; |
245 *crop_y = (height - *crop_height) / 2; | 244 *crop_y = (height - *crop_height) / 2; |
246 } else { | 245 } else { |
247 *out_width = width; | 246 *out_width = width; |
248 *out_height = height; | 247 *out_height = height; |
249 *crop_width = width; | 248 *crop_width = width; |
250 *crop_height = height; | 249 *crop_height = height; |
251 *crop_x = 0; | 250 *crop_x = 0; |
252 *crop_y = 0; | 251 *crop_y = 0; |
253 } | 252 } |
254 | 253 |
255 if (translated_camera_time_us) { | |
256 *translated_camera_time_us = timestamp_aligner_.ClipTimestamp( | |
257 camera_time_us + offset_us, system_time_us); | |
258 } | |
259 return true; | 254 return true; |
260 } | 255 } |
261 | 256 |
262 void VideoCapturer::OnFrameCaptured(VideoCapturer*, | 257 void VideoCapturer::OnFrameCaptured(VideoCapturer*, |
263 const CapturedFrame* captured_frame) { | 258 const CapturedFrame* captured_frame) { |
264 int out_width; | 259 int out_width; |
265 int out_height; | 260 int out_height; |
266 int crop_width; | 261 int crop_width; |
267 int crop_height; | 262 int crop_height; |
268 int crop_x; | 263 int crop_x; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
451 void VideoCapturer::UpdateInputSize(int width, int height) { | 446 void VideoCapturer::UpdateInputSize(int width, int height) { |
452 // Update stats protected from fetches from different thread. | 447 // Update stats protected from fetches from different thread. |
453 rtc::CritScope cs(&frame_stats_crit_); | 448 rtc::CritScope cs(&frame_stats_crit_); |
454 | 449 |
455 input_size_valid_ = true; | 450 input_size_valid_ = true; |
456 input_width_ = width; | 451 input_width_ = width; |
457 input_height_ = height; | 452 input_height_ = height; |
458 } | 453 } |
459 | 454 |
460 } // namespace cricket | 455 } // namespace cricket |
OLD | NEW |