public ChunkDownloadManager(IMediaPlugin mediaPlugin, long maximumRequestRate = DefaultMaximumRequestRate)
 {
     MaximumRetryAttempts      = DefaultMaximumRetryAttempts;
     MaximumConcurrentRequests = DefaultMaximumConcurrentRequests;
     Timeout = TimeSpan.FromMilliseconds(DefaultTimeoutMillis);
     _chunkDownloadStrategy = ChunkDownloadStrategy.AsNeeded;
     _mediaPlugin           = mediaPlugin;
     _maximumRequestRate    = maximumRequestRate;
     _requests              = new DownloadRequestCollection();
     _rateMonitor           = new RateMonitor();
     _refreshTimer          = new DispatcherTimer();
     _refreshTimer.Interval = TimeSpan.FromMilliseconds(DefaultAsNeededWindowMillis - DefaultTimeoutMillis);
     _refreshTimer.Tick    += _refreshTimer_Tick;
 }
 public ChunkDownloadManager(IMediaPlugin mediaPlugin, long maximumRequestRate = DefaultMaximumRequestRate)
 {
     MaximumRetryAttempts = DefaultMaximumRetryAttempts;
     MaximumConcurrentRequests = DefaultMaximumConcurrentRequests;
     Timeout = TimeSpan.FromMilliseconds(DefaultTimeoutMillis);
     _chunkDownloadStrategy = ChunkDownloadStrategy.AsNeeded;
     _mediaPlugin = mediaPlugin;
     _maximumRequestRate = maximumRequestRate;
     _requests = new DownloadRequestCollection();
     _rateMonitor = new RateMonitor();
     _refreshTimer = new DispatcherTimer();
     _refreshTimer.Interval = TimeSpan.FromMilliseconds(DefaultAsNeededWindowMillis - DefaultTimeoutMillis);
     _refreshTimer.Tick += _refreshTimer_Tick;
 }
 private void SetChunkDownloadStrategy(ChunkDownloadStrategy strategy)
 {
     if (_activeMediaPlugin is IAdaptiveMediaPlugin)
     {
         if (strategy == ChunkDownloadStrategy.Unspecified)
         {
             strategy = this.ChunkDownloadStrategy;
         }
         if (strategy == ChunkDownloadStrategy.Unspecified)
         {
             strategy = ChunkDownloadStrategy.AsNeeded;
         }
         (_activeMediaPlugin as IAdaptiveMediaPlugin).ChunkDownloadStrategy = strategy;
     }
 }