Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
79c7798d
authored
May 11, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Reorganize BandwidthMeter interface
parent
64cc380f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
20 deletions
library/src/main/java/com/google/android/exoplayer/upstream/BandwidthMeter.java
library/src/main/java/com/google/android/exoplayer/upstream/DefaultBandwidthMeter.java
library/src/main/java/com/google/android/exoplayer/upstream/BandwidthMeter.java
View file @
79c7798d
...
...
@@ -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.
...
...
library/src/main/java/com/google/android/exoplayer/upstream/DefaultBandwidthMeter.java
View file @
79c7798d
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment