[CicadaPlayer] seek: Implementation of SeekInCache(int64_t pos)

Implementation of SuperMediaPlayer::SeekInCache(int64_t pos)

  • The pos of seek is the pts value.
  • The buffer is a list, so the inserted packets are inserted into the list in the order of arrival, that is, unsorted.
  • The pts of the package should normally be monotonic and continuous.
  • Even if it's not monotonically continuous, the cache doesn't care.
  • The seek operation mainly compares pos and mCurrentPos first.
  • pos is smaller than mCurrentPos, then backward, backward is to search pts from the cache
  • Looking forward is also in the cache.

The media packet queue is a list: linked list

        std::list<mediaPacket> mQueue;

mPlayedAudioPts is initialized to INT64_MIN

        int64_t mPlayedAudioPts{
   
    
    INT64_MIN

Guess you like

Origin blog.csdn.net/commshare/article/details/132534200