diff options
author | Glenn Kasten <gkasten@google.com> | 2014-02-07 20:49:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-02-07 20:49:22 +0000 |
commit | a793625031a3e326a261a0843598c35a5784bbde (patch) | |
tree | f18a01ac2ead0114a2a46783b3ef79a013fb85e7 /media/libnbaio | |
parent | 19f420ea68424a608e982d39ab76676a05337685 (diff) | |
parent | 6e0d67d7b496ce17c0970a4ffd3a6f808860949c (diff) | |
download | frameworks_av-a793625031a3e326a261a0843598c35a5784bbde.zip frameworks_av-a793625031a3e326a261a0843598c35a5784bbde.tar.gz frameworks_av-a793625031a3e326a261a0843598c35a5784bbde.tar.bz2 |
Merge "Use Format_isValid() and Format_isEqual() instead of direct comparison"
Diffstat (limited to 'media/libnbaio')
-rw-r--r-- | media/libnbaio/AudioBufferProviderSource.cpp | 2 | ||||
-rw-r--r-- | media/libnbaio/AudioStreamInSource.cpp | 4 | ||||
-rw-r--r-- | media/libnbaio/AudioStreamOutSink.cpp | 4 | ||||
-rw-r--r-- | media/libnbaio/NBAIO.cpp | 8 |
4 files changed, 9 insertions, 9 deletions
diff --git a/media/libnbaio/AudioBufferProviderSource.cpp b/media/libnbaio/AudioBufferProviderSource.cpp index e952a00..4a69104 100644 --- a/media/libnbaio/AudioBufferProviderSource.cpp +++ b/media/libnbaio/AudioBufferProviderSource.cpp @@ -28,7 +28,7 @@ AudioBufferProviderSource::AudioBufferProviderSource(AudioBufferProvider *provid NBAIO_Source(format), mProvider(provider), mConsumed(0) { ALOG_ASSERT(provider != NULL); - ALOG_ASSERT(format != Format_Invalid); + ALOG_ASSERT(Format_isValid(format)); } AudioBufferProviderSource::~AudioBufferProviderSource() diff --git a/media/libnbaio/AudioStreamInSource.cpp b/media/libnbaio/AudioStreamInSource.cpp index 05273f6..ae8fac8 100644 --- a/media/libnbaio/AudioStreamInSource.cpp +++ b/media/libnbaio/AudioStreamInSource.cpp @@ -40,7 +40,7 @@ AudioStreamInSource::~AudioStreamInSource() ssize_t AudioStreamInSource::negotiate(const NBAIO_Format offers[], size_t numOffers, NBAIO_Format counterOffers[], size_t& numCounterOffers) { - if (mFormat == Format_Invalid) { + if (!Format_isValid(mFormat)) { mStreamBufferSizeBytes = mStream->common.get_buffer_size(&mStream->common); audio_format_t streamFormat = mStream->common.get_format(&mStream->common); if (streamFormat == AUDIO_FORMAT_PCM_16_BIT) { @@ -67,7 +67,7 @@ size_t AudioStreamInSource::framesOverrun() ssize_t AudioStreamInSource::read(void *buffer, size_t count) { - if (CC_UNLIKELY(mFormat == Format_Invalid)) { + if (CC_UNLIKELY(!Format_isValid(mFormat))) { return NEGOTIATE; } ssize_t bytesRead = mStream->read(mStream, buffer, count << mBitShift); diff --git a/media/libnbaio/AudioStreamOutSink.cpp b/media/libnbaio/AudioStreamOutSink.cpp index e4341d7..aa9810e 100644 --- a/media/libnbaio/AudioStreamOutSink.cpp +++ b/media/libnbaio/AudioStreamOutSink.cpp @@ -37,7 +37,7 @@ AudioStreamOutSink::~AudioStreamOutSink() ssize_t AudioStreamOutSink::negotiate(const NBAIO_Format offers[], size_t numOffers, NBAIO_Format counterOffers[], size_t& numCounterOffers) { - if (mFormat == Format_Invalid) { + if (!Format_isValid(mFormat)) { mStreamBufferSizeBytes = mStream->common.get_buffer_size(&mStream->common); audio_format_t streamFormat = mStream->common.get_format(&mStream->common); if (streamFormat == AUDIO_FORMAT_PCM_16_BIT) { @@ -56,7 +56,7 @@ ssize_t AudioStreamOutSink::write(const void *buffer, size_t count) if (!mNegotiated) { return NEGOTIATE; } - ALOG_ASSERT(mFormat != Format_Invalid); + ALOG_ASSERT(Format_isValid(mFormat)); ssize_t ret = mStream->write(mStream, buffer, count << mBitShift); if (ret > 0) { ret >>= mBitShift; diff --git a/media/libnbaio/NBAIO.cpp b/media/libnbaio/NBAIO.cpp index cc12671..18e0252 100644 --- a/media/libnbaio/NBAIO.cpp +++ b/media/libnbaio/NBAIO.cpp @@ -55,7 +55,7 @@ enum { unsigned Format_sampleRate(const NBAIO_Format& format) { - if (format == Format_Invalid) { + if (!Format_isValid(format)) { return 0; } switch (format & Format_SR_Mask) { @@ -82,7 +82,7 @@ unsigned Format_sampleRate(const NBAIO_Format& format) unsigned Format_channelCount(const NBAIO_Format& format) { - if (format == Format_Invalid) { + if (!Format_isValid(format)) { return 0; } switch (format & Format_C_Mask) { @@ -218,9 +218,9 @@ ssize_t NBAIO_Port::negotiate(const NBAIO_Format offers[], size_t numOffers, { ALOGV("negotiate offers=%p numOffers=%u countersOffers=%p numCounterOffers=%u", offers, numOffers, counterOffers, numCounterOffers); - if (mFormat != Format_Invalid) { + if (Format_isValid(mFormat)) { for (size_t i = 0; i < numOffers; ++i) { - if (offers[i] == mFormat) { + if (Format_isEqual(offers[i], mFormat)) { mNegotiated = true; return i; } |