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

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

Issue 2020593002: Refactor scaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Include <algorithm>, needed for std::min. 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/androidvideocapturer_jni.cc
diff --git a/webrtc/api/java/jni/androidvideocapturer_jni.cc b/webrtc/api/java/jni/androidvideocapturer_jni.cc
index 0e8e8677ab54955ae27a341a8492d83de64d1063..96e4147f1ef0c05bbec54d2981ab7bd78ae3f0a8 100644
--- a/webrtc/api/java/jni/androidvideocapturer_jni.cc
+++ b/webrtc/api/java/jni/androidvideocapturer_jni.cc
@@ -13,7 +13,6 @@
#include "webrtc/api/java/jni/native_handle_impl.h"
#include "webrtc/api/java/jni/surfacetexturehelper_jni.h"
#include "third_party/libyuv/include/libyuv/convert.h"
-#include "third_party/libyuv/include/libyuv/scale.h"
#include "webrtc/base/bind.h"
namespace webrtc_jni {
@@ -217,23 +216,9 @@ void AndroidVideoCapturerJni::OnMemoryBufferFrame(void* video_frame,
capturer_->apply_rotation() ? rotation : 0));
if (adapted_width != rotated_width || adapted_height != rotated_height) {
- rtc::scoped_refptr<webrtc::VideoFrameBuffer> scaled =
- post_scale_pool_.CreateBuffer(adapted_width, adapted_height);
- // TODO(nisse): This should be done by some Scale method in
- // I420Buffer, but we can't do that right now, since
- // I420BufferPool uses a wrapper object.
- if (libyuv::I420Scale(buffer->DataY(), buffer->StrideY(),
- buffer->DataU(), buffer->StrideU(),
- buffer->DataV(), buffer->StrideV(),
- rotated_width, rotated_height,
- scaled->MutableDataY(), scaled->StrideY(),
- scaled->MutableDataU(), scaled->StrideU(),
- scaled->MutableDataV(), scaled->StrideV(),
- adapted_width, adapted_height,
- libyuv::kFilterBox) < 0) {
- LOG(LS_WARNING) << "I420Scale failed";
- return;
- }
+ rtc::scoped_refptr<webrtc::I420Buffer> scaled =
+ post_scale_pool_.CreateBuffer(adapted_width, adapted_height);
+ scaled->CropAndScale(buffer, 0, 0, rotated_width, rotated_height);
magjed_webrtc 2016/05/30 11:58:26 You should use crop_x/crop_y instead of 0?
nisse-webrtc 2016/05/30 12:58:22 I don't think so. Cropping was done in the above c
buffer = scaled;
}
// TODO(nisse): Use microsecond time instead.

Powered by Google App Engine
This is Rietveld 408576698