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..7aa5302c7bedc0aa21e2ecee6ba5b9b449d5191f 100644 |
| --- a/remoting/client/jni/chromoting_jni_runtime.cc |
| +++ b/remoting/client/jni/chromoting_jni_runtime.cc |
| @@ -171,22 +171,23 @@ void ChromotingJniRuntime::CommitPairingCredentials(const std::string& host, |
| void ChromotingJniRuntime::UpdateImageBuffer(int width, |
| int height, |
| - jobject buffer) { |
| + uint8* data) { |
| 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( |
| + |
| + base::android::ScopedJavaLocalRef<jobject> buffer(env, |
| + env->NewDirectByteBuffer(data, width * height * kBytesPerPixel)); |
|
Sergey Ulanov
2013/09/25 23:32:08
frame stride may not be equal width*kBytesPerPixel
solb
2013/09/26 14:21:36
I can see the argument for this, but at the same t
Lambros
2013/09/26 22:29:37
It's possible to deal with strides that are differ
|
| + |
| + env->CallStaticVoidMethod( |
| class_, |
| - env->GetStaticFieldID(class_, "sBuffer", "Ljava/nio/ByteBuffer;"), |
| - buffer); |
| + env->GetStaticMethodID( |
| + class_, |
| + "setVideoFrame", |
| + "(IILjava/nio/ByteBuffer;)V"), |
| + width, |
| + height, |
| + buffer.obj()); |
| } |
| void ChromotingJniRuntime::UpdateCursorShape( |