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
7e8ba031
authored
Aug 09, 2021
by
olly
Committed by
Oliver Woodman
Aug 09, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Deprecate final non-nested Factory classes in upstream
PiperOrigin-RevId: 389661768
parent
e2ffb5e1
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
142 additions
and
64 deletions
demos/gl/src/main/java/com/google/android/exoplayer2/gldemo/MainActivity.java
demos/main/src/main/java/com/google/android/exoplayer2/demo/DemoUtil.java
demos/surface/src/main/java/com/google/android/exoplayer2/surfacedemo/MainActivity.java
docs/customization.md
docs/network-stacks.md
extensions/flac/src/androidTest/java/com/google/android/exoplayer2/ext/flac/FlacExtractorSeekTest.java
extensions/flac/src/androidTest/java/com/google/android/exoplayer2/ext/flac/FlacPlaybackTest.java
extensions/ima/src/androidTest/java/com/google/android/exoplayer2/ext/ima/ImaPlaybackTest.java
extensions/media2/src/androidTest/java/com/google/android/exoplayer2/ext/media2/PlayerTestRule.java
extensions/opus/src/androidTest/java/com/google/android/exoplayer2/ext/opus/OpusPlaybackTest.java
extensions/vp9/src/androidTest/java/com/google/android/exoplayer2/ext/vp9/VpxPlaybackTest.java
library/core/src/main/java/com/google/android/exoplayer2/source/DefaultMediaSourceFactory.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSourceFactory.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/PriorityDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/PriorityDataSourceFactory.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/amr/AmrExtractorSeekTest.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/flac/FlacExtractorSeekTest.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/flv/FlvExtractorSeekTest.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp3/ConstantBitrateSeekerTest.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp3/IndexSeekerTest.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/AdtsExtractorSeekTest.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/PsExtractorSeekTest.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/TsExtractorSeekTest.java
playbacktests/src/androidTest/java/com/google/android/exoplayer2/playbacktests/gts/DashTestRunner.java
demos/gl/src/main/java/com/google/android/exoplayer2/gldemo/MainActivity.java
View file @
7e8ba031
...
...
@@ -36,8 +36,8 @@ import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import
com.google.android.exoplayer2.source.dash.DashMediaSource
;
import
com.google.android.exoplayer2.ui.PlayerView
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultHttpDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultHttpDataSource
;
import
com.google.android.exoplayer2.upstream.HttpDataSource
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.EventLogger
;
...
...
@@ -144,7 +144,7 @@ public final class MainActivity extends Activity {
String
drmScheme
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_SCHEME_EXTRA
));
String
drmLicenseUrl
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_LICENSE_URL_EXTRA
));
UUID
drmSchemeUuid
=
Assertions
.
checkNotNull
(
Util
.
getDrmUuid
(
drmScheme
));
HttpDataSource
.
Factory
licenseDataSourceFactory
=
new
DefaultHttpDataSourceFactory
();
HttpDataSource
.
Factory
licenseDataSourceFactory
=
new
DefaultHttpDataSource
.
Factory
();
HttpMediaDrmCallback
drmCallback
=
new
HttpMediaDrmCallback
(
drmLicenseUrl
,
licenseDataSourceFactory
);
drmSessionManager
=
...
...
@@ -155,7 +155,7 @@ public final class MainActivity extends Activity {
drmSessionManager
=
DrmSessionManager
.
DRM_UNSUPPORTED
;
}
DataSource
.
Factory
dataSourceFactory
=
new
DefaultDataSourceFactory
(
this
);
DataSource
.
Factory
dataSourceFactory
=
new
DefaultDataSource
.
Factory
(
this
);
MediaSource
mediaSource
;
@C
.
ContentType
int
type
=
Util
.
inferContentType
(
uri
,
intent
.
getStringExtra
(
EXTENSION_EXTRA
));
if
(
type
==
C
.
TYPE_DASH
)
{
...
...
demos/main/src/main/java/com/google/android/exoplayer2/demo/DemoUtil.java
View file @
7e8ba031
...
...
@@ -29,7 +29,7 @@ import com.google.android.exoplayer2.offline.DefaultDownloadIndex;
import
com.google.android.exoplayer2.offline.DownloadManager
;
import
com.google.android.exoplayer2.ui.DownloadNotificationHelper
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultHttpDataSource
;
import
com.google.android.exoplayer2.upstream.HttpDataSource
;
import
com.google.android.exoplayer2.upstream.cache.Cache
;
...
...
@@ -127,8 +127,8 @@ public final class DemoUtil {
public
static
synchronized
DataSource
.
Factory
getDataSourceFactory
(
Context
context
)
{
if
(
dataSourceFactory
==
null
)
{
context
=
context
.
getApplicationContext
();
DefaultDataSourceFactory
upstreamFactory
=
new
DefaultDataSourceFactory
(
context
,
getHttpDataSourceFactory
(
context
));
DefaultDataSource
.
Factory
upstreamFactory
=
new
DefaultDataSource
.
Factory
(
context
,
getHttpDataSourceFactory
(
context
));
dataSourceFactory
=
buildReadOnlyCacheDataSource
(
upstreamFactory
,
getDownloadCache
(
context
));
}
return
dataSourceFactory
;
...
...
demos/surface/src/main/java/com/google/android/exoplayer2/surfacedemo/MainActivity.java
View file @
7e8ba031
...
...
@@ -40,8 +40,8 @@ import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import
com.google.android.exoplayer2.source.dash.DashMediaSource
;
import
com.google.android.exoplayer2.ui.PlayerControlView
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultHttpDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultHttpDataSource
;
import
com.google.android.exoplayer2.upstream.HttpDataSource
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Util
;
...
...
@@ -189,7 +189,7 @@ public final class MainActivity extends Activity {
String
drmScheme
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_SCHEME_EXTRA
));
String
drmLicenseUrl
=
Assertions
.
checkNotNull
(
intent
.
getStringExtra
(
DRM_LICENSE_URL_EXTRA
));
UUID
drmSchemeUuid
=
Assertions
.
checkNotNull
(
Util
.
getDrmUuid
(
drmScheme
));
HttpDataSource
.
Factory
licenseDataSourceFactory
=
new
DefaultHttpDataSourceFactory
();
HttpDataSource
.
Factory
licenseDataSourceFactory
=
new
DefaultHttpDataSource
.
Factory
();
HttpMediaDrmCallback
drmCallback
=
new
HttpMediaDrmCallback
(
drmLicenseUrl
,
licenseDataSourceFactory
);
drmSessionManager
=
...
...
@@ -200,7 +200,7 @@ public final class MainActivity extends Activity {
drmSessionManager
=
DrmSessionManager
.
DRM_UNSUPPORTED
;
}
DataSource
.
Factory
dataSourceFactory
=
new
DefaultDataSourceFactory
(
this
);
DataSource
.
Factory
dataSourceFactory
=
new
DefaultDataSource
.
Factory
(
this
);
MediaSource
mediaSource
;
@C
.
ContentType
int
type
=
Util
.
inferContentType
(
uri
,
intent
.
getStringExtra
(
EXTENSION_EXTRA
));
if
(
type
==
C
.
TYPE_DASH
)
{
...
...
docs/customization.md
View file @
7e8ba031
...
...
@@ -53,10 +53,10 @@ default network stack with cross-protocol redirects enabled:
HttpDataSource.Factory httpDataSourceFactory =
new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true);
// Wrap the HttpDataSource.Factory in a DefaultDataSourceFactory, which adds in
// Wrap the HttpDataSource.Factory in a DefaultDataSource
.
Factory, which adds in
// support for requesting data from other sources (e.g., files, resources, etc).
DefaultDataSourceFactory dataSourceFactory =
new DefaultDataSourceFactory(context, httpDataSourceFactory);
DefaultDataSource
.
Factory dataSourceFactory =
new DefaultDataSource
.
Factory(context, httpDataSourceFactory);
// Inject the DefaultDataSourceFactory when creating the player.
SimpleExoPlayer player =
...
...
docs/network-stacks.md
View file @
7e8ba031
...
...
@@ -40,11 +40,11 @@ the Cronet network stack and also support playback of non-http(s) content.
CronetDataSource.Factory cronetDataSourceFactory =
new CronetDataSource.Factory(cronetEngine, executor);
// Wrap the CronetDataSource.Factory in a DefaultDataSourceFactory, which adds
// Wrap the CronetDataSource.Factory in a DefaultDataSource
.
Factory, which adds
// in support for requesting data from other sources (e.g., files, resources,
// etc).
DefaultDataSourceFactory dataSourceFactory =
new DefaultDataSourceFactory(
DefaultDataSource
.
Factory dataSourceFactory =
new DefaultDataSource
.
Factory(
context,
/* baseDataSourceFactory= */ cronetDataSourceFactory);
...
...
extensions/flac/src/androidTest/java/com/google/android/exoplayer2/ext/flac/FlacExtractorSeekTest.java
View file @
7e8ba031
...
...
@@ -26,7 +26,6 @@ import com.google.android.exoplayer2.testutil.FakeExtractorOutput;
import
com.google.android.exoplayer2.testutil.FakeTrackOutput
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
import
com.google.android.exoplayer2.util.Util
;
import
java.io.IOException
;
import
java.util.List
;
...
...
@@ -43,10 +42,10 @@ public final class FlacExtractorSeekTest {
"media/flac/bear_no_seek_table_no_num_samples.flac"
;
private
static
final
int
DURATION_US
=
2_741_000
;
private
FlacExtractor
extractor
=
new
FlacExtractor
();
private
FakeExtractorOutput
extractorOutput
=
new
FakeExtractorOutput
();
private
DefaultDataSource
dataSource
=
new
DefaultDataSourceFactory
(
ApplicationProvider
.
getApplicationContext
()).
createDataSource
();
private
final
FlacExtractor
extractor
=
new
FlacExtractor
();
private
final
FakeExtractorOutput
extractorOutput
=
new
FakeExtractorOutput
();
private
final
DefaultDataSource
dataSource
=
new
DefaultDataSource
.
Factory
(
ApplicationProvider
.
getApplicationContext
()).
createDataSource
();
@Test
public
void
flacExtractorReads_seekTable_returnSeekableSeekMap
()
throws
IOException
{
...
...
extensions/flac/src/androidTest/java/com/google/android/exoplayer2/ext/flac/FlacPlaybackTest.java
View file @
7e8ba031
...
...
@@ -37,7 +37,7 @@ import com.google.android.exoplayer2.source.MediaSource;
import
com.google.android.exoplayer2.source.ProgressiveMediaSource
;
import
com.google.android.exoplayer2.testutil.CapturingAudioSink
;
import
com.google.android.exoplayer2.testutil.DumpFileAsserts
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
...
...
@@ -120,7 +120,7 @@ public class FlacPlaybackTest {
player
.
addListener
(
this
);
MediaSource
mediaSource
=
new
ProgressiveMediaSource
.
Factory
(
new
DefaultDataSourceFactory
(
context
),
MatroskaExtractor
.
FACTORY
)
new
DefaultDataSource
.
Factory
(
context
),
MatroskaExtractor
.
FACTORY
)
.
createMediaSource
(
MediaItem
.
fromUri
(
uri
));
player
.
setMediaSource
(
mediaSource
);
player
.
prepare
();
...
...
extensions/ima/src/androidTest/java/com/google/android/exoplayer2/ext/ima/ImaPlaybackTest.java
View file @
7e8ba031
...
...
@@ -44,7 +44,7 @@ import com.google.android.exoplayer2.testutil.TestUtil;
import
com.google.android.exoplayer2.trackselection.MappingTrackSelector
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DataSpec
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Util
;
import
java.util.ArrayList
;
...
...
@@ -235,7 +235,7 @@ public final class ImaPlaybackTest {
protected
MediaSource
buildSource
(
HostActivity
host
,
DrmSessionManager
drmSessionManager
,
FrameLayout
overlayFrameLayout
)
{
Context
context
=
host
.
getApplicationContext
();
DataSource
.
Factory
dataSourceFactory
=
new
DefaultDataSourceFactory
(
context
);
DataSource
.
Factory
dataSourceFactory
=
new
DefaultDataSource
.
Factory
(
context
);
MediaSource
contentMediaSource
=
new
DefaultMediaSourceFactory
(
context
).
createMediaSource
(
MediaItem
.
fromUri
(
contentUri
));
return
new
AdsMediaSource
(
...
...
extensions/media2/src/androidTest/java/com/google/android/exoplayer2/ext/media2/PlayerTestRule.java
View file @
7e8ba031
...
...
@@ -25,7 +25,7 @@ import com.google.android.exoplayer2.SimpleExoPlayer;
import
com.google.android.exoplayer2.source.DefaultMediaSourceFactory
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DataSpec
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.TransferListener
;
import
java.io.IOException
;
import
java.util.List
;
...
...
@@ -116,10 +116,10 @@ import org.junit.rules.ExternalResource;
private
final
class
InstrumentingDataSourceFactory
implements
DataSource
.
Factory
{
private
final
DefaultDataSourceFactory
defaultDataSourceFactory
;
private
final
DefaultDataSource
.
Factory
defaultDataSourceFactory
;
public
InstrumentingDataSourceFactory
(
Context
context
)
{
defaultDataSourceFactory
=
new
DefaultDataSourceFactory
(
context
);
defaultDataSourceFactory
=
new
DefaultDataSource
.
Factory
(
context
);
}
@Override
...
...
extensions/opus/src/androidTest/java/com/google/android/exoplayer2/ext/opus/OpusPlaybackTest.java
View file @
7e8ba031
...
...
@@ -32,7 +32,7 @@ import com.google.android.exoplayer2.SimpleExoPlayer;
import
com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.ProgressiveMediaSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
...
...
@@ -100,7 +100,7 @@ public class OpusPlaybackTest {
player
.
addListener
(
this
);
MediaSource
mediaSource
=
new
ProgressiveMediaSource
.
Factory
(
new
DefaultDataSourceFactory
(
context
),
MatroskaExtractor
.
FACTORY
)
new
DefaultDataSource
.
Factory
(
context
),
MatroskaExtractor
.
FACTORY
)
.
createMediaSource
(
MediaItem
.
fromUri
(
uri
));
player
.
setMediaSource
(
mediaSource
);
player
.
prepare
();
...
...
extensions/vp9/src/androidTest/java/com/google/android/exoplayer2/ext/vp9/VpxPlaybackTest.java
View file @
7e8ba031
...
...
@@ -33,7 +33,7 @@ import com.google.android.exoplayer2.SimpleExoPlayer;
import
com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor
;
import
com.google.android.exoplayer2.source.MediaSource
;
import
com.google.android.exoplayer2.source.ProgressiveMediaSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.util.Log
;
import
com.google.android.exoplayer2.video.VideoDecoderGLSurfaceView
;
import
org.junit.Before
;
...
...
@@ -134,7 +134,7 @@ public class VpxPlaybackTest {
player
.
addListener
(
this
);
MediaSource
mediaSource
=
new
ProgressiveMediaSource
.
Factory
(
new
DefaultDataSourceFactory
(
context
),
MatroskaExtractor
.
FACTORY
)
new
DefaultDataSource
.
Factory
(
context
),
MatroskaExtractor
.
FACTORY
)
.
createMediaSource
(
MediaItem
.
fromUri
(
uri
));
player
.
setVideoSurfaceView
(
new
VideoDecoderGLSurfaceView
(
context
));
player
.
setMediaSource
(
mediaSource
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/source/DefaultMediaSourceFactory.java
View file @
7e8ba031
...
...
@@ -32,7 +32,7 @@ import com.google.android.exoplayer2.source.ads.AdsMediaSource;
import
com.google.android.exoplayer2.ui.AdViewProvider
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DataSpec
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.HttpDataSource
;
import
com.google.android.exoplayer2.upstream.LoadErrorHandlingPolicy
;
import
com.google.android.exoplayer2.util.Assertions
;
...
...
@@ -119,7 +119,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* @param context Any context.
*/
public
DefaultMediaSourceFactory
(
Context
context
)
{
this
(
new
DefaultDataSourceFactory
(
context
));
this
(
new
DefaultDataSource
.
Factory
(
context
));
}
/**
...
...
@@ -130,7 +130,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* its container.
*/
public
DefaultMediaSourceFactory
(
Context
context
,
ExtractorsFactory
extractorsFactory
)
{
this
(
new
DefaultDataSourceFactory
(
context
),
extractorsFactory
);
this
(
new
DefaultDataSource
.
Factory
(
context
),
extractorsFactory
);
}
/**
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSource.java
View file @
7e8ba031
...
...
@@ -55,6 +55,63 @@ import java.util.Map;
*/
public
final
class
DefaultDataSource
implements
DataSource
{
/** {@link DataSource.Factory} for {@link DefaultDataSource} instances. */
public
static
final
class
Factory
implements
DataSource
.
Factory
{
private
final
Context
context
;
private
final
DataSource
.
Factory
baseDataSourceFactory
;
@Nullable
private
TransferListener
transferListener
;
/**
* Creates an instance.
*
* @param context A context.
*/
public
Factory
(
Context
context
)
{
this
(
context
,
new
DefaultHttpDataSource
.
Factory
());
}
/**
* Creates an instance.
*
* @param context A context.
* @param baseDataSourceFactory The {@link DataSource.Factory} to be used to create base {@link
* DataSource DataSources} for {@link DefaultDataSource} instances. The base {@link
* DataSource} is normally an {@link HttpDataSource}, and is responsible for fetching data
* over HTTP and HTTPS, as well as any other URI schemes not otherwise supported by {@link
* DefaultDataSource}.
*/
public
Factory
(
Context
context
,
DataSource
.
Factory
baseDataSourceFactory
)
{
this
.
context
=
context
.
getApplicationContext
();
this
.
baseDataSourceFactory
=
baseDataSourceFactory
;
}
/**
* Sets the {@link TransferListener} that will be used.
*
* <p>The default is {@code null}.
*
* <p>See {@link DataSource#addTransferListener(TransferListener)}.
*
* @param transferListener The listener that will be used.
* @return This factory.
*/
public
Factory
setTransferListener
(
@Nullable
TransferListener
transferListener
)
{
this
.
transferListener
=
transferListener
;
return
this
;
}
@Override
public
DefaultDataSource
createDataSource
()
{
DefaultDataSource
dataSource
=
new
DefaultDataSource
(
context
,
baseDataSourceFactory
.
createDataSource
());
if
(
transferListener
!=
null
)
{
dataSource
.
addTransferListener
(
transferListener
);
}
return
dataSource
;
}
}
private
static
final
String
TAG
=
"DefaultDataSource"
;
private
static
final
String
SCHEME_ASSET
=
"asset"
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultDataSourceFactory.java
View file @
7e8ba031
...
...
@@ -19,10 +19,8 @@ import android.content.Context;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.upstream.DataSource.Factory
;
/**
* A {@link Factory} that produces {@link DefaultDataSource} instances that delegate to {@link
* DefaultHttpDataSource}s for non-file/asset/content URIs.
*/
/** @deprecated Use {@link DefaultDataSource.Factory} instead. */
@Deprecated
public
final
class
DefaultDataSourceFactory
implements
Factory
{
private
final
Context
context
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/PriorityDataSource.java
View file @
7e8ba031
...
...
@@ -38,6 +38,37 @@ import java.util.Map;
*/
public
final
class
PriorityDataSource
implements
DataSource
{
/** {@link DataSource.Factory} for {@link PriorityDataSource} instances. */
public
static
final
class
Factory
implements
DataSource
.
Factory
{
private
final
DataSource
.
Factory
upstreamFactory
;
private
final
PriorityTaskManager
priorityTaskManager
;
private
final
int
priority
;
/**
* Creates an instance.
*
* @param upstreamFactory A {@link DataSource.Factory} that provides upstream {@link DataSource
* DataSources} for {@link PriorityDataSource} instances created by the factory.
* @param priorityTaskManager The {@link PriorityTaskManager} to which tasks using {@link
* PriorityDataSource} instances created by this factory will be registered.
* @param priority The priority of the tasks using {@link PriorityDataSource} instances created
* by this factory.
*/
public
Factory
(
DataSource
.
Factory
upstreamFactory
,
PriorityTaskManager
priorityTaskManager
,
int
priority
)
{
this
.
upstreamFactory
=
upstreamFactory
;
this
.
priorityTaskManager
=
priorityTaskManager
;
this
.
priority
=
priority
;
}
@Override
public
PriorityDataSource
createDataSource
()
{
return
new
PriorityDataSource
(
upstreamFactory
.
createDataSource
(),
priorityTaskManager
,
priority
);
}
}
private
final
DataSource
upstream
;
private
final
PriorityTaskManager
priorityTaskManager
;
private
final
int
priority
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/PriorityDataSourceFactory.java
View file @
7e8ba031
...
...
@@ -18,7 +18,8 @@ package com.google.android.exoplayer2.upstream;
import
com.google.android.exoplayer2.upstream.DataSource.Factory
;
import
com.google.android.exoplayer2.util.PriorityTaskManager
;
/** A {@link DataSource.Factory} that produces {@link PriorityDataSource} instances. */
/** @deprecated Use {@link PriorityDataSource.Factory}. */
@Deprecated
public
final
class
PriorityDataSourceFactory
implements
Factory
{
private
final
Factory
upstreamFactory
;
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/amr/AmrExtractorSeekTest.java
View file @
7e8ba031
...
...
@@ -25,7 +25,6 @@ import com.google.android.exoplayer2.testutil.FakeExtractorOutput;
import
com.google.android.exoplayer2.testutil.FakeTrackOutput
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Random
;
...
...
@@ -51,7 +50,7 @@ public final class AmrExtractorSeekTest {
@Before
public
void
setUp
()
{
dataSource
=
new
DefaultDataSourceFactory
(
ApplicationProvider
.
getApplicationContext
())
new
DefaultDataSource
.
Factory
(
ApplicationProvider
.
getApplicationContext
())
.
createDataSource
();
}
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/flac/FlacExtractorSeekTest.java
View file @
7e8ba031
...
...
@@ -26,7 +26,6 @@ import com.google.android.exoplayer2.testutil.FakeExtractorOutput;
import
com.google.android.exoplayer2.testutil.FakeTrackOutput
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
import
com.google.android.exoplayer2.util.Util
;
import
java.io.IOException
;
import
java.util.List
;
...
...
@@ -43,10 +42,10 @@ public class FlacExtractorSeekTest {
"media/flac/bear_no_seek_table_no_num_samples.flac"
;
private
static
final
int
DURATION_US
=
2_741_000
;
private
FlacExtractor
extractor
=
new
FlacExtractor
();
private
FakeExtractorOutput
extractorOutput
=
new
FakeExtractorOutput
();
private
DefaultDataSource
dataSource
=
new
DefaultDataSourceFactory
(
ApplicationProvider
.
getApplicationContext
()).
createDataSource
();
private
final
FlacExtractor
extractor
=
new
FlacExtractor
();
private
final
FakeExtractorOutput
extractorOutput
=
new
FakeExtractorOutput
();
private
final
DefaultDataSource
dataSource
=
new
DefaultDataSource
.
Factory
(
ApplicationProvider
.
getApplicationContext
()).
createDataSource
();
@Test
public
void
flacExtractorReads_seekTable_returnSeekableSeekMap
()
throws
IOException
{
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/flv/FlvExtractorSeekTest.java
View file @
7e8ba031
...
...
@@ -27,7 +27,6 @@ import com.google.android.exoplayer2.testutil.FakeExtractorOutput;
import
com.google.android.exoplayer2.testutil.FakeTrackOutput
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
import
com.google.android.exoplayer2.util.Util
;
import
java.io.IOException
;
import
java.util.List
;
...
...
@@ -53,7 +52,7 @@ public class FlvExtractorSeekTest {
extractor
=
new
FlvExtractor
();
extractorOutput
=
new
FakeExtractorOutput
();
dataSource
=
new
DefaultDataSourceFactory
(
ApplicationProvider
.
getApplicationContext
())
new
DefaultDataSource
.
Factory
(
ApplicationProvider
.
getApplicationContext
())
.
createDataSource
();
}
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp3/ConstantBitrateSeekerTest.java
View file @
7e8ba031
...
...
@@ -26,7 +26,6 @@ import com.google.android.exoplayer2.testutil.FakeExtractorOutput;
import
com.google.android.exoplayer2.testutil.FakeTrackOutput
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
import
com.google.android.exoplayer2.util.Util
;
import
java.io.IOException
;
import
java.util.Arrays
;
...
...
@@ -52,7 +51,7 @@ public class ConstantBitrateSeekerTest {
extractor
=
new
Mp3Extractor
();
extractorOutput
=
new
FakeExtractorOutput
();
dataSource
=
new
DefaultDataSourceFactory
(
ApplicationProvider
.
getApplicationContext
())
new
DefaultDataSource
.
Factory
(
ApplicationProvider
.
getApplicationContext
())
.
createDataSource
();
}
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/mp3/IndexSeekerTest.java
View file @
7e8ba031
...
...
@@ -28,7 +28,6 @@ import com.google.android.exoplayer2.testutil.FakeExtractorOutput;
import
com.google.android.exoplayer2.testutil.FakeTrackOutput
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
import
com.google.android.exoplayer2.util.Util
;
import
java.io.IOException
;
import
java.util.List
;
...
...
@@ -52,7 +51,7 @@ public class IndexSeekerTest {
extractor
=
new
Mp3Extractor
(
FLAG_ENABLE_INDEX_SEEKING
);
extractorOutput
=
new
FakeExtractorOutput
();
dataSource
=
new
DefaultDataSourceFactory
(
ApplicationProvider
.
getApplicationContext
())
new
DefaultDataSource
.
Factory
(
ApplicationProvider
.
getApplicationContext
())
.
createDataSource
();
}
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/AdtsExtractorSeekTest.java
View file @
7e8ba031
...
...
@@ -25,7 +25,6 @@ import com.google.android.exoplayer2.testutil.FakeExtractorOutput;
import
com.google.android.exoplayer2.testutil.FakeTrackOutput
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.Random
;
...
...
@@ -49,7 +48,7 @@ public final class AdtsExtractorSeekTest {
@Before
public
void
setUp
()
{
dataSource
=
new
DefaultDataSourceFactory
(
ApplicationProvider
.
getApplicationContext
())
new
DefaultDataSource
.
Factory
(
ApplicationProvider
.
getApplicationContext
())
.
createDataSource
();
}
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/PsExtractorSeekTest.java
View file @
7e8ba031
...
...
@@ -33,7 +33,6 @@ import com.google.android.exoplayer2.testutil.FakeTrackOutput;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.upstream.DataSpec
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
import
com.google.android.exoplayer2.util.Util
;
import
java.io.IOException
;
import
java.util.Arrays
;
...
...
@@ -68,7 +67,7 @@ public final class PsExtractorSeekTest {
expectedTrackOutput
=
expectedOutput
.
trackOutputs
.
get
(
VIDEO_TRACK_ID
);
dataSource
=
new
DefaultDataSourceFactory
(
ApplicationProvider
.
getApplicationContext
())
new
DefaultDataSource
.
Factory
(
ApplicationProvider
.
getApplicationContext
())
.
createDataSource
();
totalInputLength
=
readInputLength
();
}
...
...
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/ts/TsExtractorSeekTest.java
View file @
7e8ba031
...
...
@@ -28,7 +28,6 @@ import com.google.android.exoplayer2.testutil.FakeExtractorOutput;
import
com.google.android.exoplayer2.testutil.FakeTrackOutput
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
;
import
com.google.android.exoplayer2.util.Util
;
import
java.io.IOException
;
import
java.util.Arrays
;
...
...
@@ -62,7 +61,7 @@ public final class TsExtractorSeekTest {
.
get
(
AUDIO_TRACK_ID
);
dataSource
=
new
DefaultDataSourceFactory
(
ApplicationProvider
.
getApplicationContext
())
new
DefaultDataSource
.
Factory
(
ApplicationProvider
.
getApplicationContext
())
.
createDataSource
();
}
...
...
playbacktests/src/androidTest/java/com/google/android/exoplayer2/playbacktests/gts/DashTestRunner.java
View file @
7e8ba031
...
...
@@ -51,8 +51,8 @@ import com.google.android.exoplayer2.trackselection.ExoTrackSelection;
import
com.google.android.exoplayer2.trackselection.MappingTrackSelector
;
import
com.google.android.exoplayer2.trackselection.RandomTrackSelection
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultHttpDataSource
Factory
;
import
com.google.android.exoplayer2.upstream.DefaultDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultHttpDataSource
;
import
com.google.android.exoplayer2.upstream.DefaultLoadErrorHandlingPolicy
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Log
;
...
...
@@ -286,7 +286,7 @@ import java.util.List;
return
DrmSessionManager
.
DRM_UNSUPPORTED
;
}
MediaDrmCallback
drmCallback
=
new
HttpMediaDrmCallback
(
widevineLicenseUrl
,
new
DefaultHttpDataSourceFactory
());
new
HttpMediaDrmCallback
(
widevineLicenseUrl
,
new
DefaultHttpDataSource
.
Factory
());
DefaultDrmSessionManager
drmSessionManager
=
new
DefaultDrmSessionManager
.
Builder
()
.
setUuidAndExoMediaDrmProvider
(
...
...
@@ -327,7 +327,7 @@ import java.util.List;
DataSource
.
Factory
dataSourceFactory
=
this
.
dataSourceFactory
!=
null
?
this
.
dataSourceFactory
:
new
DefaultDataSourceFactory
(
host
);
:
new
DefaultDataSource
.
Factory
(
host
);
return
new
DashMediaSource
.
Factory
(
dataSourceFactory
)
.
setDrmSessionManager
(
drmSessionManager
)
.
setLoadErrorHandlingPolicy
(
new
DefaultLoadErrorHandlingPolicy
(
MIN_LOADABLE_RETRY_COUNT
))
...
...
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