Commit 79c7798d by Oliver Woodman

Reorganize BandwidthMeter interface

parent 64cc380f
...@@ -18,7 +18,24 @@ package com.google.android.exoplayer.upstream; ...@@ -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; ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment