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

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

Issue 2065733003: Delete unused and almost unused frame-related methods. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Eliminate call to set_video_frame_buffer. 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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 ALOGE << "Encoder got stuck. Reset."; 663 ALOGE << "Encoder got stuck. Reset.";
664 ResetCodecOnCodecThread(); 664 ResetCodecOnCodecThread();
665 return WEBRTC_VIDEO_CODEC_ERROR; 665 return WEBRTC_VIDEO_CODEC_ERROR;
666 } 666 }
667 frames_dropped_media_encoder_++; 667 frames_dropped_media_encoder_++;
668 OnDroppedFrameOnCodecThread(); 668 OnDroppedFrameOnCodecThread();
669 return WEBRTC_VIDEO_CODEC_OK; 669 return WEBRTC_VIDEO_CODEC_OK;
670 } 670 }
671 consecutive_full_queue_frame_drops_ = 0; 671 consecutive_full_queue_frame_drops_ = 0;
672 672
673 VideoFrame input_frame = frame; 673 rtc::scoped_refptr<webrtc::VideoFrameBuffer> input_buffer(
674 frame.video_frame_buffer());
674 if (scale_) { 675 if (scale_) {
675 // Check framerate before spatial resolution change. 676 // Check framerate before spatial resolution change.
676 quality_scaler_.OnEncodeFrame(frame.width(), frame.height()); 677 quality_scaler_.OnEncodeFrame(frame.width(), frame.height());
677 const webrtc::QualityScaler::Resolution scaled_resolution = 678 const webrtc::QualityScaler::Resolution scaled_resolution =
678 quality_scaler_.GetScaledResolution(); 679 quality_scaler_.GetScaledResolution();
679 if (scaled_resolution.width != frame.width() || 680 if (scaled_resolution.width != frame.width() ||
680 scaled_resolution.height != frame.height()) { 681 scaled_resolution.height != frame.height()) {
681 if (frame.video_frame_buffer()->native_handle() != nullptr) { 682 if (input_buffer->native_handle() != nullptr) {
682 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer( 683 input_buffer = static_cast<AndroidTextureBuffer*>(input_buffer.get())
683 static_cast<AndroidTextureBuffer*>( 684 ->CropScaleAndRotate(frame.width(), frame.height(),
684 frame.video_frame_buffer().get())->CropScaleAndRotate( 685 0, 0,
685 frame.width(), frame.height(), 0, 0, 686 scaled_resolution.width,
686 scaled_resolution.width, scaled_resolution.height, 687 scaled_resolution.height,
687 webrtc::kVideoRotation_0)); 688 webrtc::kVideoRotation_0);
688 input_frame.set_video_frame_buffer(scaled_buffer);
689 } else { 689 } else {
690 input_frame.set_video_frame_buffer( 690 input_buffer = quality_scaler_.GetScaledBuffer(input_buffer);
691 quality_scaler_.GetScaledBuffer(frame.video_frame_buffer()));
692 } 691 }
693 } 692 }
694 } 693 }
695 694
695 VideoFrame input_frame(input_buffer, frame.timestamp(),
696 frame.render_time_ms(), frame.rotation());
697
696 if (!MaybeReconfigureEncoderOnCodecThread(input_frame)) { 698 if (!MaybeReconfigureEncoderOnCodecThread(input_frame)) {
697 ALOGE << "Failed to reconfigure encoder."; 699 ALOGE << "Failed to reconfigure encoder.";
698 return WEBRTC_VIDEO_CODEC_ERROR; 700 return WEBRTC_VIDEO_CODEC_ERROR;
699 } 701 }
700 702
701 const int64_t time_before_calling_encode = rtc::TimeMillis(); 703 const int64_t time_before_calling_encode = rtc::TimeMillis();
702 const bool key_frame = 704 const bool key_frame =
703 frame_types->front() != webrtc::kVideoFrameDelta || send_key_frame; 705 frame_types->front() != webrtc::kVideoFrameDelta || send_key_frame;
704 bool encode_status = true; 706 bool encode_status = true;
705 if (!input_frame.video_frame_buffer()->native_handle()) { 707 if (!input_frame.video_frame_buffer()->native_handle()) {
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 return supported_codecs_; 1279 return supported_codecs_;
1278 } 1280 }
1279 1281
1280 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( 1282 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder(
1281 webrtc::VideoEncoder* encoder) { 1283 webrtc::VideoEncoder* encoder) {
1282 ALOGD << "Destroy video encoder."; 1284 ALOGD << "Destroy video encoder.";
1283 delete encoder; 1285 delete encoder;
1284 } 1286 }
1285 1287
1286 } // namespace webrtc_jni 1288 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/api/java/jni/androidmediadecoder_jni.cc ('k') | webrtc/api/java/jni/androidvideocapturer_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698