From f641687a8070f646f6e073020a59bc288ec1b319 Mon Sep 17 00:00:00 2001 From: Mirko Bonadei Date: Fri, 5 Jan 2018 11:25:14 +0100 Subject: [PATCH] Forward fixing WebRTC to compile with Android NDK r16. Starting from Chromium Roll [1], WebRTC should start to use NDK r16 for Android builds. The roll cannot be completed because of three compilation errors: ../../sdk/android/src/jni/pc/androidnetworkmonitor.cc:15:9: error: 'RTLD_NOLOAD' macro redefined [-Werror,-Wmacro-redefined] ^ ../../third_party/android_tools/ndk/sysroot/usr/include/dlfcn.h:62:9: note: previous definition is here ../../modules/audio_device/android/audio_record_jni.cc:251:41: error: format specifies type 'long long' but the argument has type 'jlong' (aka 'long') [-Werror,-Wformat] ALOGD("direct buffer capacity: %lld", capacity); ../../modules/audio_device/android/audio_track_jni.cc:229:41: error: format specifies type 'long long' but the argument has type 'jlong' (aka 'long') [-Werror,-Wformat] ALOGD("direct buffer capacity: %lld", capacity); This CL forward fixes these errors in order to fix the Chromium Roll into WebRTC. [1] - https://webrtc-review.googlesource.com/c/src/+/37540 Bug: webrtc:8710 Change-Id: I5bc64e73919eee7c9e965a442a386b5e1897b56a Reviewed-on: https://webrtc-review.googlesource.com/37640 Reviewed-by: Henrik Andreassson Commit-Queue: Mirko Bonadei Cr-Commit-Position: refs/heads/master@{#21510} --- modules/audio_device/android/audio_record_jni.cc | 2 +- modules/audio_device/android/audio_track_jni.cc | 2 +- sdk/android/src/jni/pc/androidnetworkmonitor.cc | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/audio_device/android/audio_record_jni.cc b/modules/audio_device/android/audio_record_jni.cc index a7d44a6189..4b66cdff4f 100644 --- a/modules/audio_device/android/audio_record_jni.cc +++ b/modules/audio_device/android/audio_record_jni.cc @@ -248,7 +248,7 @@ void AudioRecordJni::OnCacheDirectBufferAddress(JNIEnv* env, RTC_DCHECK(!direct_buffer_address_); direct_buffer_address_ = env->GetDirectBufferAddress(byte_buffer); jlong capacity = env->GetDirectBufferCapacity(byte_buffer); - ALOGD("direct buffer capacity: %lld", capacity); + ALOGD("direct buffer capacity: %ld", static_cast(capacity)); direct_buffer_capacity_in_bytes_ = static_cast(capacity); } diff --git a/modules/audio_device/android/audio_track_jni.cc b/modules/audio_device/android/audio_track_jni.cc index eca225f305..5f110aa08f 100644 --- a/modules/audio_device/android/audio_track_jni.cc +++ b/modules/audio_device/android/audio_track_jni.cc @@ -226,7 +226,7 @@ void AudioTrackJni::OnCacheDirectBufferAddress(JNIEnv* env, RTC_DCHECK(!direct_buffer_address_); direct_buffer_address_ = env->GetDirectBufferAddress(byte_buffer); jlong capacity = env->GetDirectBufferCapacity(byte_buffer); - ALOGD("direct buffer capacity: %lld", capacity); + ALOGD("direct buffer capacity: %ld", static_cast(capacity)); direct_buffer_capacity_in_bytes_ = static_cast(capacity); const size_t bytes_per_frame = audio_parameters_.channels() * sizeof(int16_t); frames_per_buffer_ = direct_buffer_capacity_in_bytes_ / bytes_per_frame; diff --git a/sdk/android/src/jni/pc/androidnetworkmonitor.cc b/sdk/android/src/jni/pc/androidnetworkmonitor.cc index 5e85c845be..c6efdc445f 100644 --- a/sdk/android/src/jni/pc/androidnetworkmonitor.cc +++ b/sdk/android/src/jni/pc/androidnetworkmonitor.cc @@ -11,8 +11,10 @@ #include "sdk/android/src/jni/pc/androidnetworkmonitor.h" #include +#ifndef RTLD_NOLOAD // This was added in Lollipop to dlfcn.h #define RTLD_NOLOAD 4 +#endif #include "rtc_base/bind.h" #include "rtc_base/checks.h"