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

Commit 06040e15 authored by Weiyin Jiang's avatar Weiyin Jiang Committed by Khalid Zubair
Browse files

audio: omx encoder isn't expected for raw recording

Raw recording doesn't require any encoder, so no OMX encoder will be
created and audio source will be directly used as media source.

UNKNOWN_ERROR error will be threwn if call AudioSource::start()
continuously, so we should avoid omx encoder operations if it's not
created for raw recording.

CYNGNOS-1679

Change-Id: Ib38c4e42b7667e9bf882cddb15422d0dd598b60e
CRs-Fixed: 752419
(cherry picked from commit 58726723)
(cherry picked from commit c5fa90a8)
parent dc12dd10
Loading
Loading
Loading
Loading
+20 −8
Original line number Diff line number Diff line
@@ -2044,11 +2044,17 @@ status_t StagefrightRecorder::setSourcePause(bool pause) {
            }
        }
        if (mAudioEncoderOMX != NULL) {
            if (mAudioEncoderOMX != mAudioSourceNode) {
                err = mAudioEncoderOMX->pause();
                if (err != OK) {
                    ALOGE("OMX AudioEncoder pause failed");
                    return err;
                }
            } else {
                // If AudioSource is the same as MediaSource(as in LPCM),
                // bypass omx encoder pause() call.
                ALOGV("OMX AudioEncoder->pause() bypassed");
            }
        }
        if (mVideoSourceNode != NULL) {
            err = mVideoSourceNode->pause();
@@ -2087,11 +2093,17 @@ status_t StagefrightRecorder::setSourcePause(bool pause) {
            }
        }
        if (mAudioEncoderOMX != NULL) {
            if (mAudioEncoderOMX != mAudioSourceNode) {
                err = mAudioEncoderOMX->start();
                if (err != OK) {
                    ALOGE("OMX AudioEncoder start failed");
                    return err;
                }
            } else {
                // If AudioSource is the same as MediaSource(as in LPCM),
                // bypass omx encoder start() call.
                ALOGV("OMX AudioEncoder->start() bypassed");
            }
        }
    }
    return err;