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

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

Declare and initialize in one statement

Change-Id: Ie8593692907e67558f9d7654c9a4bf8cbce99bd8
parent a9757af8
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -424,7 +424,6 @@ uint32_t AudioRecord::getInputFramesLost() const
// must be called with mLock held
status_t AudioRecord::openRecord_l(size_t epoch)
{
    status_t status;
    const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger();
    if (audioFlinger == 0) {
        ALOGE("Could not get audioflinger");
@@ -460,7 +459,8 @@ status_t AudioRecord::openRecord_l(size_t epoch)
    }

    audio_io_handle_t input;
    status = AudioSystem::getInputForAttr(&mAttributes, &input, (audio_session_t)mSessionId,
    status_t status = AudioSystem::getInputForAttr(&mAttributes, &input,
                                        (audio_session_t)mSessionId,
                                        mSampleRate, mFormat, mChannelMask, mFlags);

    if (status != NO_ERROR) {
@@ -1001,14 +1001,13 @@ status_t AudioRecord::restoreRecord_l(const char *from)
{
    ALOGW("dead IAudioRecord, creating a new one from %s()", from);
    ++mSequence;
    status_t result;

    // if the new IAudioRecord is created, openRecord_l() will modify the
    // following member variables: mAudioRecord, mCblkMemory, mCblk, mBufferMemory.
    // It will also delete the strong references on previous IAudioRecord and IMemory
    size_t position = mProxy->getPosition();
    mNewPosition = position + mUpdatePeriod;
    result = openRecord_l(position);
    status_t result = openRecord_l(position);
    if (result == NO_ERROR) {
        if (mActive) {
            // callback thread or sync event hasn't changed
+2 −4
Original line number Diff line number Diff line
@@ -1415,8 +1415,7 @@ ssize_t AudioTrack::write(const void* buffer, size_t userSize, bool blocking)
            return ssize_t(err);
        }

        size_t toWrite;
        toWrite = audioBuffer.size;
        size_t toWrite = audioBuffer.size;
        memcpy(audioBuffer.i8, buffer, toWrite);
        buffer = ((const char *) buffer) + toWrite;
        userSize -= toWrite;
@@ -1829,7 +1828,6 @@ status_t AudioTrack::restoreTrack_l(const char *from)
    ALOGW("dead IAudioTrack, %s, creating a new one from %s()",
          isOffloadedOrDirect_l() ? "Offloaded or Direct" : "PCM", from);
    ++mSequence;
    status_t result;

    // refresh the audio configuration cache in this process to make sure we get new
    // output parameters and new IAudioFlinger in createTrack_l()
@@ -1851,7 +1849,7 @@ status_t AudioTrack::restoreTrack_l(const char *from)
    // following member variables: mAudioTrack, mCblkMemory and mCblk.
    // It will also delete the strong references on previous IAudioTrack and IMemory.
    // If a new IAudioTrack cannot be created, the previous (dead) instance will be left intact.
    result = createTrack_l();
    status_t result = createTrack_l();

    // take the frames that will be lost by track recreation into account in saved position
    // For streaming tracks, this is the amount we obtained from the user/client