Class DefaultBandwidthMeter

    • Field Detail

      • DEFAULT_INITIAL_BITRATE_COUNTRY_GROUPS

        public static final ImmutableListMultimap<String,​Integer> DEFAULT_INITIAL_BITRATE_COUNTRY_GROUPS
        Country groups used to determine the default initial bitrate estimate. The group assignment for each country is a list for [Wifi, 2G, 3G, 4G, 5G_NSA, 5G_SA].
      • DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI

        public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI
        Default initial Wifi bitrate estimate in bits per second.
      • DEFAULT_INITIAL_BITRATE_ESTIMATES_2G

        public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_2G
        Default initial 2G bitrate estimates in bits per second.
      • DEFAULT_INITIAL_BITRATE_ESTIMATES_3G

        public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_3G
        Default initial 3G bitrate estimates in bits per second.
      • DEFAULT_INITIAL_BITRATE_ESTIMATES_4G

        public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_4G
        Default initial 4G bitrate estimates in bits per second.
      • DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_NSA

        public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_NSA
        Default initial 5G-NSA bitrate estimates in bits per second.
      • DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_SA

        public static final ImmutableList<Long> DEFAULT_INITIAL_BITRATE_ESTIMATES_5G_SA
        Default initial 5G-SA bitrate estimates in bits per second.
      • DEFAULT_INITIAL_BITRATE_ESTIMATE

        public static final long DEFAULT_INITIAL_BITRATE_ESTIMATE
        Default initial bitrate estimate used when the device is offline or the network type cannot be determined, in bits per second.
        See Also:
        Constant Field Values
      • DEFAULT_SLIDING_WINDOW_MAX_WEIGHT

        public static final int DEFAULT_SLIDING_WINDOW_MAX_WEIGHT
        Default maximum weight for the sliding window.
        See Also:
        Constant Field Values
    • Method Detail

      • setNetworkTypeOverride

        public void setNetworkTypeOverride​(@NetworkType
                                           int networkType)
        Overrides the network type. Handled in the same way as if the meter had detected a change from the current network type to the specified network type internally.

        Applications should not normally call this method. It is intended for testing purposes.

        Parameters:
        networkType - The overriding network type.
      • onTransferInitializing

        public void onTransferInitializing​(DataSource source,
                                           DataSpec dataSpec,
                                           boolean isNetwork)
        Description copied from interface: TransferListener
        Called when a transfer is being initialized.
        Specified by:
        onTransferInitializing in interface TransferListener
        Parameters:
        source - The source performing the transfer.
        dataSpec - Describes the data for which the transfer is initialized.
        isNetwork - Whether the data is transferred through a network.
      • onTransferStart

        public void onTransferStart​(DataSource source,
                                    DataSpec dataSpec,
                                    boolean isNetwork)
        Description copied from interface: TransferListener
        Called when a transfer starts.
        Specified by:
        onTransferStart in interface TransferListener
        Parameters:
        source - The source performing the transfer.
        dataSpec - Describes the data being transferred.
        isNetwork - Whether the data is transferred through a network.
      • onBytesTransferred

        public void onBytesTransferred​(DataSource source,
                                       DataSpec dataSpec,
                                       boolean isNetwork,
                                       int bytes)
        Description copied from interface: TransferListener
        Called incrementally during a transfer.
        Specified by:
        onBytesTransferred in interface TransferListener
        Parameters:
        source - The source performing the transfer.
        dataSpec - Describes the data being transferred.
        isNetwork - Whether the data is transferred through a network.
        bytes - The number of bytes transferred since the previous call to this method
      • onTransferEnd

        public void onTransferEnd​(DataSource source,
                                  DataSpec dataSpec,
                                  boolean isNetwork)
        Description copied from interface: TransferListener
        Called when a transfer ends.
        Specified by:
        onTransferEnd in interface TransferListener
        Parameters:
        source - The source performing the transfer.
        dataSpec - Describes the data being transferred.
        isNetwork - Whether the data is transferred through a network.