func: status_t MediaBuffer **out, const ReadOptions *options) int64_t seekTimeUs ; ReadOptions :: SeekMode mode ; if ( options && options -> getSeekTo ( & seekTimeUs , & mode ) )  int numSidxEntries = mSegments . size ( ) ; if ( numSidxEntries != 0 )  mCurrentSampleIndex = 0; if ( mBuffer != NULL )  mBuffer = NULL; off64_t offset = 0 ; size_t size = 0 ; if ( mBuffer == NULL )  if ( mCurrentSampleIndex >= mCurrentSamples . size ( ) )  off64_t nextMoof = mNextMoofOffset ; mCurrentSampleIndex = 0; uint32_t hdr [ 2 ] ; if ( mDataSource -> readAt ( nextMoof , hdr , 8 ) < 8 )  uint64_t chunk_size = ntohl ( hdr [ 0 ] ) ; uint32_t chunk_type = ntohl ( hdr [ 1 ] ) ; if ( chunk_type == FOURCC ( 's' , 't' , 'y' , 'p' ) || chunk_type == FOURCC ( 's' , 'i' , 'd' , 'x' ) )  nextMoof += chunk_size; status_t ret = parseChunk ( & nextMoof ) ; if ( ret != OK )  while ( mCurrentSamples . size ( ) == 0 )  const Sample * smpl = & mCurrentSamples [ mCurrentSampleIndex ] ; offset = smpl -> offset; size = smpl -> size; int32_t max_size ; if ( ! ValidInputSize ( max_size ) )  static bool ValidInputSize(int32_t size) return ( size > 0 && size < 4 * ( 1920 * 1080 ) * 3 / 2 ) ; mBuffer = new MediaBuffer ( max_size ); if ( ! mIsAVC || mWantsNALFragments )  int32_t drm = 0 ; bool usesDRM = ( mFormat -> findInt32 ( kKeyIsDRM , & drm ) && drm != 0 ) ; if ( usesDRM )  num_bytes_read = mDataSource -> readAt ( offset , ( uint8_t * ) mBuffer -> data ( ) , size ); num_bytes_read = mDataSource -> readAt ( offset , mSrcBuffer , size ); if ( num_bytes_read < ( ssize_t ) size )  if ( usesDRM )  uint8_t * dstData = ( uint8_t * ) mBuffer -> data ( ) ; size_t srcOffset = 0 ; size_t dstOffset = 0 ; while ( srcOffset < size )  bool isMalFormed = ( srcOffset + mNALLengthSize > size ) ; size_t nalLength = 0 ; if ( ! isMalFormed )  nalLength = parseNALSize ( & mSrcBuffer [ srcOffset ] ); srcOffset += mNALLengthSize; isMalFormed = srcOffset + nalLength > size; if ( isMalFormed )  if ( nalLength == 0 )  dstData [ dstOffset ++ ] = ( uint8_t ) ( nalLength >> 24 ); dstData [ dstOffset ++ ] = ( uint8_t ) ( nalLength >> 16 ); dstData [ dstOffset ++ ] = ( uint8_t ) ( nalLength >> 8 ); dstData [ dstOffset ++ ] = ( uint8_t ) nalLength; memcpy ( & dstData [ dstOffset ] , & mSrcBuffer [ srcOffset ] , nalLength ); srcOffset += nalLength; dstOffset += nalLength; 