com.google.android.exoplayer2.util.SlidingPercentile Java Examples

The following examples show how to use com.google.android.exoplayer2.util.SlidingPercentile. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultBandwidthMeter.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private DefaultBandwidthMeter(
    @Nullable Context context,
    SparseArray<Long> initialBitrateEstimates,
    int maxWeight,
    Clock clock,
    boolean resetOnNetworkTypeChange) {
  this.context = context == null ? null : context.getApplicationContext();
  this.initialBitrateEstimates = initialBitrateEstimates;
  this.eventDispatcher = new EventDispatcher<>();
  this.slidingPercentile = new SlidingPercentile(maxWeight);
  this.clock = clock;
  // Set the initial network type and bitrate estimate
  networkType = context == null ? C.NETWORK_TYPE_UNKNOWN : Util.getNetworkType(context);
  bitrateEstimate = getInitialBitrateEstimateForNetworkType(networkType);
  // Register to receive connectivity actions if possible.
  if (context != null && resetOnNetworkTypeChange) {
    ConnectivityActionReceiver connectivityActionReceiver =
        ConnectivityActionReceiver.getInstance(context);
    connectivityActionReceiver.register(/* bandwidthMeter= */ this);
  }
}
 
Example #2
Source File: DefaultBandwidthMeter.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private DefaultBandwidthMeter(
    @Nullable Context context,
    SparseArray<Long> initialBitrateEstimates,
    int maxWeight,
    Clock clock,
    boolean resetOnNetworkTypeChange) {
  this.context = context == null ? null : context.getApplicationContext();
  this.initialBitrateEstimates = initialBitrateEstimates;
  this.eventDispatcher = new EventDispatcher<>();
  this.slidingPercentile = new SlidingPercentile(maxWeight);
  this.clock = clock;
  // Set the initial network type and bitrate estimate
  networkType = context == null ? C.NETWORK_TYPE_UNKNOWN : Util.getNetworkType(context);
  bitrateEstimate = getInitialBitrateEstimateForNetworkType(networkType);
  // Register to receive connectivity actions if possible.
  if (context != null && resetOnNetworkTypeChange) {
    ConnectivityActionReceiver connectivityActionReceiver =
        ConnectivityActionReceiver.getInstance(context);
    connectivityActionReceiver.register(/* bandwidthMeter= */ this);
  }
}
 
Example #3
Source File: DefaultBandwidthMeter.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private DefaultBandwidthMeter(
    @Nullable Context context,
    SparseArray<Long> initialBitrateEstimates,
    int maxWeight,
    Clock clock,
    boolean resetOnNetworkTypeChange) {
  this.context = context == null ? null : context.getApplicationContext();
  this.initialBitrateEstimates = initialBitrateEstimates;
  this.eventDispatcher = new EventDispatcher<>();
  this.slidingPercentile = new SlidingPercentile(maxWeight);
  this.clock = clock;
  // Set the initial network type and bitrate estimate
  networkType = context == null ? C.NETWORK_TYPE_UNKNOWN : Util.getNetworkType(context);
  bitrateEstimate = getInitialBitrateEstimateForNetworkType(networkType);
  // Register to receive connectivity actions if possible.
  if (context != null && resetOnNetworkTypeChange) {
    ConnectivityActionReceiver connectivityActionReceiver =
        ConnectivityActionReceiver.getInstance(context);
    connectivityActionReceiver.register(/* bandwidthMeter= */ this);
  }
}
 
Example #4
Source File: DefaultBandwidthMeter.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private DefaultBandwidthMeter(
    long initialBitrateEstimate,
    int maxWeight,
    Clock clock) {
  this.eventDispatcher = new EventDispatcher<>();
  this.slidingPercentile = new SlidingPercentile(maxWeight);
  this.clock = clock;
  bitrateEstimate = initialBitrateEstimate;
}
 
Example #5
Source File: DefaultBandwidthMeter.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private DefaultBandwidthMeter(
    long initialBitrateEstimate,
    int maxWeight,
    Clock clock) {
  this.eventDispatcher = new EventDispatcher<>();
  this.slidingPercentile = new SlidingPercentile(maxWeight);
  this.clock = clock;
  bitrateEstimate = initialBitrateEstimate;
}
 
Example #6
Source File: DefaultBandwidthMeter.java    From K-Sonic with MIT License 4 votes vote down vote up
public DefaultBandwidthMeter(Handler eventHandler, EventListener eventListener, int maxWeight) {
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  this.slidingPercentile = new SlidingPercentile(maxWeight);
  bitrateEstimate = NO_ESTIMATE;
}