private void restartFrom(long positionUs) {
   pendingResetPositionUs = positionUs;
   loadingFinished = false;
   if (loader.isLoading()) {
     loader.cancelLoading();
   } else {
     sampleQueue.clear();
     mediaChunks.clear();
     clearCurrentLoadable();
     updateLoadControl();
   }
 }
 @Override
 public void disable(int track) {
   Assertions.checkState(state == STATE_ENABLED);
   Assertions.checkState(--enabledTrackCount == 0);
   state = STATE_PREPARED;
   try {
     chunkSource.disable(mediaChunks);
   } finally {
     loadControl.unregister(this);
     if (loader.isLoading()) {
       loader.cancelLoading();
     } else {
       sampleQueue.clear();
       mediaChunks.clear();
       clearCurrentLoadable();
       loadControl.trimAllocator();
     }
   }
 }