what is the use of load control and live presentation delay specifying in ExoPlayer Android?

Viewed 33

I would like to know the following things, Kindly help me to understand why we use these components in ExoPlayer?

return new DashMediaSource.Factory(
    new DefaultDashChunkSource.Factory(mediaDataSourceFactory),
    buildDataSourceFactory(false))
    .setLoadErrorHandlingPolicy(new DefaultLoadErrorHandlingPolicy())
    .setLivePresentationDelayMs(LIVE_PRESENTATION_DELAY)
    .setDrmSessionManager(drmSessionManager)
    .setManifestParser(new TvGoDashManifestParser())
    .createMediaSource(mediaItem);

LIVE_PRESENTATION_DELAY = 10000

Here, what is the use of Live presentation delay in the above code if we reduce its value what would be the potential impact.

Also, we are setting the following buffering duration for load control. If we do changes on these items what would happen.

defaultLoadControl = new DefaultLoadControl.Builder()
    .setAllocator(new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE))
    .setBufferDurationsMs(DEFAULT_MIN_BUFFER_MS,
            DEFAULT_MAX_BUFFER_MS,
            DEFAULT_BUFFER_FOR_PLAYBACK_MS,
            DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS).build();

DEFAULT_MIN_BUFFER_MS = 15000

DEFAULT_MAX_BUFFER_MS = 50000

DEFAULT_BUFFER_FOR_PLAYBACK_MS = 1500

DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS = 3000

And if we didn't define load control for the ExoPlayer, then how does it handle these parameters by default?

1 Answers

All the parameters with their default values are documented in exoplayer's source code, and you can find them by searching in the github repo.

For the DefaultLoadControl parameters you can take a look at this line. the meaning of all 4 parameters with their default value is documented in the next lines in the provided link (copied here):

   /**
   * The default minimum duration of media that the player will attempt to ensure is buffered at all
   * times, in milliseconds.
   */
  public static final int DEFAULT_MIN_BUFFER_MS = 50_000;

  /**
   * The default maximum duration of media that the player will attempt to buffer, in milliseconds.
   */
  public static final int DEFAULT_MAX_BUFFER_MS = 50_000;

  /**
   * The default duration of media that must be buffered for playback to start or resume following a
   * user action such as a seek, in milliseconds.
   */
  public static final int DEFAULT_BUFFER_FOR_PLAYBACK_MS = 2500;

  /**
   * The default duration of media that must be buffered for playback to resume after a rebuffer, in
   * milliseconds. A rebuffer is defined to be caused by buffer depletion rather than a user action.
   */
  public static final int DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS = 5000;

For the presentation delay refer to this link and the following lines in the file. The following snippet is copied from provided link to keep the answer complete:

/**
   * The default target {@link Player#getCurrentLiveOffset() offset for live streams} that is used
   * if no value is defined in the {@link MediaItem} or the manifest.
   */
  public static final long DEFAULT_FALLBACK_TARGET_LIVE_OFFSET_MS = 30_000;
  /**
   * @deprecated Use {@link #DEFAULT_FALLBACK_TARGET_LIVE_OFFSET_MS} instead.
   */
  @Deprecated public static final long DEFAULT_LIVE_PRESENTATION_DELAY_MS = 30_000;

Keep in mind that depending on the version of the exoplayer library, default values for parameters are different, and parameters reported here are for the latest version.

Related