Chromium Code Reviews| Index: remoting/client/jni/chromoting_jni_runtime.cc |
| diff --git a/remoting/client/jni/chromoting_jni_runtime.cc b/remoting/client/jni/chromoting_jni_runtime.cc |
| index 108bb71339d937272e1885c7dd39b03e04d73a1a..11ca7309d3f99f686d37c40a464bcc7a334a5cec 100644 |
| --- a/remoting/client/jni/chromoting_jni_runtime.cc |
| +++ b/remoting/client/jni/chromoting_jni_runtime.cc |
| @@ -13,6 +13,7 @@ |
| #include "media/base/yuv_convert.h" |
| #include "net/android/net_jni_registrar.h" |
| #include "remoting/base/url_request_context.h" |
| +#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
| namespace { |
| @@ -169,24 +170,33 @@ void ChromotingJniRuntime::CommitPairingCredentials(const std::string& host, |
| // GCd as soon as the managed method returned, so we mustn't release it here. |
| } |
| -void ChromotingJniRuntime::UpdateImageBuffer(int width, |
| - int height, |
| - jobject buffer) { |
| +base::android::ScopedJavaLocalRef<jobject> ChromotingJniRuntime::NewBitmap( |
| + webrtc::DesktopSize size) { |
| + JNIEnv* env = base::android::AttachCurrentThread(); |
| + |
| + jobject bitmap = env->CallStaticObjectMethod( |
|
Yaron
2013/10/09 06:42:30
Any reason not to start switching this over to the
Lambros
2013/10/10 01:35:58
Can it be realistically done as part of this CL? I
Yaron
2013/10/10 11:13:37
Ok fair enough
|
| + class_, |
| + env->GetStaticMethodID( |
| + class_, |
| + "newBitmap", |
| + "(II)Landroid/graphics/Bitmap;"), |
| + size.width(), |
| + size.height()); |
| + return base::android::ScopedJavaLocalRef<jobject>(env, bitmap); |
| +} |
| + |
| +void ChromotingJniRuntime::UpdateFrameBitmap(jobject bitmap) { |
| DCHECK(display_task_runner_->BelongsToCurrentThread()); |
| JNIEnv* env = base::android::AttachCurrentThread(); |
| - env->SetStaticIntField( |
| - class_, |
| - env->GetStaticFieldID(class_, "sWidth", "I"), |
| - width); |
| - env->SetStaticIntField( |
| - class_, |
| - env->GetStaticFieldID(class_, "sHeight", "I"), |
| - height); |
| - env->SetStaticObjectField( |
| + |
| + env->CallStaticVoidMethod( |
| class_, |
| - env->GetStaticFieldID(class_, "sBuffer", "Ljava/nio/ByteBuffer;"), |
| - buffer); |
| + env->GetStaticMethodID( |
| + class_, |
| + "setVideoFrame", |
| + "(Landroid/graphics/Bitmap;)V"), |
| + bitmap); |
| } |
| void ChromotingJniRuntime::UpdateCursorShape( |