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

Unified Diff: webrtc/sdk/android/src/jni/jni_common.cc

Issue 3003213002: Android: Add common function for adding/releasing native reference (Closed)
Patch Set: Rebase Created 3 years, 4 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: webrtc/sdk/android/src/jni/jni_common.cc
diff --git a/webrtc/sdk/android/src/jni/pc/mediasource_jni.cc b/webrtc/sdk/android/src/jni/jni_common.cc
similarity index 50%
copy from webrtc/sdk/android/src/jni/pc/mediasource_jni.cc
copy to webrtc/sdk/android/src/jni/jni_common.cc
index 6e3150d3fbeb7939337aa7700a76c071393ba918..3a34ba372831f107f0310eff9cc63c8678caa468 100644
--- a/webrtc/sdk/android/src/jni/pc/mediasource_jni.cc
+++ b/webrtc/sdk/android/src/jni/jni_common.cc
@@ -8,23 +8,27 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/api/mediastreaminterface.h"
+#include "webrtc/rtc_base/refcount.h"
#include "webrtc/sdk/android/src/jni/jni_helpers.h"
namespace webrtc_jni {
-JNI_FUNCTION_DECLARATION(void, MediaSource_free, JNIEnv*, jclass, jlong j_p) {
- reinterpret_cast<rtc::RefCountInterface*>(j_p)->Release();
+JNI_FUNCTION_DECLARATION(void,
+ JniCommon_nativeAddRef,
+ JNIEnv* jni,
+ jclass,
+ jlong j_native_ref_counted_pointer) {
+ reinterpret_cast<rtc::RefCountInterface*>(j_native_ref_counted_pointer)
+ ->AddRef();
}
-JNI_FUNCTION_DECLARATION(jobject,
- MediaSource_nativeState,
+JNI_FUNCTION_DECLARATION(void,
+ JniCommon_nativeReleaseRef,
JNIEnv* jni,
jclass,
- jlong j_p) {
- rtc::scoped_refptr<webrtc::MediaSourceInterface> p(
- reinterpret_cast<webrtc::MediaSourceInterface*>(j_p));
- return JavaEnumFromIndexAndClassName(jni, "MediaSource$State", p->state());
+ jlong j_native_ref_counted_pointer) {
+ reinterpret_cast<rtc::RefCountInterface*>(j_native_ref_counted_pointer)
+ ->Release();
}
} // namespace webrtc_jni
« no previous file with comments | « webrtc/sdk/android/src/java/org/webrtc/WrappedNativeI420Buffer.java ('k') | webrtc/sdk/android/src/jni/jni_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698