Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Side by Side Diff: webrtc/api/java/jni/androidmediaencoder_jni.cc

Issue 2020593002: Refactor scaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Delete ShallowCenterCrop. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
667 } 667 }
668 frames_dropped_media_encoder_++; 668 frames_dropped_media_encoder_++;
669 OnDroppedFrameOnCodecThread(); 669 OnDroppedFrameOnCodecThread();
670 return WEBRTC_VIDEO_CODEC_OK; 670 return WEBRTC_VIDEO_CODEC_OK;
671 } 671 }
672 consecutive_full_queue_frame_drops_ = 0; 672 consecutive_full_queue_frame_drops_ = 0;
673 673
674 VideoFrame input_frame = frame; 674 VideoFrame input_frame = frame;
675 if (scale_) { 675 if (scale_) {
676 // Check framerate before spatial resolution change. 676 // Check framerate before spatial resolution change.
677 quality_scaler_.OnEncodeFrame(frame); 677 quality_scaler_.OnEncodeFrame(frame.width(), frame.height());
678 const webrtc::QualityScaler::Resolution scaled_resolution = 678 const webrtc::QualityScaler::Resolution scaled_resolution =
679 quality_scaler_.GetScaledResolution(); 679 quality_scaler_.GetScaledResolution();
680 if (scaled_resolution.width != frame.width() || 680 if (scaled_resolution.width != frame.width() ||
681 scaled_resolution.height != frame.height()) { 681 scaled_resolution.height != frame.height()) {
682 if (frame.video_frame_buffer()->native_handle() != nullptr) { 682 if (frame.video_frame_buffer()->native_handle() != nullptr) {
683 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer( 683 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer(
684 static_cast<AndroidTextureBuffer*>( 684 static_cast<AndroidTextureBuffer*>(
685 frame.video_frame_buffer().get())->CropScaleAndRotate( 685 frame.video_frame_buffer().get())->CropScaleAndRotate(
686 frame.width(), frame.height(), 0, 0, 686 frame.width(), frame.height(), 0, 0,
687 scaled_resolution.width, scaled_resolution.height, 687 scaled_resolution.width, scaled_resolution.height,
688 webrtc::kVideoRotation_0)); 688 webrtc::kVideoRotation_0));
689 input_frame.set_video_frame_buffer(scaled_buffer); 689 input_frame.set_video_frame_buffer(scaled_buffer);
690 } else { 690 } else {
691 input_frame = quality_scaler_.GetScaledFrame(frame); 691 input_frame.set_video_frame_buffer(
692 quality_scaler_.GetScaledFrame(frame.video_frame_buffer()));
pbos-webrtc 2016/05/31 14:14:01 GetScaledVideoFrameBuffer?
nisse-webrtc 2016/06/01 09:15:17 If you really want, I can rename the quality scale
pbos-webrtc 2016/06/01 15:55:41 No but I think you should know what you get out of
nisse-webrtc 2016/06/02 09:00:06 Done, renamed to GetScaledBuffer.
692 } 693 }
693 } 694 }
694 } 695 }
695 696
696 if (!MaybeReconfigureEncoderOnCodecThread(input_frame)) { 697 if (!MaybeReconfigureEncoderOnCodecThread(input_frame)) {
697 ALOGE << "Failed to reconfigure encoder."; 698 ALOGE << "Failed to reconfigure encoder.";
698 return WEBRTC_VIDEO_CODEC_ERROR; 699 return WEBRTC_VIDEO_CODEC_ERROR;
699 } 700 }
700 701
701 const int64_t time_before_calling_encode = rtc::TimeMillis(); 702 const int64_t time_before_calling_encode = rtc::TimeMillis();
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 return supported_codecs_; 1276 return supported_codecs_;
1276 } 1277 }
1277 1278
1278 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 1279 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
1279 webrtc::VideoEncoder* encoder) { 1280 webrtc::VideoEncoder* encoder) {
1280 ALOGD << "Destroy video encoder."; 1281 ALOGD << "Destroy video encoder.";
1281 delete encoder; 1282 delete encoder;
1282 } 1283 }
1283 1284
1284 } // namespace webrtc_jni 1285 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/java/jni/androidvideocapturer_jni.cc » ('j') | webrtc/common_video/include/video_frame_buffer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698