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

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

Fix type of AudioTrack/AudioRecord parameter frameCount

It's size_t consistently

Change-Id: I29638ef59ac773218025f2403a3508a307b487e0
parent 838b3d8b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ public:
                                    uint32_t sampleRate,
                                    audio_format_t format,
                                    audio_channel_mask_t channelMask,
                                    int frameCount      = 0,
                                    size_t frameCount = 0,
                                    callback_t cbf = NULL,
                                    void* user = NULL,
                                    uint32_t notificationFrames = 0,
@@ -191,7 +191,7 @@ public:
                            uint32_t sampleRate,
                            audio_format_t format,
                            audio_channel_mask_t channelMask,
                            int frameCount      = 0,
                            size_t frameCount = 0,
                            callback_t cbf = NULL,
                            void* user = NULL,
                            uint32_t notificationFrames = 0,
+3 −3
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ public:
                                    uint32_t sampleRate,
                                    audio_format_t format,
                                    audio_channel_mask_t,
                                    int frameCount       = 0,
                                    size_t frameCount    = 0,
                                    audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE,
                                    callback_t cbf       = NULL,
                                    void* user           = NULL,
@@ -245,7 +245,7 @@ public:
                            uint32_t sampleRate,
                            audio_format_t format,
                            audio_channel_mask_t channelMask,
                            int frameCount      = 0,
                            size_t frameCount   = 0,
                            audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE,
                            callback_t cbf      = NULL,
                            void* user          = NULL,
@@ -284,7 +284,7 @@ public:
            size_t      frameSize() const   { return mFrameSize; }

            uint32_t    channelCount() const { return mChannelCount; }
            uint32_t    frameCount() const  { return mFrameCount; }
            size_t      frameCount() const  { return mFrameCount; }

    /* Return the static buffer specified in constructor or set(), or 0 for streaming mode */
            sp<IMemory> sharedBuffer() const { return mSharedBuffer; }
+4 −11
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ AudioRecord::AudioRecord(
        uint32_t sampleRate,
        audio_format_t format,
        audio_channel_mask_t channelMask,
        int frameCount,
        size_t frameCount,
        callback_t cbf,
        void* user,
        uint32_t notificationFrames,
@@ -114,7 +114,7 @@ status_t AudioRecord::set(
        uint32_t sampleRate,
        audio_format_t format,
        audio_channel_mask_t channelMask,
        int frameCountInt,
        size_t frameCount,
        callback_t cbf,
        void* user,
        uint32_t notificationFrames,
@@ -123,9 +123,9 @@ status_t AudioRecord::set(
        transfer_type transferType,
        audio_input_flags_t flags)
{
    ALOGV("set(): inputSource %d, sampleRate %u, format %#x, channelMask %#x, frameCount %d, "
    ALOGV("set(): inputSource %d, sampleRate %u, format %#x, channelMask %#x, frameCount %zu, "
          "notificationFrames %u, sessionId %d, transferType %d, flags %#x",
          inputSource, sampleRate, format, channelMask, frameCountInt, notificationFrames,
          inputSource, sampleRate, format, channelMask, frameCount, notificationFrames,
          sessionId, transferType, flags);

    switch (transferType) {
@@ -151,13 +151,6 @@ status_t AudioRecord::set(
    }
    mTransfer = transferType;

    // FIXME "int" here is legacy and will be replaced by size_t later
    if (frameCountInt < 0) {
        ALOGE("Invalid frame count %d", frameCountInt);
        return BAD_VALUE;
    }
    size_t frameCount = frameCountInt;

    AutoMutex lock(mLock);

    // invariant that mAudioRecord != 0 is true only after set() returns successfully
+4 −11
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ AudioTrack::AudioTrack(
        uint32_t sampleRate,
        audio_format_t format,
        audio_channel_mask_t channelMask,
        int frameCount,
        size_t frameCount,
        audio_output_flags_t flags,
        callback_t cbf,
        void* user,
@@ -182,7 +182,7 @@ status_t AudioTrack::set(
        uint32_t sampleRate,
        audio_format_t format,
        audio_channel_mask_t channelMask,
        int frameCountInt,
        size_t frameCount,
        audio_output_flags_t flags,
        callback_t cbf,
        void* user,
@@ -195,9 +195,9 @@ status_t AudioTrack::set(
        int uid,
        pid_t pid)
{
    ALOGV("set(): streamType %d, sampleRate %u, format %#x, channelMask %#x, frameCount %d, "
    ALOGV("set(): streamType %d, sampleRate %u, format %#x, channelMask %#x, frameCount %zu, "
          "flags #%x, notificationFrames %u, sessionId %d, transferType %d",
          streamType, sampleRate, format, channelMask, frameCountInt, flags, notificationFrames,
          streamType, sampleRate, format, channelMask, frameCount, flags, notificationFrames,
          sessionId, transferType);

    switch (transferType) {
@@ -236,13 +236,6 @@ status_t AudioTrack::set(
    mSharedBuffer = sharedBuffer;
    mTransfer = transferType;

    // FIXME "int" here is legacy and will be replaced by size_t later
    if (frameCountInt < 0) {
        ALOGE("Invalid frame count %d", frameCountInt);
        return BAD_VALUE;
    }
    size_t frameCount = frameCountInt;

    ALOGV_IF(sharedBuffer != 0, "sharedBuffer: %p, size: %d", sharedBuffer->pointer(),
            sharedBuffer->size());

+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ int JetPlayer::init()
            pLibConfig->sampleRate,
            AUDIO_FORMAT_PCM_16_BIT,
            audio_channel_out_mask_from_count(pLibConfig->numChannels),
            mTrackBufferSize,
            (size_t) mTrackBufferSize,
            AUDIO_OUTPUT_FLAG_NONE);

    // create render and playback thread
Loading