BandwidthMeter shouldn't extend TransferListener

There may be other ways to estimate bandwidth that don't
require listening to our own transfers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=127741651
This commit is contained in:
olly 2016-07-18 11:51:18 -07:00 committed by Oliver Woodman
parent 74b43e26bd
commit 6c2a967763
4 changed files with 4 additions and 6 deletions

View File

@ -53,7 +53,6 @@ import com.google.android.exoplayer2.trackselection.MappingTrackSelector.TrackIn
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout; import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.DebugTextViewHelper; import com.google.android.exoplayer2.ui.DebugTextViewHelper;
import com.google.android.exoplayer2.ui.PlayerControl; import com.google.android.exoplayer2.ui.PlayerControl;
import com.google.android.exoplayer2.upstream.BandwidthMeter;
import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
@ -152,7 +151,7 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
String userAgent = Util.getUserAgent(this, "ExoPlayerDemo"); String userAgent = Util.getUserAgent(this, "ExoPlayerDemo");
manifestDataSourceFactory = new DefaultDataSourceFactory(this, userAgent); manifestDataSourceFactory = new DefaultDataSourceFactory(this, userAgent);
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(); DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
mediaDataSourceFactory = new DefaultDataSourceFactory(this, userAgent, bandwidthMeter); mediaDataSourceFactory = new DefaultDataSourceFactory(this, userAgent, bandwidthMeter);
formatEvaluatorFactory = new AdaptiveEvaluator.Factory(bandwidthMeter); formatEvaluatorFactory = new AdaptiveEvaluator.Factory(bandwidthMeter);

View File

@ -18,7 +18,7 @@ package com.google.android.exoplayer2.upstream;
/** /**
* Provides estimates of the currently available bandwidth. * Provides estimates of the currently available bandwidth.
*/ */
public interface BandwidthMeter extends TransferListener { public interface BandwidthMeter {
/** /**
* Interface definition for a callback to be notified of {@link BandwidthMeter} events. * Interface definition for a callback to be notified of {@link BandwidthMeter} events.

View File

@ -25,7 +25,7 @@ import android.os.SystemClock;
* 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 final class DefaultBandwidthMeter implements BandwidthMeter { public final class DefaultBandwidthMeter implements BandwidthMeter, TransferListener {
public static final int DEFAULT_MAX_WEIGHT = 2000; public static final int DEFAULT_MAX_WEIGHT = 2000;

View File

@ -37,7 +37,6 @@ import com.google.android.exoplayer2.source.dash.DashMediaSource;
import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource; import com.google.android.exoplayer2.source.dash.DefaultDashChunkSource;
import com.google.android.exoplayer2.trackselection.MappingTrackSelector; import com.google.android.exoplayer2.trackselection.MappingTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelection; import com.google.android.exoplayer2.trackselection.TrackSelection;
import com.google.android.exoplayer2.upstream.BandwidthMeter;
import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter; import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
@ -425,7 +424,7 @@ public final class DashTest extends ActivityInstrumentationTestCase2<HostActivit
@Override @Override
public MediaSource buildSource(HostActivity host, String userAgent) { public MediaSource buildSource(HostActivity host, String userAgent) {
DataSource.Factory manifestDataSourceFactory = new DefaultDataSourceFactory(host, userAgent); DataSource.Factory manifestDataSourceFactory = new DefaultDataSourceFactory(host, userAgent);
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter(); DefaultBandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
DataSource.Factory mediaDataSourceFactory = new DefaultDataSourceFactory(host, userAgent, DataSource.Factory mediaDataSourceFactory = new DefaultDataSourceFactory(host, userAgent,
bandwidthMeter); bandwidthMeter);
FormatEvaluator.Factory formatEvaluatorFactory = new AdaptiveEvaluator.Factory( FormatEvaluator.Factory formatEvaluatorFactory = new AdaptiveEvaluator.Factory(