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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 VideoFrame input_frame = frame; | 667 VideoFrame input_frame = frame; |
668 if (scale_) { | 668 if (scale_) { |
669 // Check framerate before spatial resolution change. | 669 // Check framerate before spatial resolution change. |
670 quality_scaler_.OnEncodeFrame(frame); | 670 quality_scaler_.OnEncodeFrame(frame); |
671 const webrtc::QualityScaler::Resolution scaled_resolution = | 671 const webrtc::QualityScaler::Resolution scaled_resolution = |
672 quality_scaler_.GetScaledResolution(); | 672 quality_scaler_.GetScaledResolution(); |
673 if (scaled_resolution.width != frame.width() || | 673 if (scaled_resolution.width != frame.width() || |
674 scaled_resolution.height != frame.height()) { | 674 scaled_resolution.height != frame.height()) { |
675 if (frame.video_frame_buffer()->native_handle() != nullptr) { | 675 if (frame.video_frame_buffer()->native_handle() != nullptr) { |
676 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer( | 676 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer( |
677 static_cast<AndroidTextureBuffer*>( | 677 static_cast<AndroidTextureBuffer*>(frame.video_frame_buffer().get()) |
678 frame.video_frame_buffer().get())->CropScaleAndRotate( | 678 ->CropScaleAndRotate(frame.width(), frame.height(), 0, 0, |
679 frame.width(), frame.height(), | 679 scaled_resolution.width, |
680 scaled_resolution.width, scaled_resolution.height, | 680 scaled_resolution.height, |
681 webrtc::kVideoRotation_0)); | 681 webrtc::kVideoRotation_0)); |
682 input_frame.set_video_frame_buffer(scaled_buffer); | 682 input_frame.set_video_frame_buffer(scaled_buffer); |
683 } else { | 683 } else { |
684 input_frame = quality_scaler_.GetScaledFrame(frame); | 684 input_frame = quality_scaler_.GetScaledFrame(frame); |
685 } | 685 } |
686 } | 686 } |
687 } | 687 } |
688 | 688 |
689 if (!MaybeReconfigureEncoderOnCodecThread(input_frame)) { | 689 if (!MaybeReconfigureEncoderOnCodecThread(input_frame)) { |
690 ALOGE << "Failed to reconfigure encoder."; | 690 ALOGE << "Failed to reconfigure encoder."; |
691 return WEBRTC_VIDEO_CODEC_ERROR; | 691 return WEBRTC_VIDEO_CODEC_ERROR; |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 return supported_codecs_; | 1261 return supported_codecs_; |
1262 } | 1262 } |
1263 | 1263 |
1264 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 1264 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
1265 webrtc::VideoEncoder* encoder) { | 1265 webrtc::VideoEncoder* encoder) { |
1266 ALOGD << "Destroy video encoder."; | 1266 ALOGD << "Destroy video encoder."; |
1267 delete encoder; | 1267 delete encoder; |
1268 } | 1268 } |
1269 | 1269 |
1270 } // namespace webrtc_jni | 1270 } // namespace webrtc_jni |
OLD | NEW |