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

Side by Side Diff: webrtc/api/androidvideocapturer.cc

Issue 1965953003: Android: Add support for cropping textures (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: 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
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 : frame.release(); 81 : frame.release();
82 } 82 }
83 83
84 cricket::VideoFrame* CreateAliasedFrame( 84 cricket::VideoFrame* CreateAliasedFrame(
85 const cricket::CapturedFrame* input_frame, 85 const cricket::CapturedFrame* input_frame,
86 int cropped_input_width, 86 int cropped_input_width,
87 int cropped_input_height, 87 int cropped_input_height,
88 int output_width, 88 int output_width,
89 int output_height) const override { 89 int output_height) const override {
90 if (buffer_->native_handle() != nullptr) { 90 if (buffer_->native_handle() != nullptr) {
91 // TODO(perkj) Implement cropping.
92 RTC_CHECK_EQ(cropped_input_width, buffer_->width());
93 RTC_CHECK_EQ(cropped_input_height, buffer_->height());
94 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer( 91 rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled_buffer(
95 static_cast<webrtc_jni::AndroidTextureBuffer*>(buffer_.get()) 92 static_cast<webrtc_jni::AndroidTextureBuffer*>(buffer_.get())
96 ->ScaleAndRotate(output_width, output_height, 93 ->CropScaleAndRotate(cropped_input_width, cropped_input_height,
97 apply_rotation_ ? input_frame->rotation : 94 output_width, output_height,
98 webrtc::kVideoRotation_0)); 95 apply_rotation_ ? input_frame->rotation
96 : webrtc::kVideoRotation_0));
99 return new cricket::WebRtcVideoFrame( 97 return new cricket::WebRtcVideoFrame(
100 scaled_buffer, input_frame->time_stamp, 98 scaled_buffer, input_frame->time_stamp,
101 apply_rotation_ ? webrtc::kVideoRotation_0 : input_frame->rotation); 99 apply_rotation_ ? webrtc::kVideoRotation_0 : input_frame->rotation);
102 } 100 }
103 return VideoFrameFactory::CreateAliasedFrame(input_frame, 101 return VideoFrameFactory::CreateAliasedFrame(input_frame,
104 cropped_input_width, 102 cropped_input_width,
105 cropped_input_height, 103 cropped_input_height,
106 output_width, 104 output_width,
107 output_height); 105 output_height);
108 } 106 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 196
199 bool AndroidVideoCapturer::GetBestCaptureFormat( 197 bool AndroidVideoCapturer::GetBestCaptureFormat(
200 const cricket::VideoFormat& desired, 198 const cricket::VideoFormat& desired,
201 cricket::VideoFormat* best_format) { 199 cricket::VideoFormat* best_format) {
202 // Delegate this choice to VideoCapturer.startCapture(). 200 // Delegate this choice to VideoCapturer.startCapture().
203 *best_format = desired; 201 *best_format = desired;
204 return true; 202 return true;
205 } 203 }
206 204
207 } // namespace webrtc 205 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/api/java/jni/androidmediaencoder_jni.cc » ('j') | webrtc/api/java/jni/native_handle_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698