summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioTrack.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2011-12-15 09:51:17 -0800
committerGlenn Kasten <gkasten@google.com>2012-01-05 07:33:45 -0800
commite80a4ccd2bac7bf121441e257044f5813e85180f (patch)
tree795c33992f702be01aac2ffbfb652408168d9b26 /media/libmedia/AudioTrack.cpp
parent7c48707a9d320230452d5937239f28ab0ea2e695 (diff)
downloadframeworks_base-e80a4ccd2bac7bf121441e257044f5813e85180f.zip
frameworks_base-e80a4ccd2bac7bf121441e257044f5813e85180f.tar.gz
frameworks_base-e80a4ccd2bac7bf121441e257044f5813e85180f.tar.bz2
Use the standard CC_LIKELY and CC_UNLIKELY macros
Several source files privately defined macros LIKELY and UNLIKELY in terms of __builtin_expect. But <cutils/compiler.h> already has CC_LIKELY and CC_UNLIKELY which are intended for this purpose. So rename the private uses to use the standard names. In addition, AudioFlinger was relying on the macro expanding to extra ( ). Change-Id: I2494e087a0c0cac0ac998335f5e9c8ad02955873
Diffstat (limited to 'media/libmedia/AudioTrack.cpp')
-rw-r--r--media/libmedia/AudioTrack.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index 6868d99..e0c6ca5 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -38,13 +38,11 @@
#include <utils/Atomic.h>
#include <cutils/bitops.h>
+#include <cutils/compiler.h>
#include <system/audio.h>
#include <system/audio_policy.h>
-#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true ))
-#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false ))
-
namespace android {
// ---------------------------------------------------------------------------
@@ -856,12 +854,12 @@ status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount)
goto start_loop_here;
while (framesAvail == 0) {
active = mActive;
- if (UNLIKELY(!active)) {
+ if (CC_UNLIKELY(!active)) {
ALOGV("Not active and NO_MORE_BUFFERS");
cblk->lock.unlock();
return NO_MORE_BUFFERS;
}
- if (UNLIKELY(!waitCount)) {
+ if (CC_UNLIKELY(!waitCount)) {
cblk->lock.unlock();
return WOULD_BLOCK;
}
@@ -879,7 +877,7 @@ status_t AudioTrack::obtainBuffer(Buffer* audioBuffer, int32_t waitCount)
if (cblk->flags & CBLK_INVALID_MSK) {
goto create_new_track;
}
- if (__builtin_expect(result!=NO_ERROR, false)) {
+ if (CC_UNLIKELY(result != NO_ERROR)) {
cblk->waitTimeMs += waitTimeMs;
if (cblk->waitTimeMs >= cblk->bufferTimeoutMs) {
// timing out when a loop has been set and we have already written upto loop end