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

Commit 134f9f6f authored by Steve Kondik's avatar Steve Kondik
Browse files

nuplayer: Fix CTS issues in NuPlayer

 * Handle seekTo before start, this was broken by PCM offload
 * Return real duration if we have it

Change-Id: I3330859a481ed21436480a4497d14abe5d1aa7ab
parent 9b7c1469
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ NuPlayer::GenericSource::GenericSource(
      mFetchSubtitleDataGeneration(0),
      mFetchTimedTextDataGeneration(0),
      mDurationUs(0ll),
      mCachedDurationUs(0ll),
      mAudioIsVorbis(false),
      mIsWidevine(false),
      mUIDValid(uidValid),
@@ -80,6 +81,7 @@ void NuPlayer::GenericSource::resetDataSource() {
    mDrmManagerClient = NULL;
    mStarted = false;
    mStopRead = true;
    mInitialSeekTime = -1;
}

status_t NuPlayer::GenericSource::setDataSource(
@@ -529,6 +531,11 @@ void NuPlayer::GenericSource::start() {
    }

    setDrmPlaybackStatusIfNeeded(Playback::START, getLastReadPosition() / 1000);

    if (mInitialSeekTime > 0) {
        doSeek(mInitialSeekTime);
    }

    mStarted = true;
}

@@ -601,6 +608,11 @@ void NuPlayer::GenericSource::notifyBufferingUpdate(int percentage,
status_t NuPlayer::GenericSource::getCachedDuration(int64_t *cachedDurationUs) {
    status_t finalStatus = UNKNOWN_ERROR;

    if (mDurationUs > 0) {
        *cachedDurationUs = mDurationUs;
        return OK;
    }

    if (mCachedSource != NULL) {
        size_t cachedDataRemaining =
                mCachedSource->approxDataRemaining(&finalStatus);
@@ -1199,7 +1211,12 @@ status_t NuPlayer::GenericSource::doSeek(int64_t seekTimeUs) {
    // If the Widevine source is stopped, do not attempt to read any
    // more buffers.
    if (mStopRead) {
        if (mIsWidevine) {
            return INVALID_OPERATION;
        } else if (mInitialSeekTime == -1) {
            mInitialSeekTime = seekTimeUs;
            return OK;
        }
    }
    if (mVideoTrack.mSource != NULL) {
        int64_t actualTimeUs;
+1 −0
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ private:
    sp<DecryptHandle> mDecryptHandle;
    bool mStarted;
    bool mStopRead;
    int64_t mInitialSeekTime;
    String8 mContentType;
    AString mSniffedMIME;
    off64_t mMetaDataSize;