mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Reorganize BandwidthMeter interface
This commit is contained in:
parent
64cc380fe1
commit
79c7798d84
2 changed files with 19 additions and 20 deletions
|
|
@ -18,7 +18,24 @@ package com.google.android.exoplayer.upstream;
|
||||||
/**
|
/**
|
||||||
* Provides estimates of the currently available bandwidth.
|
* Provides estimates of the currently available bandwidth.
|
||||||
*/
|
*/
|
||||||
public interface BandwidthMeter {
|
public interface BandwidthMeter extends TransferListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface definition for a callback to be notified of {@link BandwidthMeter} events.
|
||||||
|
*/
|
||||||
|
public interface EventListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked periodically to indicate that bytes have been transferred.
|
||||||
|
*
|
||||||
|
* @param elapsedMs The time taken to transfer the bytes, in milliseconds.
|
||||||
|
* @param bytes The number of bytes transferred.
|
||||||
|
* @param bitrate The estimated bitrate in bits/sec, or {@link #NO_ESTIMATE} if no estimate
|
||||||
|
* is available. Note that this estimate is typically derived from more information than
|
||||||
|
* {@code bytes} and {@code elapsedMs}.
|
||||||
|
*/
|
||||||
|
void onBandwidthSample(int elapsedMs, long bytes, long bitrate);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates no bandwidth estimate is available.
|
* Indicates no bandwidth estimate is available.
|
||||||
|
|
|
||||||
|
|
@ -26,25 +26,7 @@ import android.os.Handler;
|
||||||
* Counts transferred bytes while transfers are open and creates a bandwidth sample and updated
|
* Counts transferred bytes while transfers are open and creates a bandwidth sample and updated
|
||||||
* bandwidth estimate each time a transfer ends.
|
* bandwidth estimate each time a transfer ends.
|
||||||
*/
|
*/
|
||||||
public class DefaultBandwidthMeter implements BandwidthMeter, TransferListener {
|
public class DefaultBandwidthMeter implements BandwidthMeter {
|
||||||
|
|
||||||
/**
|
|
||||||
* Interface definition for a callback to be notified of {@link DefaultBandwidthMeter} events.
|
|
||||||
*/
|
|
||||||
public interface EventListener {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoked periodically to indicate that bytes have been transferred.
|
|
||||||
*
|
|
||||||
* @param elapsedMs The time taken to transfer the bytes, in milliseconds.
|
|
||||||
* @param bytes The number of bytes transferred.
|
|
||||||
* @param bitrate The estimated bitrate in bits/sec, or {@link #NO_ESTIMATE} if no estimate
|
|
||||||
* is available. Note that this estimate is typically derived from more information than
|
|
||||||
* {@code bytes} and {@code elapsedMs}.
|
|
||||||
*/
|
|
||||||
void onBandwidthSample(int elapsedMs, long bytes, long bitrate);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int DEFAULT_MAX_WEIGHT = 2000;
|
private static final int DEFAULT_MAX_WEIGHT = 2000;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue