private boolean discardUpstreamMediaChunks(int queueLength){
  if (mediaChunks.size() <= queueLength) {
    return false;
  }
  long startTimeUs=0;
  long endTimeUs=mediaChunks.getLast().endTimeUs;
  BaseMediaChunk removed=null;
  while (mediaChunks.size() > queueLength) {
    removed=mediaChunks.removeLast();
    startTimeUs=removed.startTimeUs;
  }
  sampleQueue.discardUpstreamSamples(removed.getFirstSampleIndex());
  notifyUpstreamDiscarded(startTimeUs,endTimeUs);
  return true;
}

private boolean discardUpstreamMediaChunks ( int queueLength ) { if ( mediaChunks . size ( ) <= queueLength ) { return false ; } long startTimeUs = 0 ; long endTimeUs = mediaChunks . getLast ( ) . endTimeUs ; BaseMediaChunk removed = null ; while ( mediaChunks . size ( ) > queueLength ) { removed = mediaChunks . removeLast ( ) ; startTimeUs = removed . startTimeUs ; } sampleQueue . discardUpstreamSamples ( removed . getFirstSampleIndex ( ) ) ; notifyUpstreamDiscarded ( startTimeUs , endTimeUs ) ; return true ; }
discard upstream media chunks until the queue length is equal to the length specified .
