Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1bdf803f authored by Glenn Kasten's avatar Glenn Kasten Committed by Android (Google) Code Review
Browse files

Merge "Remove Format_frameBitShift()"

parents 570dd184 c326e1c3
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -66,10 +66,6 @@ extern const NBAIO_Format Format_Invalid;
// Return the frame size of an NBAIO_Format in bytes
// Return the frame size of an NBAIO_Format in bytes
size_t Format_frameSize(const NBAIO_Format& format);
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
// 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
// FIXME Remove the default value of AUDIO_FORMAT_PCM_16_BIT, and rename
NBAIO_Format Format_from_SR_C(unsigned sampleRate, unsigned channelCount,
NBAIO_Format Format_from_SR_C(unsigned sampleRate, unsigned channelCount,
@@ -131,7 +127,6 @@ public:


protected:
protected:
    NBAIO_Port(const NBAIO_Format& format) : mNegotiated(false), mFormat(format),
    NBAIO_Port(const NBAIO_Format& format) : mNegotiated(false), mFormat(format),
                                             mBitShift(Format_frameBitShift(format)),
                                             mFrameSize(Format_frameSize(format)) { }
                                             mFrameSize(Format_frameSize(format)) { }
    virtual ~NBAIO_Port() { }
    virtual ~NBAIO_Port() { }


@@ -139,7 +134,6 @@ protected:


    bool            mNegotiated;    // mNegotiated implies (mFormat != Format_Invalid)
    bool            mNegotiated;    // mNegotiated implies (mFormat != Format_Invalid)
    NBAIO_Format    mFormat;        // (mFormat != Format_Invalid) does not imply mNegotiated
    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
    size_t          mFrameSize;     // assign in parallel with any assignment to mFormat
};
};


+0 −1
Original line number Original line Diff line number Diff line
@@ -41,7 +41,6 @@ public:


private:
private:
    const sp<NBAIO_Source> mSource;     // the wrapped source
    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
    /*const*/ size_t    mFrameSize; // frame size in bytes
    void*               mAllocated; // pointer to base of allocated memory
    void*               mAllocated; // pointer to base of allocated memory
    size_t              mSize;      // size of mAllocated in frames
    size_t              mSize;      // size of mAllocated in frames
+0 −1
Original line number Original line Diff line number Diff line
@@ -48,7 +48,6 @@ ssize_t AudioStreamInSource::negotiate(const NBAIO_Format offers[], size_t numOf
            audio_channel_mask_t channelMask =
            audio_channel_mask_t channelMask =
                    (audio_channel_mask_t) mStream->common.get_channels(&mStream->common);
                    (audio_channel_mask_t) mStream->common.get_channels(&mStream->common);
            mFormat = Format_from_SR_C(sampleRate, popcount(channelMask));
            mFormat = Format_from_SR_C(sampleRate, popcount(channelMask));
            mBitShift = Format_frameBitShift(mFormat);
            mFrameSize = Format_frameSize(mFormat);
            mFrameSize = Format_frameSize(mFormat);
        }
        }
    }
    }
+0 −1
Original line number Original line Diff line number Diff line
@@ -45,7 +45,6 @@ ssize_t AudioStreamOutSink::negotiate(const NBAIO_Format offers[], size_t numOff
            audio_channel_mask_t channelMask =
            audio_channel_mask_t channelMask =
                    (audio_channel_mask_t) mStream->common.get_channels(&mStream->common);
                    (audio_channel_mask_t) mStream->common.get_channels(&mStream->common);
            mFormat = Format_from_SR_C(sampleRate, popcount(channelMask));
            mFormat = Format_from_SR_C(sampleRate, popcount(channelMask));
            mBitShift = Format_frameBitShift(mFormat);
            mFrameSize = Format_frameSize(mFormat);
            mFrameSize = Format_frameSize(mFormat);
        }
        }
    }
    }
+2 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@ size_t Format_frameSize(const NBAIO_Format& format)
    return format.mFrameSize;
    return format.mFrameSize;
}
}


#if 0
int Format_frameBitShift(const NBAIO_Format& format)
int Format_frameBitShift(const NBAIO_Format& format)
{
{
    // FIXME The sample format is hard-coded to AUDIO_FORMAT_PCM_16_BIT
    // 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);
    return Format_channelCount(format);
    // FIXME must return -1 for non-power of 2
    // FIXME must return -1 for non-power of 2
}
}
#endif


const NBAIO_Format Format_Invalid = { 0, 0, AUDIO_FORMAT_INVALID, 0 };
const NBAIO_Format Format_Invalid = { 0, 0, AUDIO_FORMAT_INVALID, 0 };


Loading