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

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

Merge "Replace control block frameCount_ by explicit in/out parameter"

parents c69b91ce 74935e44
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public:
                                uint32_t sampleRate,
                                audio_format_t format,
                                audio_channel_mask_t channelMask,
                                size_t frameCount,
                                size_t *pFrameCount,
                                track_flags_t *flags,
                                const sp<IMemory>& sharedBuffer,
                                // On successful return, AudioFlinger takes over the handle
@@ -88,7 +88,7 @@ public:
                                uint32_t sampleRate,
                                audio_format_t format,
                                audio_channel_mask_t channelMask,
                                size_t frameCount,
                                size_t *pFrameCount,
                                track_flags_t *flags,
                                pid_t tid,  // -1 means unused, otherwise must be valid non-0
                                int *sessionId,
+1 −5
Original line number Diff line number Diff line
@@ -96,11 +96,7 @@ struct audio_track_cblk_t
                                        // The value should be used "for entertainment purposes only",
                                        // which means don't make important decisions based on it.

                size_t      frameCount_;    // used during creation to pass actual track buffer size
                                            // from AudioFlinger to client, and not referenced again
                                            // FIXME remove here and replace by createTrack() in/out
                                            // parameter
                                            // renamed to "_" to detect incorrect use
                uint32_t    mPad1;      // unused

    volatile    int32_t     mFutex;     // event flag: down (P) by client,
                                        // up (V) by server or binderDied() or interrupt()
+9 −4
Original line number Diff line number Diff line
@@ -255,9 +255,6 @@ status_t AudioRecord::set(

    mStatus = NO_ERROR;

    // Update buffer size in case it has been limited by AudioFlinger during track creation
    mFrameCount = mCblk->frameCount_;

    mActive = false;
    mCbf = cbf;
    mRefreshRemaining = true;
@@ -467,11 +464,13 @@ status_t AudioRecord::openRecord_l(size_t epoch)
        return BAD_VALUE;
    }

    size_t temp = mFrameCount;  // temp may be replaced by a revised value of frameCount,
                                // but we will still need the original value also
    int originalSessionId = mSessionId;
    sp<IAudioRecord> record = audioFlinger->openRecord(input,
                                                       mSampleRate, mFormat,
                                                       mChannelMask,
                                                       mFrameCount,
                                                       &temp,
                                                       &trackFlags,
                                                       tid,
                                                       &mSessionId,
@@ -503,6 +502,12 @@ status_t AudioRecord::openRecord_l(size_t epoch)
    mCblkMemory = iMem;
    audio_track_cblk_t* cblk = static_cast<audio_track_cblk_t*>(iMemPointer);
    mCblk = cblk;
    // note that temp is the (possibly revised) value of mFrameCount
    if (temp < mFrameCount || (mFrameCount == 0 && temp == 0)) {
        ALOGW("Requested frameCount %u but received frameCount %u", mFrameCount, temp);
    }
    mFrameCount = temp;

    // FIXME missing fast track frameCount logic
    mAwaitBoost = false;
    if (mFlags & AUDIO_INPUT_FLAG_FAST) {
+4 −2
Original line number Diff line number Diff line
@@ -1000,13 +1000,15 @@ status_t AudioTrack::createTrack_l(
        trackFlags |= IAudioFlinger::TRACK_OFFLOAD;
    }

    size_t temp = frameCount;   // temp may be replaced by a revised value of frameCount,
                                // but we will still need the original value also
    sp<IAudioTrack> track = audioFlinger->createTrack(streamType,
                                                      sampleRate,
                                                      // AudioFlinger only sees 16-bit PCM
                                                      format == AUDIO_FORMAT_PCM_8_BIT ?
                                                              AUDIO_FORMAT_PCM_16_BIT : format,
                                                      mChannelMask,
                                                      frameCount,
                                                      &temp,
                                                      &trackFlags,
                                                      sharedBuffer,
                                                      output,
@@ -1039,7 +1041,7 @@ status_t AudioTrack::createTrack_l(
    mCblkMemory = iMem;
    audio_track_cblk_t* cblk = static_cast<audio_track_cblk_t*>(iMemPointer);
    mCblk = cblk;
    size_t temp = cblk->frameCount_;
    // note that temp is the (possibly revised) value of frameCount
    if (temp < frameCount || (frameCount == 0 && temp == 0)) {
        // In current design, AudioTrack client checks and ensures frame count validity before
        // passing it to AudioFlinger so AudioFlinger should not return a different value except
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ extern "C" {
namespace android {

audio_track_cblk_t::audio_track_cblk_t()
    : mServer(0), frameCount_(0), mFutex(0), mMinimum(0),
    : mServer(0), mFutex(0), mMinimum(0),
    mVolumeLR(0x10001000), mSampleRate(0), mSendLevel(0), mFlags(0)
{
    memset(&u, 0, sizeof(u));
Loading