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

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

Simplify error handling after track creation

IAudioFlinger::createTrack and IAudioFlinger::openRecord
both guarantee that (status == OK) == (sp<> != 0).

Change-Id: I91cb4f7e843019efb65cace7ba146f7da7aa5b59
parent 045e7391
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -482,10 +482,12 @@ status_t AudioRecord::openRecord_l(size_t epoch)
    ALOGE_IF(originalSessionId != AUDIO_SESSION_ALLOCATE && mSessionId != originalSessionId,
            "session ID changed from %d to %d", originalSessionId, mSessionId);

    if (record == 0 || status != NO_ERROR) {
    if (status != NO_ERROR) {
        ALOGE("AudioFlinger could not create record track, status: %d", status);
        goto release;
    }
    ALOG_ASSERT(record != 0);

    // AudioFlinger now owns the reference to the I/O handle,
    // so we are no longer responsible for releasing it.

+3 −1
Original line number Diff line number Diff line
@@ -1016,10 +1016,12 @@ status_t AudioTrack::createTrack_l(size_t epoch)
                                                      mClientUid,
                                                      &status);

    if (track == 0) {
    if (status != NO_ERROR) {
        ALOGE("AudioFlinger could not create track, status: %d", status);
        goto release;
    }
    ALOG_ASSERT(track != 0);

    // AudioFlinger now owns the reference to the I/O handle,
    // so we are no longer responsible for releasing it.