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

Unified Diff: talk/app/webrtc/java/jni/native_handle_impl.cc

Issue 1470043002: Support texture scaling in Androids MediaEncoder (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added test in VideoCapturerAndroid Created 5 years, 1 month 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: talk/app/webrtc/java/jni/native_handle_impl.cc
diff --git a/talk/app/webrtc/java/jni/native_handle_impl.cc b/talk/app/webrtc/java/jni/native_handle_impl.cc
index ed9ad8e8918ad1d6e5adb21c42fbb30c82960802..f7cc8068d823259ef1411bb196f1a224f083c721 100644
--- a/talk/app/webrtc/java/jni/native_handle_impl.cc
+++ b/talk/app/webrtc/java/jni/native_handle_impl.cc
@@ -28,9 +28,18 @@
#include "talk/app/webrtc/java/jni/native_handle_impl.h"
#include "webrtc/base/checks.h"
+#include "webrtc/base/bind.h"
+
+using rtc::scoped_refptr;
+using webrtc::NativeHandleBuffer;
namespace webrtc_jni {
+namespace {
+ void ScaledFrameNotInUse(scoped_refptr<NativeHandleBuffer> original) {
+ }
+} // anonymous namespace
+
NativeHandleImpl::NativeHandleImpl(JNIEnv* jni,
jint j_oes_texture_id,
jfloatArray j_transform_matrix)
@@ -64,4 +73,18 @@ AndroidTextureBuffer::NativeToI420Buffer() {
return nullptr;
}
+rtc::scoped_refptr<AndroidTextureBuffer> AndroidTextureBuffer::CropAndScale(
+ int cropped_input_width,
+ int cropped_input_height,
+ int dst_widht,
+ int dst_height) {
+ // TODO(perkj) Implement cropping.
+ // Here we use Bind magic to keep a reference to |this| until the newly
+ // created AndroidTextureBuffer goes out of scope. ScaledFrameNotInUse will be
+ // called when the new buffer is no longer used.
+ return new rtc::RefCountedObject<AndroidTextureBuffer>(
+ dst_widht, dst_height, native_handle_,
+ rtc::Bind(&ScaledFrameNotInUse, this));
+}
+
} // namespace webrtc_jni

Powered by Google App Engine
This is Rietveld 408576698