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

Commit 1eb6acaf authored by Sachin Shah's avatar Sachin Shah Committed by Steve Kondik
Browse files

libstagefright: Fix for CTS recording testcase failure

- AMR WB record is failing through CTS because of incorrect
  sample rate and bitrate values. Fix AMR WB encode
  bitrate and sampling rate values to fix this issue.
- Back to back recording in CTS testcase
  MediaRecorderTest#testRecordingAudioInRawFormats fails.
  Add a fix to release audio source node reference on stop
  recording as well as before creating new audio source.

Change-Id: Ia4b1f2331b0b6f9c6c7d23cd40e8c5b5cec76e28
CRs-fixed: 384336
parent 24420797
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -175,6 +175,10 @@ status_t StagefrightRecorder::setAudioEncoder(audio_encoder ae) {
        mSampleRate = mSampleRate ? mSampleRate : 48000;
        mAudioChannels = mAudioChannels ? mAudioChannels : 2;
        mAudioBitRate = mAudioBitRate ? mAudioBitRate : 156000;
    } else if(mAudioEncoder == AUDIO_ENCODER_AMR_WB) {
        mSampleRate = 16000;
        mAudioChannels = 1;
        mAudioBitRate = 23850;
    } else {
        mSampleRate = mSampleRate ? mSampleRate : 8000;
        mAudioChannels = mAudioChannels ? mAudioChannels : 1;
@@ -930,6 +934,11 @@ sp<MediaSource> StagefrightRecorder::createAudioSource() {
    sp<MediaSource> audioEncoder =
        OMXCodec::Create(client.interface(), encMeta,
                         true /* createEncoder */, audioSource);
#ifdef QCOM_HARDWARE
    if (mAudioSourceNode != NULL) {
        mAudioSourceNode.clear();
    }
#endif
    mAudioSourceNode = audioSource;

    return audioEncoder;
@@ -1792,7 +1801,12 @@ status_t StagefrightRecorder::stop() {
        ::close(mOutputFd);
        mOutputFd = -1;
    }

#ifdef QCOM_HARDWARE
    if (mAudioSourceNode != NULL) {
        mAudioSourceNode.clear();
        mAudioSourceNode = NULL;
    }
#endif
    if (mStarted) {
        mStarted = false;