Fix broken build on x86 Android

BUG=2545
R=fischman@webrtc.org, henrike@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/3019004

Patch from Lu Quiang <qiang.lu@intel.com>.

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5081 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
fischman@webrtc.org 2013-11-04 19:06:08 +00:00
parent 7b273a545d
commit b8cb85b348

View File

@ -10,11 +10,6 @@
#include "webrtc/modules/audio_device/android/single_rw_fifo.h"
#if !defined(__ARMEL__)
// ARM specific due to the implementation of MemoryBarrier.
#error trying to compile ARM code for non-ARM target
#endif
static int UpdatePos(int pos, int capacity) {
return (pos + 1) % capacity;
}
@ -23,6 +18,7 @@ namespace webrtc {
namespace subtle {
#if defined(__ARMEL__)
// From http://src.chromium.org/viewvc/chrome/trunk/src/base/atomicops_internals_arm_gcc.h
// Note that it is only the MemoryBarrier function that makes this class arm
// specific. Borrowing other MemoryBarrier implementations, this class could
@ -34,6 +30,20 @@ inline void MemoryBarrier() {
((KernelMemoryBarrierFunc)0xffff0fa0)();
}
#elif defined(__x86_64__) || defined (__i386__)
// From http://src.chromium.org/viewvc/chrome/trunk/src/base/atomicops_internals_x86_gcc.h
// mfence exists on x64 and x86 platforms containing SSE2.
// x86 platforms that don't have SSE2 will crash with SIGILL.
// If this code needs to run on such platforms in the future,
// add runtime CPU detection here.
inline void MemoryBarrier() {
__asm__ __volatile__("mfence" : : : "memory");
}
#else
#error Add an implementation of MemoryBarrier() for this platform!
#endif
} // namespace subtle
SingleRwFifo::SingleRwFifo(int capacity)