Add an example app for Android native API.

The app is a simple loopback demo demonstrating the usage of Android
native API. This is an initial version and I will add support for
HW codecs etc. in the future.

Bug: webrtc:8769
Change-Id: Ifb6209769dabeb8ca3185b969a1ef8afd6d84390
Reviewed-on: https://webrtc-review.googlesource.com/60540
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22385}
This commit is contained in:
Sami Kalliomäki
2018-03-08 16:43:16 +01:00
committed by Commit Bot
parent 0dd7435abc
commit 3e77afd0d2
15 changed files with 710 additions and 18 deletions

View File

@ -16,20 +16,6 @@
namespace webrtc {
namespace jni {
// Return a |jlong| that will correctly convert back to |ptr|. This is needed
// because the alternative (of silently passing a 32-bit pointer to a vararg
// function expecting a 64-bit param) picks up garbage in the high 32 bits.
jlong jlongFromPointer(void* ptr) {
static_assert(sizeof(intptr_t) <= sizeof(jlong),
"Time to rethink the use of jlongs");
// Going through intptr_t to be obvious about the definedness of the
// conversion from pointer to integral type. intptr_t to jlong is a standard
// widening by the static_assert above.
jlong ret = reinterpret_cast<intptr_t>(ptr);
RTC_DCHECK(reinterpret_cast<void*>(ret) == ptr);
return ret;
}
ScopedJavaLocalRef<jobject> NewDirectByteBuffer(JNIEnv* env,
void* address,
jlong capacity) {

View File

@ -32,10 +32,10 @@ namespace jni {
// TODO(sakal): Remove once clients have migrated.
using ::webrtc::JavaToStdMapStrings;
// Return a |jlong| that will correctly convert back to |ptr|. This is needed
// because the alternative (of silently passing a 32-bit pointer to a vararg
// function expecting a 64-bit param) picks up garbage in the high 32 bits.
jlong jlongFromPointer(void* ptr);
// Deprecated, use NativeToJavaPointer.
inline long jlongFromPointer(void* ptr) {
return NativeToJavaPointer(ptr);
}
ScopedJavaLocalRef<jobject> NewDirectByteBuffer(JNIEnv* env,
void* address,