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

Unified Diff: remoting/client/jni/chromoting_jni_runtime.cc

Issue 24072012: Hold video frame in Bitmap instead of keeping a ByteBuffer reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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: 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(

Powered by Google App Engine
This is Rietveld 408576698