diff --git a/library/src/main/java/com/google/android/exoplayer/upstream/BandwidthMeter.java b/library/src/main/java/com/google/android/exoplayer/upstream/BandwidthMeter.java index 5bbffb6c1f..f8f7eb24af 100644 --- a/library/src/main/java/com/google/android/exoplayer/upstream/BandwidthMeter.java +++ b/library/src/main/java/com/google/android/exoplayer/upstream/BandwidthMeter.java @@ -18,7 +18,24 @@ package com.google.android.exoplayer.upstream; /** * 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. diff --git a/library/src/main/java/com/google/android/exoplayer/upstream/DefaultBandwidthMeter.java b/library/src/main/java/com/google/android/exoplayer/upstream/DefaultBandwidthMeter.java index ce2197e2cf..f2c7ec49b1 100644 --- a/library/src/main/java/com/google/android/exoplayer/upstream/DefaultBandwidthMeter.java +++ b/library/src/main/java/com/google/android/exoplayer/upstream/DefaultBandwidthMeter.java @@ -26,25 +26,7 @@ import android.os.Handler; * Counts transferred bytes while transfers are open and creates a bandwidth sample and updated * bandwidth estimate each time a transfer ends. */ -public class DefaultBandwidthMeter implements BandwidthMeter, TransferListener { - - /** - * 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); - - } +public class DefaultBandwidthMeter implements BandwidthMeter { private static final int DEFAULT_MAX_WEIGHT = 2000;