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

Commit d05795e5 authored by Marco Nelissen's avatar Marco Nelissen Committed by Android Git Automerger
Browse files

am 4deb606b: Merge "Fix NuPlayer deadlock" into lmp-dev

* commit '4deb606b':
  Fix NuPlayer deadlock
parents 62e31181 4deb606b
Loading
Loading
Loading
Loading
+19 −14
Original line number Diff line number Diff line
@@ -227,7 +227,7 @@ status_t NuPlayerDriver::start() {

            if (mStartupSeekTimeUs >= 0) {
                if (mStartupSeekTimeUs == 0) {
                    notifySeekComplete();
                    notifySeekComplete_l();
                } else {
                    mPlayer->seekToAsync(mStartupSeekTimeUs);
                }
@@ -320,7 +320,7 @@ status_t NuPlayerDriver::seekTo(int msec) {
            // pretend that the seek completed. It will actually happen when starting playback.
            // TODO: actually perform the seek here, so the player is ready to go at the new
            // location
            notifySeekComplete();
            notifySeekComplete_l();
            break;
        }

@@ -525,9 +525,12 @@ void NuPlayerDriver::notifyPosition(int64_t positionUs) {
}

void NuPlayerDriver::notifySeekComplete() {
    bool wasSeeking = true;
    {
    Mutex::Autolock autoLock(mLock);
    notifySeekComplete_l();
}

void NuPlayerDriver::notifySeekComplete_l() {
    bool wasSeeking = true;
    if (mState == STATE_STOPPED_AND_PREPARING) {
        wasSeeking = false;
        mState = STATE_STOPPED_AND_PREPARED;
@@ -540,8 +543,10 @@ void NuPlayerDriver::notifySeekComplete() {
        // no need to notify listener
        return;
    }
    }
    // note: notifyListener called with lock held
    mLock.unlock();
    notifyListener(wasSeeking ? MEDIA_SEEK_COMPLETE : MEDIA_PREPARED);
    mLock.lock();
}

void NuPlayerDriver::notifyFrameStats(
+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ struct NuPlayerDriver : public MediaPlayerInterface {
    void notifyDuration(int64_t durationUs);
    void notifyPosition(int64_t positionUs);
    void notifySeekComplete();
    void notifySeekComplete_l();
    void notifyFrameStats(int64_t numFramesTotal, int64_t numFramesDropped);
    void notifyListener(int msg, int ext1 = 0, int ext2 = 0, const Parcel *in = NULL);
    void notifyFlagsChanged(uint32_t flags);