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

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

Issue 1973873003: Delete AndroidVideoCapturer::FrameFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address nit. Delete left-over include. Created 4 years, 7 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
« no previous file with comments | « webrtc/api/androidvideocapturer.cc ('k') | webrtc/api/java/jni/androidvideocapturer_jni.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
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*>(
678 frame.video_frame_buffer().get())->CropScaleAndRotate( 678 frame.video_frame_buffer().get())->CropScaleAndRotate(
679 frame.width(), frame.height(), 679 frame.width(), frame.height(), 0, 0,
680 scaled_resolution.width, scaled_resolution.height, 680 scaled_resolution.width, 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)) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 CHECK_EXCEPTION(jni); 805 CHECK_EXCEPTION(jni);
806 return encode_status; 806 return encode_status;
807 } 807 }
808 808
809 bool MediaCodecVideoEncoder::EncodeTextureOnCodecThread(JNIEnv* jni, 809 bool MediaCodecVideoEncoder::EncodeTextureOnCodecThread(JNIEnv* jni,
810 bool key_frame, const webrtc::VideoFrame& frame) { 810 bool key_frame, const webrtc::VideoFrame& frame) {
811 RTC_DCHECK(codec_thread_checker_.CalledOnValidThread()); 811 RTC_DCHECK(codec_thread_checker_.CalledOnValidThread());
812 RTC_CHECK(use_surface_); 812 RTC_CHECK(use_surface_);
813 NativeHandleImpl* handle = static_cast<NativeHandleImpl*>( 813 NativeHandleImpl* handle = static_cast<NativeHandleImpl*>(
814 frame.video_frame_buffer()->native_handle()); 814 frame.video_frame_buffer()->native_handle());
815 jfloatArray sampling_matrix = jni->NewFloatArray(16); 815 jfloatArray sampling_matrix = handle->sampling_matrix.ToJava(jni);
816 jni->SetFloatArrayRegion(sampling_matrix, 0, 16, handle->sampling_matrix);
817
818 bool encode_status = jni->CallBooleanMethod(*j_media_codec_video_encoder_, 816 bool encode_status = jni->CallBooleanMethod(*j_media_codec_video_encoder_,
819 j_encode_texture_method_, 817 j_encode_texture_method_,
820 key_frame, 818 key_frame,
821 handle->oes_texture_id, 819 handle->oes_texture_id,
822 sampling_matrix, 820 sampling_matrix,
823 current_timestamp_us_); 821 current_timestamp_us_);
824 CHECK_EXCEPTION(jni); 822 CHECK_EXCEPTION(jni);
825 return encode_status; 823 return encode_status;
826 } 824 }
827 825
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 return supported_codecs_; 1262 return supported_codecs_;
1265 } 1263 }
1266 1264
1267 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 1265 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
1268 webrtc::VideoEncoder* encoder) { 1266 webrtc::VideoEncoder* encoder) {
1269 ALOGD << "Destroy video encoder."; 1267 ALOGD << "Destroy video encoder.";
1270 delete encoder; 1268 delete encoder;
1271 } 1269 }
1272 1270
1273 } // namespace webrtc_jni 1271 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/api/androidvideocapturer.cc ('k') | webrtc/api/java/jni/androidvideocapturer_jni.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698