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

Commit dc5f0eb0 authored by Xiaoming Yang's avatar Xiaoming Yang Committed by Steve Kondik
Browse files

nuplayer: Fix audio EOS notifiy on AudioSink not ready

Audio EOS won't be notified by renderer if AudioSink is not ready
and first buffer itself has EOS. Playback complete won't happen
due to missing audio EOS. Hence, audio EOS needs to be handled
and notified.

Change-Id: I779c7034d1964485c2b064c0179d3cd341af5a5f
CRs-Fixed: 801121
parent 064bb6a0
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -850,6 +850,18 @@ bool NuPlayer::Renderer::onDrainAudioQueue() {
    // immediately after start. Investigate error message
    // "vorbis_dsp_synthesis returned -135", along with RTSP.
    uint32_t numFramesPlayed;
    if(!mAudioSink->ready() && !mAudioQueue.empty()) {
        while (!mAudioQueue.empty()) {
            QueueEntry *entry = &*mAudioQueue.begin();
            if (entry->mBuffer == NULL) {
                notifyEOS(true /* audio */, entry->mFinalResult);
            }
            mAudioQueue.erase(mAudioQueue.begin());
            entry = NULL;
        }
        return false;
    }

    if (mAudioSink->getPosition(&numFramesPlayed) != OK) {
        // When getPosition fails, renderer will not reschedule the draining
        // unless new samples are queued.