Skip to content

Commit

Permalink
Update for release m79
Browse files Browse the repository at this point in the history
  • Loading branch information
c-g-owen committed Dec 19, 2019
1 parent f120885 commit 94c4094
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 37 deletions.
47 changes: 22 additions & 25 deletions patch/webrtc_android.patch
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
diff --git a/modules/utility/include/jvm_android.h b/modules/utility/include/jvm_android.h
index eb18cc27f3..a70c9e7030 100644
index 3caab87761..44f4c2260c 100644
--- a/modules/utility/include/jvm_android.h
+++ b/modules/utility/include/jvm_android.h
@@ -147,9 +147,11 @@ class JNIEnvironment {
@@ -149,9 +149,10 @@ class JNIEnvironment {
// JVM::Uninitialize();
class JVM {
public:
+ static void Initialize(JavaVM* jvm);
+
// Stores global handles to the Java VM interface.
// Should be called once on a thread that is attached to the JVM.
- static void Initialize(JavaVM* jvm);
+ static void Initialize(JavaVM* jvm, JNIEnv *jni);
// Like the method above but also passes the context to the ContextUtils
// class. This method should be used by pure-C++ Android users that can't call
// ContextUtils.initialize directly.
@@ -176,7 +178,7 @@ class JVM {
@@ -178,7 +179,7 @@ class JVM {
JavaVM* jvm() const { return jvm_; }

protected:
Expand All @@ -25,10 +24,10 @@ index eb18cc27f3..a70c9e7030 100644

private:
diff --git a/modules/utility/source/jvm_android.cc b/modules/utility/source/jvm_android.cc
index 2d48c2d7be..7af3c70207 100644
index 8e24daa0f2..b94c059d28 100644
--- a/modules/utility/source/jvm_android.cc
+++ b/modules/utility/source/jvm_android.cc
@@ -21,7 +21,38 @@
@@ -21,6 +21,37 @@
namespace webrtc {

JVM* g_jvm;
Expand All @@ -42,7 +41,7 @@ index 2d48c2d7be..7af3c70207 100644
+ attached = false;
+ if (!env) {
+ RTC_LOG(INFO) << "Jni_Env::Attaching thread to JVM";
+
+
+ jint ret = g_vm->AttachCurrentThread(&env, nullptr);
+ if (ret == JNI_OK) {
+ attached = true;
Expand All @@ -56,17 +55,16 @@ index 2d48c2d7be..7af3c70207 100644
+
+ ~Jni_Env() {
+ if (attached) {
+ g_vm->DetachCurrentThread();
+ g_vm->DetachCurrentThread();
+ }
+ }
+
+ JNIEnv *env;
+ bool attached;
+};
+

// TODO(henrika): add more clases here if needed.
struct {
const char* name;
@@ -49,11 +80,14 @@ void LoadClasses(JNIEnv* jni) {
RTC_CHECK(globalRef) << c.name;
c.clazz = globalRef;
Expand Down Expand Up @@ -188,7 +186,7 @@ index 2d48c2d7be..7af3c70207 100644

@@ -196,36 +241,48 @@ std::unique_ptr<NativeRegistration> JNIEnvironment::RegisterNatives(
RTC_LOG(INFO) << "JNIEnvironment::RegisterNatives: " << name;
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
jclass clazz = LookUpClass(name);
- jni_->RegisterNatives(clazz, methods, num_methods);
- CHECK_EXCEPTION(jni_) << "Error during RegisterNatives";
Expand All @@ -201,7 +199,7 @@ index 2d48c2d7be..7af3c70207 100644
}

std::string JNIEnvironment::JavaToStdString(const jstring& j_string) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
- const char* jchars = jni_->GetStringUTFChars(j_string, nullptr);
- CHECK_EXCEPTION(jni_);
- const int size = jni_->GetStringUTFLength(j_string);
Expand All @@ -220,14 +218,13 @@ index 2d48c2d7be..7af3c70207 100644
}

// static
-void JVM::Initialize(JavaVM* jvm) {
+ void JVM::Initialize(JavaVM* jvm) {
+ Jni_Env jenv;
void JVM::Initialize(JavaVM* jvm) {
+ Jni_Env jenv;
+
+ Initialize(jvm, jenv.env);
+}
+
+ Initialize(jvm, jenv.env);
+ }
+
+ void JVM::Initialize(JavaVM* jvm, JNIEnv *jni) {
+void JVM::Initialize(JavaVM* jvm, JNIEnv *jni) {
RTC_LOG(INFO) << "JVM::Initialize";
RTC_CHECK(!g_jvm);
- g_jvm = new JVM(jvm);
Expand All @@ -239,7 +236,7 @@ index 2d48c2d7be..7af3c70207 100644
+ g_vm = jvm;
+ Jni_Env jenv;
+ JNIEnv* jni = jenv.env;
+
+
+ Initialize(jvm, jni);

// Pass in the context to the new ContextUtils class.
Expand All @@ -253,7 +250,7 @@ index 2d48c2d7be..7af3c70207 100644
}

-JVM::JVM(JavaVM* jvm) : jvm_(jvm) {
+ JVM::JVM(JavaVM* jvm, JNIEnv *jni) : jvm_(jvm) {
+JVM::JVM(JavaVM* jvm, JNIEnv *jni) : jvm_(jvm) {
RTC_LOG(INFO) << "JVM::JVM";
- RTC_CHECK(jni()) << "AttachCurrentThread() must be called on this thread.";
- LoadClasses(jni());
Expand All @@ -263,18 +260,18 @@ index 2d48c2d7be..7af3c70207 100644
}

JVM::~JVM() {
@@ -266,13 +324,15 @@ std::unique_ptr<JNIEnvironment> JVM::environment() {
@@ -266,6 +324,7 @@ std::unique_ptr<JNIEnvironment> JVM::environment() {
// its JNIEnv, we should share the JavaVM, and use GetEnv to discover the
// thread's JNIEnv. (Assuming it has one, if not, use AttachCurrentThread).
// See // http://developer.android.com/training/articles/perf-jni.html.
+#if 0
JNIEnv* jni = GetEnv(jvm_);
if (!jni) {
RTC_LOG(LS_ERROR)
<< "AttachCurrentThread() has not been called on this thread";
@@ -273,6 +332,8 @@ std::unique_ptr<JNIEnvironment> JVM::environment() {
return std::unique_ptr<JNIEnvironment>();
}
- return std::unique_ptr<JNIEnvironment>(new JNIEnvironment(jni));
return std::unique_ptr<JNIEnvironment>(new JNIEnvironment(jni));
+#endif
+ return std::unique_ptr<JNIEnvironment>(new JNIEnvironment(nullptr));
}
Expand Down
9 changes: 6 additions & 3 deletions scripts/build_iosx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ else
fi

pushd src > /dev/null
git checkout remotes/branch-heads/$WEBRTC_RELEASE

if [ "$WEBRTC_COMMIT" == "" ]; then
git checkout remotes/branch-heads/$WEBRTC_RELEASE
else
git checkout $WEBRTC_COMMIT
fi
gclient sync

for PATCH in ../../patch/*.patch; do
patch -p1 < $PATCH
done

export ARGS="is_debug=false rtc_include_tests=false rtc_build_examples=false rtc_build_tools=false"
export ARGS="is_debug=false rtc_include_tests=false rtc_build_examples=false rtc_build_tools=false use_custom_libcxx=false"
gn gen out/osx-x86_64 -args="target_os=\"mac\" target_cpu=\"x64\" $ARGS"
ninja -C out/osx-x86_64

Expand Down
18 changes: 11 additions & 7 deletions scripts/build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ fi

pushd src > /dev/null

git checkout remotes/branch-heads/$WEBRTC_RELEASE
git checkout -b release_$WEBRTC_RELEASE
if [ "$WEBRTC_COMMIT" == "" ]; then
git checkout remotes/branch-heads/$WEBRTC_RELEASE
else
git checkout $WEBRTC_COMMIT
fi
yes | gclient sync

sed s/sudo/echo\ sudo/g build/install-build-deps-android.sh > build/install-build-deps-android-nosudo.sh
Expand All @@ -38,19 +41,20 @@ for PATCH in ../../patch/*.patch; do
patch -p1 < $PATCH
done

gn gen out/linux-x86_64 -args='target_os="linux" target_cpu="x64" is_debug=false rtc_include_tests=false'
export ARGS="is_debug=false rtc_include_tests=false rtc_build_examples=false rtc_build_tools=false use_custom_libcxx=false"
gn gen out/linux-x86_64 -args="target_os=\"linux\" target_cpu=\"x64\" $ARGS"
ninja -C out/linux-x86_64

gn gen out/android-i386 -args='target_os="android" target_cpu="x86" is_debug=false rtc_include_tests=false'
gn gen out/android-i386 -args="target_os=\"android\" target_cpu=\"x86\" $ARGS"
ninja -C out/android-i386

gn gen out/android-x86_64 -args='target_os="android" target_cpu="x64" is_debug=false rtc_include_tests=false'
gn gen out/android-x86_64 -args="target_os=\"android\" target_cpu=\"x64\" $ARGS"
ninja -C out/android-x86_64

gn gen out/android-armv7 -args='target_os="android" target_cpu="arm" is_debug=false rtc_include_tests=false'
gn gen out/android-armv7 -args="target_os=\"android\" target_cpu=\"arm\" $ARGS"
ninja -C out/android-armv7

gn gen out/android-arm64 -args='target_os="android" target_cpu="arm64" is_debug=false rtc_include_tests=false'
gn gen out/android-arm64 -args="target_os=\"android\" target_cpu=\"arm64\" $ARGS"
ninja -C out/android-arm64

popd > /dev/null
Expand Down
5 changes: 4 additions & 1 deletion scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ if [ "$HOST_OS" == "Darwin" ]; then
echo "Packaging header files"
rm -r $WEBRTC_RB 2> /dev/null
mkdir -p $WEBRTC_RB/include
echo WEBRTC_RELEASE=$WEBRTC_RELEASE > $WEBRTC_RB/version.txt
echo WEBRTC_COMMIT=$WEBRTC_COMMIT >> $WEBRTC_RB/version.txt
find webrtc_checkout/src -type f -iname "*.h" -exec scripts/cpheader.sh {} $WEBRTC_RB \;
zip -9r webrtc_${WEBRTC_RB}_headers.zip $WEBRTC_RB
zip -9r webrtc_${WEBRTC_RB}_headers.zip $WEBRTC_RB version.txt

fi

for OS in $AVS_OS; do
Expand Down
3 changes: 2 additions & 1 deletion scripts/version.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

export WEBRTC_RELEASE=72
export WEBRTC_RELEASE=m79
export WEBRTC_COMMIT=b484ec0082948ae086c2ba4142b4d2bf8bc4dd4b

0 comments on commit 94c4094

Please sign in to comment.