| Index: webrtc/api/androidvideotracksource.cc
|
| diff --git a/webrtc/api/androidvideotracksource.cc b/webrtc/api/androidvideotracksource.cc
|
| index 000337d34d6df8c8ccb46a0b2bd08372c4003f6a..5a4fac97fd5a5fdd1e00e985bae2fb34799af60c 100644
|
| --- a/webrtc/api/androidvideotracksource.cc
|
| +++ b/webrtc/api/androidvideotracksource.cc
|
| @@ -100,9 +100,11 @@ void AndroidVideoTrackSource::OnByteBufferFrameCaptured(const void* frame_data,
|
| int crop_y;
|
| int64_t translated_camera_time_us;
|
|
|
| - if (!AdaptFrame(width, height, timestamp_ns / rtc::kNumNanosecsPerMicrosec,
|
| - &adapted_width, &adapted_height, &crop_width, &crop_height,
|
| - &crop_x, &crop_y, &translated_camera_time_us)) {
|
| + if (!adapted_source_.AdaptFrame(
|
| + width, height, timestamp_ns / rtc::kNumNanosecsPerMicrosec,
|
| + rtc::TimeMicros(),
|
| + &adapted_width, &adapted_height, &crop_width, &crop_height,
|
| + &crop_x, &crop_y, &translated_camera_time_us)) {
|
| return;
|
| }
|
|
|
| @@ -170,9 +172,10 @@ void AndroidVideoTrackSource::OnTextureFrameCaptured(
|
| int crop_y;
|
| int64_t translated_camera_time_us;
|
|
|
| - if (!AdaptFrame(width, height, timestamp_ns / rtc::kNumNanosecsPerMicrosec,
|
| - &adapted_width, &adapted_height, &crop_width, &crop_height,
|
| - &crop_x, &crop_y, &translated_camera_time_us)) {
|
| + if (!adapted_source_.AdaptFrame(
|
| + width, height, timestamp_ns / rtc::kNumNanosecsPerMicrosec,
|
| + &adapted_width, &adapted_height, &crop_width, &crop_height,
|
| + &crop_x, &crop_y, &translated_camera_time_us)) {
|
| surface_texture_helper_->ReturnTextureFrame();
|
| return;
|
| }
|
| @@ -221,42 +224,7 @@ void AndroidVideoTrackSource::OnOutputFormatRequest(int width,
|
|
|
| cricket::VideoFormat format(width, height,
|
| cricket::VideoFormat::FpsToInterval(fps), 0);
|
| - video_adapter_.OnOutputFormatRequest(format);
|
| -}
|
| -
|
| -bool AndroidVideoTrackSource::AdaptFrame(int width,
|
| - int height,
|
| - int64_t camera_time_us,
|
| - int* out_width,
|
| - int* out_height,
|
| - int* crop_width,
|
| - int* crop_height,
|
| - int* crop_x,
|
| - int* crop_y,
|
| - int64_t* translated_camera_time_us) {
|
| - RTC_DCHECK(camera_thread_checker_.CalledOnValidThread());
|
| -
|
| - int64_t system_time_us = rtc::TimeMicros();
|
| -
|
| - int64_t offset_us =
|
| - timestamp_aligner_.UpdateOffset(camera_time_us, system_time_us);
|
| -
|
| - if (!broadcaster_.frame_wanted()) {
|
| - return false;
|
| - }
|
| -
|
| - if (!video_adapter_.AdaptFrameResolution(
|
| - width, height, camera_time_us * rtc::kNumNanosecsPerMicrosec,
|
| - crop_width, crop_height, out_width, out_height)) {
|
| - // VideoAdapter dropped the frame.
|
| - return false;
|
| - }
|
| - *crop_x = (width - *crop_width) / 2;
|
| - *crop_y = (height - *crop_height) / 2;
|
| -
|
| - *translated_camera_time_us = timestamp_aligner_.ClipTimestamp(
|
| - camera_time_us + offset_us, system_time_us);
|
| - return true;
|
| + adapted_source_.video_adapter()->OnOutputFormatRequest(format);
|
| }
|
|
|
| } // namespace webrtc
|
|
|