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

Commit f69f9869 authored by Glenn Kasten's avatar Glenn Kasten
Browse files

NBAIO::Format_from_SR_C requires audio_format_t parameter

Change-Id: I4b65f6ed2f6ca3608b3a5f88f52a93af0b9b1f4a
parent 8eec7706
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -67,9 +67,8 @@ extern const NBAIO_Format Format_Invalid;
size_t Format_frameSize(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,
        audio_format_t format = AUDIO_FORMAT_PCM_16_BIT);
// FIXME rename
NBAIO_Format Format_from_SR_C(unsigned sampleRate, unsigned channelCount, audio_format_t format);

// Return the sample rate in Hz of an NBAIO_Format
unsigned Format_sampleRate(const NBAIO_Format& format);
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ ssize_t AudioStreamInSource::negotiate(const NBAIO_Format offers[], size_t numOf
        uint32_t sampleRate = mStream->common.get_sample_rate(&mStream->common);
        audio_channel_mask_t channelMask =
                (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), streamFormat);
        mFrameSize = Format_frameSize(mFormat);
    }
    return NBAIO_Source::negotiate(offers, numOffers, counterOffers, numCounterOffers);
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ ssize_t AudioStreamOutSink::negotiate(const NBAIO_Format offers[], size_t numOff
        uint32_t sampleRate = mStream->common.get_sample_rate(&mStream->common);
        audio_channel_mask_t channelMask =
                (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), streamFormat);
        mFrameSize = Format_frameSize(mFormat);
    }
    return NBAIO_Sink::negotiate(offers, numOffers, counterOffers, numCounterOffers);
+1 −1
Original line number Diff line number Diff line
@@ -2567,7 +2567,7 @@ AudioFlinger::MixerThread::MixerThread(const sp<AudioFlinger>& audioFlinger, Aud
    // create an NBAIO sink for the HAL output stream, and negotiate
    mOutputSink = new AudioStreamOutSink(output->stream);
    size_t numCounterOffers = 0;
    const NBAIO_Format offers[1] = {Format_from_SR_C(mSampleRate, mChannelCount)};
    const NBAIO_Format offers[1] = {Format_from_SR_C(mSampleRate, mChannelCount, mFormat)};
    ssize_t index = mOutputSink->negotiate(offers, 1, NULL, numCounterOffers);
    ALOG_ASSERT(index == 0);