OSDN Git Service

Remove Format_frameBitShift()
authorGlenn Kasten <gkasten@google.com>
Thu, 6 Mar 2014 16:01:38 +0000 (08:01 -0800)
committerGlenn Kasten <gkasten@google.com>
Thu, 6 Mar 2014 17:04:38 +0000 (09:04 -0800)
Change-Id: Iae2e80a7330c5dd0f70a263051aa44c23cfe3541

include/media/nbaio/NBAIO.h
include/media/nbaio/SourceAudioBufferProvider.h
media/libnbaio/AudioStreamInSource.cpp
media/libnbaio/AudioStreamOutSink.cpp
media/libnbaio/NBAIO.cpp
media/libnbaio/SourceAudioBufferProvider.cpp

index 2f63648..ab9a4a5 100644 (file)
@@ -66,10 +66,6 @@ extern const NBAIO_Format Format_Invalid;
 // Return the frame size of an NBAIO_Format in bytes
 size_t Format_frameSize(const NBAIO_Format& format);
 
-// Return the frame size of an NBAIO_Format as a bit shift
-// or -1 if frame size is not a power of 2
-int Format_frameBitShift(const NBAIO_Format& format);
-
 // Convert a sample rate in Hz and channel count to an NBAIO_Format
 // FIXME Remove the default value of AUDIO_FORMAT_PCM_16_BIT, and rename
 NBAIO_Format Format_from_SR_C(unsigned sampleRate, unsigned channelCount,
@@ -131,7 +127,6 @@ public:
 
 protected:
     NBAIO_Port(const NBAIO_Format& format) : mNegotiated(false), mFormat(format),
-                                             mBitShift(Format_frameBitShift(format)),
                                              mFrameSize(Format_frameSize(format)) { }
     virtual ~NBAIO_Port() { }
 
@@ -139,7 +134,6 @@ protected:
 
     bool            mNegotiated;    // mNegotiated implies (mFormat != Format_Invalid)
     NBAIO_Format    mFormat;        // (mFormat != Format_Invalid) does not imply mNegotiated
-    size_t          mBitShift;      // assign in parallel with any assignment to mFormat
     size_t          mFrameSize;     // assign in parallel with any assignment to mFormat
 };
 
index 7357aa5..daf6bc3 100644 (file)
@@ -41,7 +41,6 @@ public:
 
 private:
     const sp<NBAIO_Source> mSource;     // the wrapped source
-    /*const*/ size_t    mFrameBitShift; // log2(frame size in bytes)
     /*const*/ size_t    mFrameSize; // frame size in bytes
     void*               mAllocated; // pointer to base of allocated memory
     size_t              mSize;      // size of mAllocated in frames
index e2f4943..efbc1a7 100644 (file)
@@ -48,7 +48,6 @@ ssize_t AudioStreamInSource::negotiate(const NBAIO_Format offers[], size_t numOf
             audio_channel_mask_t channelMask =
                     (audio_channel_mask_t) mStream->common.get_channels(&mStream->common);
             mFormat = Format_from_SR_C(sampleRate, popcount(channelMask));
-            mBitShift = Format_frameBitShift(mFormat);
             mFrameSize = Format_frameSize(mFormat);
         }
     }
index 442455b..f7f764e 100644 (file)
@@ -45,7 +45,6 @@ ssize_t AudioStreamOutSink::negotiate(const NBAIO_Format offers[], size_t numOff
             audio_channel_mask_t channelMask =
                     (audio_channel_mask_t) mStream->common.get_channels(&mStream->common);
             mFormat = Format_from_SR_C(sampleRate, popcount(channelMask));
-            mBitShift = Format_frameBitShift(mFormat);
             mFrameSize = Format_frameSize(mFormat);
         }
     }
index 16e7df5..4f6591d 100644 (file)
@@ -27,6 +27,7 @@ size_t Format_frameSize(const NBAIO_Format& format)
     return format.mFrameSize;
 }
 
+#if 0
 int Format_frameBitShift(const NBAIO_Format& format)
 {
     // FIXME The sample format is hard-coded to AUDIO_FORMAT_PCM_16_BIT
@@ -34,6 +35,7 @@ int Format_frameBitShift(const NBAIO_Format& format)
     return Format_channelCount(format);
     // FIXME must return -1 for non-power of 2
 }
+#endif
 
 const NBAIO_Format Format_Invalid = { 0, 0, AUDIO_FORMAT_INVALID, 0 };
 
index 791fe7c..e21ef48 100644 (file)
@@ -37,7 +37,6 @@ SourceAudioBufferProvider::SourceAudioBufferProvider(const sp<NBAIO_Source>& sou
     numCounterOffers = 0;
     index = source->negotiate(counterOffers, 1, NULL, numCounterOffers);
     ALOG_ASSERT(index == 0);
-    mFrameBitShift = Format_frameBitShift(source->format());
     mFrameSize = Format_frameSize(source->format());
 }