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

Commit 767c357e authored by Alexy Joseph's avatar Alexy Joseph
Browse files

nuplayer: restart source for 24 bit WAV playback

Generic source start was delayed if the playback
was 24 bit WAV content. This causes issue
with state of the playback leading to
issues with seek, progress bar among others.
Fix this by re-starting playback when
the playback configuration changes.

Change-Id: I9802e50fa6b0360fbfe68a8169f651cab4bd1351
CRs-Fixed: 802202
parent 0b81bd35
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -471,6 +471,7 @@ void NuPlayer::GenericSource::start() {
            * 1. kKeyPCMFormat is not set
            * 2. kKeyPCMFormat is not set to 24bit
            */
            ALOGI("Retrieving 24 bit data from source");
            CHECK_EQ(mAudioTrack.mSource->start(audioMeta.get()), (status_t)OK);
        } else {
            CHECK_EQ(mAudioTrack.mSource->start(), (status_t)OK);
+7 −7
Original line number Diff line number Diff line
@@ -628,12 +628,7 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
            }

            sp<MetaData> audioMeta = mSource->getFormatMeta(true /* audio */);
            if (!(ExtendedUtils::isRAWFormat(audioMeta) &&
                ExtendedUtils::is24bitPCMOffloadEnabled() &&
                ExtendedUtils::getPcmSampleBits(audioMeta) == 24)) {
                // Call mSource->start() after openAudioSink for 24 bit pcm playback
            mSource->start();
            }

            uint32_t flags = 0;

@@ -992,8 +987,9 @@ void NuPlayer::onMessageReceived(const sp<AMessage> &msg) {
                if ((ExtendedUtils::isRAWFormat(audioMeta) &&
                    ExtendedUtils::is24bitPCMOffloadEnabled() &&
                    ExtendedUtils::getPcmSampleBits(audioMeta) == 24)) {
                    ALOGV("update pcmformat in WAVExtractor to 16 bit");
                    ALOGI("update pcm format in WAVExtractor to 16 bit");
                    ExtendedUtils::setKeyPCMFormat(audioMeta, AUDIO_FORMAT_PCM_16_BIT );
                    mSource->stop();
                    mSource->start();
                }

@@ -1296,6 +1292,8 @@ status_t NuPlayer::instantiateDecoder(bool audio, sp<Decoder> *decoder) {
                ExtendedUtils::is24bitPCMOffloadEnabled() &&
                (ExtendedUtils::getPcmSampleBits(audioMeta) == 24)) {
                ExtendedUtils::setKeyPCMFormat(audioMeta,AUDIO_FORMAT_PCM_8_24_BIT);
                ALOGI("update pcmformat in WAVExtractor to 24 bit");
                mSource->stop();
                mSource->start();
            }
            *decoder = new DecoderPassThrough(notify);
@@ -1304,6 +1302,8 @@ status_t NuPlayer::instantiateDecoder(bool audio, sp<Decoder> *decoder) {
                ExtendedUtils::is24bitPCMOffloadEnabled() &&
                (ExtendedUtils::getPcmSampleBits(audioMeta) == 24)) {
                ExtendedUtils::setKeyPCMFormat(audioMeta,AUDIO_FORMAT_PCM_16_BIT);
                ALOGI("update pcmformat in WAVExtractor to 16 bit");
                mSource->stop();
                mSource->start();
            }
            *decoder = new Decoder(notify);