OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 if (scale_) { | 676 if (scale_) { |
677 // Check framerate before spatial resolution change. | 677 // Check framerate before spatial resolution change. |
678 quality_scaler_.OnEncodeFrame(frame); | 678 quality_scaler_.OnEncodeFrame(frame); |
679 const webrtc::QualityScaler::Resolution scaled_resolution = | 679 const webrtc::QualityScaler::Resolution scaled_resolution = |
680 quality_scaler_.GetScaledResolution(); | 680 quality_scaler_.GetScaledResolution(); |
681 if (scaled_resolution.width != frame.width() || | 681 if (scaled_resolution.width != frame.width() || |
682 scaled_resolution.height != frame.height()) { | 682 scaled_resolution.height != frame.height()) { |
683 if (frame.video_frame_buffer()->native_handle() != nullptr) { | 683 if (frame.video_frame_buffer()->native_handle() != nullptr) { |
684 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer( | 684 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer( |
685 static_cast<AndroidTextureBuffer*>( | 685 static_cast<AndroidTextureBuffer*>( |
686 frame.video_frame_buffer().get())->ScaleAndRotate( | 686 frame.video_frame_buffer().get())->CropScaleAndRotate( |
687 scaled_resolution.width, | 687 frame.width(), frame.height(), |
688 scaled_resolution.height, | 688 scaled_resolution.width, scaled_resolution.height, |
689 webrtc::kVideoRotation_0)); | 689 webrtc::kVideoRotation_0)); |
690 input_frame.set_video_frame_buffer(scaled_buffer); | 690 input_frame.set_video_frame_buffer(scaled_buffer); |
691 } else { | 691 } else { |
692 input_frame = quality_scaler_.GetScaledFrame(frame); | 692 input_frame = quality_scaler_.GetScaledFrame(frame); |
693 } | 693 } |
694 } | 694 } |
695 } | 695 } |
696 | 696 |
697 if (!MaybeReconfigureEncoderOnCodecThread(input_frame)) { | 697 if (!MaybeReconfigureEncoderOnCodecThread(input_frame)) { |
698 ALOGE << "Failed to reconfigure encoder."; | 698 ALOGE << "Failed to reconfigure encoder."; |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 return supported_codecs_; | 1269 return supported_codecs_; |
1270 } | 1270 } |
1271 | 1271 |
1272 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 1272 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
1273 webrtc::VideoEncoder* encoder) { | 1273 webrtc::VideoEncoder* encoder) { |
1274 ALOGD << "Destroy video encoder."; | 1274 ALOGD << "Destroy video encoder."; |
1275 delete encoder; | 1275 delete encoder; |
1276 } | 1276 } |
1277 | 1277 |
1278 } // namespace webrtc_jni | 1278 } // namespace webrtc_jni |
OLD | NEW |