Force alignment of JVM called functions.

Bug: webrtc:9050
Change-Id: I5a064769dac857d2a6afb5f28c556bbcca21f8c6
Reviewed-on: https://webrtc-review.googlesource.com/64160
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22578}
This commit is contained in:
Yura Yaroshevich 2018-03-23 11:47:19 +03:00 committed by Commit Bot
parent 66c24fe165
commit 278d03a42c
4 changed files with 14 additions and 0 deletions

View File

@ -236,6 +236,7 @@ int AudioManager::GetDelayEstimateInMilliseconds() const {
return delay_estimate_in_milliseconds_;
}
JNI_FUNCTION_ALIGN
void JNICALL AudioManager::CacheAudioParameters(JNIEnv* env,
jobject obj,
jint sample_rate,

View File

@ -229,6 +229,7 @@ int32_t AudioRecordJni::EnableBuiltInNS(bool enable) {
return j_audio_record_->EnableBuiltInNS(enable) ? 0 : -1;
}
JNI_FUNCTION_ALIGN
void JNICALL AudioRecordJni::CacheDirectBufferAddress(JNIEnv* env,
jobject obj,
jobject byte_buffer,
@ -249,6 +250,7 @@ void AudioRecordJni::OnCacheDirectBufferAddress(JNIEnv* env,
direct_buffer_capacity_in_bytes_ = static_cast<size_t>(capacity);
}
JNI_FUNCTION_ALIGN
void JNICALL AudioRecordJni::DataIsRecorded(JNIEnv* env,
jobject obj,
jint length,

View File

@ -204,6 +204,7 @@ void AudioTrackJni::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {
audio_device_buffer_->SetPlayoutChannels(channels);
}
JNI_FUNCTION_ALIGN
void JNICALL AudioTrackJni::CacheDirectBufferAddress(JNIEnv* env,
jobject obj,
jobject byte_buffer,
@ -227,6 +228,7 @@ void AudioTrackJni::OnCacheDirectBufferAddress(JNIEnv* env,
RTC_LOG(INFO) << "frames_per_buffer: " << frames_per_buffer_;
}
JNI_FUNCTION_ALIGN
void JNICALL AudioTrackJni::GetPlayoutData(JNIEnv* env,
jobject obj,
jint length,

View File

@ -20,6 +20,15 @@
RTC_CHECK(!jni->ExceptionCheck()) \
<< (jni->ExceptionDescribe(), jni->ExceptionClear(), "")
#if defined(WEBRTC_ARCH_X86)
// Dalvik JIT generated code doesn't guarantee 16-byte stack alignment on
// x86 - use force_align_arg_pointer to realign the stack at the JNI
// boundary. bugs.webrtc.org/9050
#define JNI_FUNCTION_ALIGN __attribute__((force_align_arg_pointer))
#else
#define JNI_FUNCTION_ALIGN
#endif
namespace webrtc {
// Return a |JNIEnv*| usable on this thread or NULL if this thread is detached.