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

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

Make copy of audio_offload_info_t for future use

Change-Id: I515970aa0660418d5d1640fb1bf477e112c89bdd
parent dd5f4c8c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -661,6 +661,7 @@ protected:
    audio_track_cblk_t*     mCblk;                  // re-load after mLock.unlock()

    sp<AudioTrackThread>    mAudioTrackThread;

    float                   mVolume[2];
    float                   mSendLevel;
    mutable uint32_t        mSampleRate;            // mutable because getSampleRate() can update it.
@@ -676,6 +677,8 @@ protected:
    audio_channel_mask_t    mChannelMask;
    sp<IMemory>             mSharedBuffer;
    transfer_type           mTransfer;
    audio_offload_info_t    mOffloadInfoCopy;
    const audio_offload_info_t* mOffloadInfo;

    // mFrameSize is equal to mFrameSizeAF for non-PCM or 16-bit PCM data.  For 8-bit PCM data, it's
    // twice as large as mFrameSize because data is expanded to 16-bit before it's stored in buffer.
+10 −0
Original line number Diff line number Diff line
@@ -324,6 +324,16 @@ status_t AudioTrack::set(
        return BAD_VALUE;
    }

    // Make copy of input parameter offloadInfo so that in the future:
    //  (a) createTrack_l doesn't need it as an input parameter
    //  (b) we can support re-creation of offloaded tracks
    if (offloadInfo != NULL) {
        mOffloadInfoCopy = *offloadInfo;
        mOffloadInfo = &mOffloadInfoCopy;
    } else {
        mOffloadInfo = NULL;
    }

    mVolume[LEFT] = 1.0f;
    mVolume[RIGHT] = 1.0f;
    mSendLevel = 0.0f;