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

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: Keep track of buffers in JniFrameConsumer Created 7 years, 2 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
« no previous file with comments | « remoting/client/jni/chromoting_jni_runtime.h ('k') | remoting/client/jni/jni_frame_consumer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
+ 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(
« no previous file with comments | « remoting/client/jni/chromoting_jni_runtime.h ('k') | remoting/client/jni/jni_frame_consumer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698