status_t NuPlayer::HTTPLiveSource::seekTo(int64_t seekTimeUs) { // We need to make sure we're not seeking until we have seen the very first // PTS timestamp in the whole stream (from the beginning of the stream). while (!mTSParser->PTSTimeDeltaEstablished() && feedMoreTSData() == OK) { usleep(100000); } if( mFinalResult != OK ) { if( mFinalResult == ERROR_END_OF_STREAM ) { LOGW("Allow seek even though all ts segments are downloaded"); mFinalResult = OK; } else { LOGW("Error state %d, Ignore this seek", mFinalResult); return mFinalResult; } } int64_t newSeekTime = -1; mLiveSession->setCurrentPlayingTime(mCurrentPlayingTime); mLiveSession->seekTo(seekTimeUs, &newSeekTime); if( newSeekTime >= 0 ) { mTSParser->signalDiscontinuity( ATSParser::DISCONTINUITY_HLS_PLAYER_SEEK, NULL); } mNewSeekTime = newSeekTime; return OK; }
status_t NuPlayer::DashMpdSource::seekTo(int64_t seekTimeUs) { // We need to make sure we're not seeking until we have seen the very first // PTS timestamp in the whole stream (from the beginning of the stream). while (!mTSParser->PTSTimeDeltaEstablished() && feedMoreTSData() == OK) usleep(100000); mDashSession->seekTo(seekTimeUs); return OK; };
status_t NuPlayer::HTTPLiveSource::seekTo(int64_t seekTimeUs, int64_t* newSeekTime) { // We need to make sure we're not seeking until we have seen the very first // PTS timestamp in the whole stream (from the beginning of the stream). while (!mTSParser->PTSTimeDeltaEstablished() && feedMoreTSData() == OK) { usleep(100000); } if( mFinalResult != OK ) { LOGW("Error state %d, Ignore this seek", mFinalResult); return mFinalResult; } mLiveSession->seekTo(seekTimeUs, newSeekTime); if( *newSeekTime >= 0 ) { mTSParser->signalDiscontinuity( ATSParser::DISCONTINUITY_SEEK, NULL); } return OK; }