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

Unified Diff: webrtc/api/java/jni/native_handle_impl.cc

Issue 1973873003: Delete AndroidVideoCapturer::FrameFactory. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fix width/height typo. Tests. Formatting. 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/api/java/jni/native_handle_impl.cc
diff --git a/webrtc/api/java/jni/native_handle_impl.cc b/webrtc/api/java/jni/native_handle_impl.cc
index 1f180ade9cc79ff33bcd6f1174d6817e44187b4a..9f8bed7e5c3e289ec4984f734bb37f1828e01df9 100644
--- a/webrtc/api/java/jni/native_handle_impl.cc
+++ b/webrtc/api/java/jni/native_handle_impl.cc
@@ -75,11 +75,11 @@ void MultiplyMatrix(const float a[16], const float b[16], float result[16]) {
// Center crop by keeping xFraction of the width and yFraction of the height,
// so e.g. cropping from 640x480 to 640x360 would use
// xFraction=1, yFraction=360/480.
-void CropMatrix(float a[16], float xFraction, float yFraction) {
- // Move cropped area to the center of the frame by offsetting half the
- // removed area.
- const float xOffset = (1 - xFraction) / 2;
- const float yOffset = (1 - yFraction) / 2;
+void CropMatrix(float a[16],
+ float xFraction,
+ float yFraction,
+ float xOffset,
+ float yOffset) {
const float crop_matrix[16] = {
xFraction, 0, 0, 0,
0, yFraction, 0, 0,
@@ -179,6 +179,8 @@ AndroidTextureBuffer::NativeToI420Buffer() {
rtc::scoped_refptr<AndroidTextureBuffer>
AndroidTextureBuffer::CropScaleAndRotate(int cropped_width,
int cropped_height,
+ int crop_x,
+ int crop_y,
int dst_width,
int dst_height,
webrtc::VideoRotation rotation) {
@@ -200,7 +202,9 @@ AndroidTextureBuffer::CropScaleAndRotate(int cropped_width,
if (cropped_width != width() || cropped_height != height()) {
CropMatrix(buffer->native_handle_.sampling_matrix,
cropped_width / static_cast<float>(width()),
- cropped_height / static_cast<float>(height()));
+ cropped_height / static_cast<float>(height()),
+ crop_x / static_cast<float>(width()),
+ crop_y / static_cast<float>(height()));
}
RotateMatrix(buffer->native_handle_.sampling_matrix, rotation);
return buffer;

Powered by Google App Engine
This is Rietveld 408576698