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
9f9e432d
authored
May 22, 2015
by
ojw28
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #487 from google/dev
dev -> dev-webm-vp9-opus
parents
c42b265e
ac54b4f6
Show whitespace changes
Inline
Side-by-side
Showing
66 changed files
with
262 additions
and
169 deletions
demo/src/main/.settings/org.eclipse.jdt.core.prefs
demo/src/main/java/com/google/android/exoplayer/demo/SmoothStreamingTestMediaDrmCallback.java
demo/src/main/java/com/google/android/exoplayer/demo/player/DashRendererBuilder.java
demo/src/main/java/com/google/android/exoplayer/demo/player/DemoPlayer.java
demo/src/main/java/com/google/android/exoplayer/demo/player/HlsRendererBuilder.java
demo/src/main/java/com/google/android/exoplayer/demo/player/SmoothStreamingRendererBuilder.java
library/build.gradle
library/src/main/.settings/org.eclipse.jdt.core.prefs
library/src/main/java/com/google/android/exoplayer/C.java
library/src/main/java/com/google/android/exoplayer/DefaultLoadControl.java
library/src/main/java/com/google/android/exoplayer/ExoPlayerImpl.java
library/src/main/java/com/google/android/exoplayer/ExoPlayerImplInternal.java
library/src/main/java/com/google/android/exoplayer/MediaCodecTrackRenderer.java
library/src/main/java/com/google/android/exoplayer/MediaCodecUtil.java
library/src/main/java/com/google/android/exoplayer/MediaFormat.java
library/src/main/java/com/google/android/exoplayer/chunk/ChunkSampleSource.java
library/src/main/java/com/google/android/exoplayer/chunk/VideoFormatSelectorUtil.java
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java
library/src/main/java/com/google/android/exoplayer/dash/mpd/UtcTimingElementResolver.java
library/src/main/java/com/google/android/exoplayer/drm/DrmInitData.java
library/src/main/java/com/google/android/exoplayer/drm/StreamingDrmSessionManager.java
library/src/main/java/com/google/android/exoplayer/extractor/ExtractorSampleSource.java
library/src/main/java/com/google/android/exoplayer/extractor/RollingSampleBuffer.java
library/src/main/java/com/google/android/exoplayer/extractor/mp4/Atom.java
library/src/main/java/com/google/android/exoplayer/extractor/mp4/AtomParsers.java
library/src/main/java/com/google/android/exoplayer/extractor/mp4/FragmentedMp4Extractor.java
library/src/main/java/com/google/android/exoplayer/extractor/mp4/Mp4Extractor.java
library/src/main/java/com/google/android/exoplayer/extractor/ts/H264Reader.java
library/src/main/java/com/google/android/exoplayer/extractor/ts/TsExtractor.java
library/src/main/java/com/google/android/exoplayer/extractor/webm/DefaultEbmlReader.java
library/src/main/java/com/google/android/exoplayer/extractor/webm/WebmExtractor.java
library/src/main/java/com/google/android/exoplayer/hls/HlsChunkSource.java
library/src/main/java/com/google/android/exoplayer/hls/HlsExtractorWrapper.java
library/src/main/java/com/google/android/exoplayer/hls/HlsPlaylistParser.java
library/src/main/java/com/google/android/exoplayer/hls/HlsSampleSource.java
library/src/main/java/com/google/android/exoplayer/metadata/Id3Parser.java
library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingChunkSource.java
library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParser.java
library/src/main/java/com/google/android/exoplayer/text/SubtitleLayout.java
library/src/main/java/com/google/android/exoplayer/text/eia608/Eia608Parser.java
library/src/main/java/com/google/android/exoplayer/text/eia608/Eia608TrackRenderer.java
library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlNode.java
library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java
library/src/main/java/com/google/android/exoplayer/text/webvtt/WebvttParser.java
library/src/main/java/com/google/android/exoplayer/text/webvtt/WebvttSubtitle.java
library/src/main/java/com/google/android/exoplayer/upstream/DefaultAllocator.java
library/src/main/java/com/google/android/exoplayer/upstream/DefaultHttpDataSource.java
library/src/main/java/com/google/android/exoplayer/upstream/NetworkLock.java
library/src/main/java/com/google/android/exoplayer/upstream/cache/CacheSpan.java
library/src/main/java/com/google/android/exoplayer/upstream/cache/LeastRecentlyUsedCacheEvictor.java
library/src/main/java/com/google/android/exoplayer/upstream/cache/SimpleCache.java
library/src/main/java/com/google/android/exoplayer/util/CodecSpecificDataUtil.java
library/src/main/java/com/google/android/exoplayer/util/ManifestFetcher.java
library/src/main/java/com/google/android/exoplayer/util/SlidingPercentile.java
library/src/test/.classpath
library/src/test/.settings/org.eclipse.jdt.core.prefs
library/src/test/AndroidManifest.xml
library/src/test/java/com/google/android/exoplayer/MediaFormatTest.java
library/src/test/java/com/google/android/exoplayer/dash/DashChunkSourceTest.java
library/src/test/java/com/google/android/exoplayer/extractor/mp4/Mp4ExtractorTest.java
library/src/test/java/com/google/android/exoplayer/extractor/webm/DefaultEbmlReaderTest.java
library/src/test/java/com/google/android/exoplayer/testutil/FakeDataSource.java
library/src/test/java/com/google/android/exoplayer/text/webvtt/WebvttSubtitleTest.java
library/src/test/java/com/google/android/exoplayer/util/UtilTest.java
library/src/test/project.properties
demo/src/main/.settings/org.eclipse.jdt.core.prefs
View file @
9f9e432d
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.
6
org.eclipse.jdt.core.compiler.compliance=1.
6
org.eclipse.jdt.core.compiler.source=1.
6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.
7
org.eclipse.jdt.core.compiler.compliance=1.
7
org.eclipse.jdt.core.compiler.source=1.
7
demo/src/main/java/com/google/android/exoplayer/demo/SmoothStreamingTestMediaDrmCallback.java
View file @
9f9e432d
...
...
@@ -38,7 +38,7 @@ public class SmoothStreamingTestMediaDrmCallback implements MediaDrmCallback {
"http://playready.directtaps.net/pr/svc/rightsmanager.asmx"
;
private
static
final
Map
<
String
,
String
>
KEY_REQUEST_PROPERTIES
;
static
{
HashMap
<
String
,
String
>
keyRequestProperties
=
new
HashMap
<
String
,
String
>();
HashMap
<
String
,
String
>
keyRequestProperties
=
new
HashMap
<>();
keyRequestProperties
.
put
(
"Content-Type"
,
"text/xml"
);
keyRequestProperties
.
put
(
"SOAPAction"
,
"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense"
);
...
...
demo/src/main/java/com/google/android/exoplayer/demo/player/DashRendererBuilder.java
View file @
9f9e432d
...
...
@@ -131,8 +131,7 @@ public class DashRendererBuilder implements RendererBuilder,
this
.
callback
=
callback
;
MediaPresentationDescriptionParser
parser
=
new
MediaPresentationDescriptionParser
();
manifestDataSource
=
new
DefaultUriDataSource
(
context
,
userAgent
);
manifestFetcher
=
new
ManifestFetcher
<
MediaPresentationDescription
>(
url
,
manifestDataSource
,
parser
);
manifestFetcher
=
new
ManifestFetcher
<>(
url
,
manifestDataSource
,
parser
);
manifestFetcher
.
singleLoad
(
player
.
getMainHandler
().
getLooper
(),
this
);
}
...
...
@@ -247,13 +246,13 @@ public class DashRendererBuilder implements RendererBuilder,
}
// Build the audio chunk sources.
List
<
ChunkSource
>
audioChunkSourceList
=
new
ArrayList
<
ChunkSource
>();
List
<
String
>
audioTrackNameList
=
new
ArrayList
<
String
>();
List
<
ChunkSource
>
audioChunkSourceList
=
new
ArrayList
<>();
List
<
String
>
audioTrackNameList
=
new
ArrayList
<>();
if
(
audioAdaptationSet
!=
null
)
{
DataSource
audioDataSource
=
new
DefaultUriDataSource
(
context
,
bandwidthMeter
,
userAgent
);
FormatEvaluator
audioEvaluator
=
new
FormatEvaluator
.
FixedEvaluator
();
List
<
Representation
>
audioRepresentations
=
audioAdaptationSet
.
representations
;
List
<
String
>
codecs
=
new
ArrayList
<
String
>();
List
<
String
>
codecs
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
audioRepresentations
.
size
();
i
++)
{
Format
format
=
audioRepresentations
.
get
(
i
).
format
;
audioTrackNameList
.
add
(
format
.
id
+
" ("
+
format
.
numChannels
+
"ch, "
+
...
...
@@ -307,8 +306,8 @@ public class DashRendererBuilder implements RendererBuilder,
// Build the text chunk sources.
DataSource
textDataSource
=
new
DefaultUriDataSource
(
context
,
bandwidthMeter
,
userAgent
);
FormatEvaluator
textEvaluator
=
new
FormatEvaluator
.
FixedEvaluator
();
List
<
ChunkSource
>
textChunkSourceList
=
new
ArrayList
<
ChunkSource
>();
List
<
String
>
textTrackNameList
=
new
ArrayList
<
String
>();
List
<
ChunkSource
>
textChunkSourceList
=
new
ArrayList
<>();
List
<
String
>
textTrackNameList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
period
.
adaptationSets
.
size
();
i
++)
{
AdaptationSet
adaptationSet
=
period
.
adaptationSets
.
get
(
i
);
if
(
adaptationSet
.
type
==
AdaptationSet
.
TYPE_TEXT
)
{
...
...
demo/src/main/java/com/google/android/exoplayer/demo/player/DemoPlayer.java
View file @
9f9e432d
...
...
@@ -207,7 +207,7 @@ public class DemoPlayer implements ExoPlayer.Listener, ChunkSampleSource.EventLi
player
.
addListener
(
this
);
playerControl
=
new
PlayerControl
(
player
);
mainHandler
=
new
Handler
();
listeners
=
new
CopyOnWriteArrayList
<
Listener
>();
listeners
=
new
CopyOnWriteArrayList
<>();
lastReportedPlaybackState
=
STATE_IDLE
;
rendererBuildingState
=
RENDERER_BUILDING_STATE_IDLE
;
selectedTracks
=
new
int
[
RENDERER_COUNT
];
...
...
demo/src/main/java/com/google/android/exoplayer/demo/player/HlsRendererBuilder.java
View file @
9f9e432d
...
...
@@ -76,7 +76,7 @@ public class HlsRendererBuilder implements RendererBuilder, ManifestCallback<Hls
this
.
player
=
player
;
this
.
callback
=
callback
;
HlsPlaylistParser
parser
=
new
HlsPlaylistParser
();
ManifestFetcher
<
HlsPlaylist
>
playlistFetcher
=
new
ManifestFetcher
<
HlsPlaylist
>(
url
,
ManifestFetcher
<
HlsPlaylist
>
playlistFetcher
=
new
ManifestFetcher
<>(
url
,
new
DefaultUriDataSource
(
context
,
userAgent
),
parser
);
playlistFetcher
.
singleLoad
(
player
.
getMainHandler
().
getLooper
(),
this
);
}
...
...
@@ -113,7 +113,7 @@ public class HlsRendererBuilder implements RendererBuilder, ManifestCallback<Hls
MediaCodecAudioTrackRenderer
audioRenderer
=
new
MediaCodecAudioTrackRenderer
(
sampleSource
);
MetadataTrackRenderer
<
Map
<
String
,
Object
>>
id3Renderer
=
new
MetadataTrackRenderer
<
Map
<
String
,
Object
>
>(
sampleSource
,
new
Id3Parser
(),
new
MetadataTrackRenderer
<>(
sampleSource
,
new
Id3Parser
(),
player
.
getId3MetadataRenderer
(),
mainHandler
.
getLooper
());
Eia608TrackRenderer
closedCaptionRenderer
=
new
Eia608TrackRenderer
(
sampleSource
,
player
,
...
...
demo/src/main/java/com/google/android/exoplayer/demo/player/SmoothStreamingRendererBuilder.java
View file @
9f9e432d
...
...
@@ -97,7 +97,7 @@ public class SmoothStreamingRendererBuilder implements RendererBuilder,
manifestUrl
+=
"/Manifest"
;
}
SmoothStreamingManifestParser
parser
=
new
SmoothStreamingManifestParser
();
manifestFetcher
=
new
ManifestFetcher
<
SmoothStreamingManifest
>(
manifestUrl
,
manifestFetcher
=
new
ManifestFetcher
<>(
manifestUrl
,
new
DefaultHttpDataSource
(
userAgent
,
null
),
parser
);
manifestFetcher
.
singleLoad
(
player
.
getMainHandler
().
getLooper
(),
this
);
}
...
...
library/build.gradle
View file @
9f9e432d
...
...
@@ -38,9 +38,19 @@ android {
lintOptions
{
abortOnError
false
}
sourceSets
{
androidTest
{
assets
.
srcDirs
=
[
'src/test/assets'
]
java
.
srcDirs
=
[
'src/test/java'
]
}
}
}
dependencies
{
androidTestCompile
'com.google.dexmaker:dexmaker:1.2'
androidTestCompile
'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestCompile
'org.mockito:mockito-core:1.9.5'
}
android
.
libraryVariants
.
all
{
variant
->
...
...
library/src/main/.settings/org.eclipse.jdt.core.prefs
View file @
9f9e432d
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.
6
org.eclipse.jdt.core.compiler.compliance=1.
6
org.eclipse.jdt.core.compiler.source=1.
6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.
7
org.eclipse.jdt.core.compiler.compliance=1.
7
org.eclipse.jdt.core.compiler.source=1.
7
library/src/main/java/com/google/android/exoplayer/C.java
View file @
9f9e432d
...
...
@@ -84,6 +84,22 @@ public final class C {
*/
public
static
final
int
RESULT_END_OF_INPUT
=
-
1
;
/**
* A prefix for custom ExoPlayer WebVTT headers.
*
* @hide
*/
public
static
final
String
WEBVTT_EXO_HEADER
=
"EXO-HEADER"
;
/**
* An element of a custom ExoPlayer WebVTT header. An {@code WEBVTT_OFFSET + value} element can
* be added to a custom ExoPlayer WebVTT header to specify an offset time (in microseconds) that
* should be subtracted from the embedded MPEGTS value.
*
* @hide
*/
public
static
final
String
WEBVTT_EXO_HEADER_OFFSET
=
"OFFSET:"
;
private
C
()
{}
}
library/src/main/java/com/google/android/exoplayer/DefaultLoadControl.java
View file @
9f9e432d
...
...
@@ -127,8 +127,8 @@ public class DefaultLoadControl implements LoadControl {
this
.
allocator
=
allocator
;
this
.
eventHandler
=
eventHandler
;
this
.
eventListener
=
eventListener
;
this
.
loaders
=
new
ArrayList
<
Object
>();
this
.
loaderStates
=
new
HashMap
<
Object
,
LoaderState
>();
this
.
loaders
=
new
ArrayList
<>();
this
.
loaderStates
=
new
HashMap
<>();
this
.
lowWatermarkUs
=
lowWatermarkMs
*
1000L
;
this
.
highWatermarkUs
=
highWatermarkMs
*
1000L
;
this
.
lowBufferLoad
=
lowBufferLoad
;
...
...
library/src/main/java/com/google/android/exoplayer/ExoPlayerImpl.java
View file @
9f9e432d
...
...
@@ -55,7 +55,7 @@ import java.util.concurrent.CopyOnWriteArraySet;
Log
.
i
(
TAG
,
"Init "
+
ExoPlayerLibraryInfo
.
VERSION
);
this
.
playWhenReady
=
false
;
this
.
playbackState
=
STATE_IDLE
;
this
.
listeners
=
new
CopyOnWriteArraySet
<
Listener
>();
this
.
listeners
=
new
CopyOnWriteArraySet
<>();
this
.
rendererEnabledFlags
=
new
boolean
[
rendererCount
];
for
(
int
i
=
0
;
i
<
rendererEnabledFlags
.
length
;
i
++)
{
rendererEnabledFlags
[
i
]
=
true
;
...
...
library/src/main/java/com/google/android/exoplayer/ExoPlayerImplInternal.java
View file @
9f9e432d
...
...
@@ -99,7 +99,7 @@ import java.util.List;
this
.
bufferedPositionUs
=
TrackRenderer
.
UNKNOWN_TIME_US
;
mediaClock
=
new
MediaClock
();
enabledRenderers
=
new
ArrayList
<
TrackRenderer
>(
rendererEnabledFlags
.
length
);
enabledRenderers
=
new
ArrayList
<>(
rendererEnabledFlags
.
length
);
// Note: The documentation for Process.THREAD_PRIORITY_AUDIO that states "Applications can
// not normally change to this priority" is incorrect.
internalPlaybackThread
=
new
PriorityHandlerThread
(
getClass
().
getSimpleName
()
+
":Handler"
,
...
...
library/src/main/java/com/google/android/exoplayer/MediaCodecTrackRenderer.java
View file @
9f9e432d
...
...
@@ -236,7 +236,7 @@ public abstract class MediaCodecTrackRenderer extends TrackRenderer {
codecCounters
=
new
CodecCounters
();
sampleHolder
=
new
SampleHolder
(
SampleHolder
.
BUFFER_REPLACEMENT_MODE_DISABLED
);
formatHolder
=
new
MediaFormatHolder
();
decodeOnlyPresentationTimestamps
=
new
ArrayList
<
Long
>();
decodeOnlyPresentationTimestamps
=
new
ArrayList
<>();
outputBufferInfo
=
new
MediaCodec
.
BufferInfo
();
codecReconfigurationState
=
RECONFIGURATION_STATE_NONE
;
codecReinitializationState
=
REINITIALIZATION_STATE_NONE
;
...
...
library/src/main/java/com/google/android/exoplayer/MediaCodecUtil.java
View file @
9f9e432d
...
...
@@ -52,8 +52,7 @@ public class MediaCodecUtil {
private
static
final
String
TAG
=
"MediaCodecUtil"
;
private
static
final
HashMap
<
CodecKey
,
Pair
<
String
,
CodecCapabilities
>>
codecs
=
new
HashMap
<
CodecKey
,
Pair
<
String
,
CodecCapabilities
>>();
private
static
final
HashMap
<
CodecKey
,
Pair
<
String
,
CodecCapabilities
>>
codecs
=
new
HashMap
<>();
/**
* Get information about the decoder that will be used for a given mime type.
...
...
library/src/main/java/com/google/android/exoplayer/MediaFormat.java
View file @
9f9e432d
...
...
@@ -121,7 +121,7 @@ public class MediaFormat {
channelCount
=
getOptionalIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_CHANNEL_COUNT
);
sampleRate
=
getOptionalIntegerV16
(
format
,
android
.
media
.
MediaFormat
.
KEY_SAMPLE_RATE
);
pixelWidthHeightRatio
=
getOptionalFloatV16
(
format
,
KEY_PIXEL_WIDTH_HEIGHT_RATIO
);
initializationData
=
new
ArrayList
<
byte
[]
>();
initializationData
=
new
ArrayList
<>();
for
(
int
i
=
0
;
format
.
containsKey
(
"csd-"
+
i
);
i
++)
{
ByteBuffer
buffer
=
format
.
getByteBuffer
(
"csd-"
+
i
);
byte
[]
data
=
new
byte
[
buffer
.
limit
()];
...
...
library/src/main/java/com/google/android/exoplayer/chunk/ChunkSampleSource.java
View file @
9f9e432d
...
...
@@ -113,7 +113,7 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
this
.
eventSourceId
=
eventSourceId
;
this
.
minLoadableRetryCount
=
minLoadableRetryCount
;
currentLoadableHolder
=
new
ChunkOperationHolder
();
mediaChunks
=
new
LinkedList
<
BaseMediaChunk
>();
mediaChunks
=
new
LinkedList
<>();
readOnlyMediaChunks
=
Collections
.
unmodifiableList
(
mediaChunks
);
sampleQueue
=
new
DefaultTrackOutput
(
loadControl
.
getAllocator
());
state
=
STATE_UNPREPARED
;
...
...
library/src/main/java/com/google/android/exoplayer/chunk/VideoFormatSelectorUtil.java
View file @
9f9e432d
...
...
@@ -94,7 +94,7 @@ public final class VideoFormatSelectorUtil {
String
[]
allowedContainerMimeTypes
,
boolean
filterHdFormats
,
boolean
orientationMayChange
,
int
viewportWidth
,
int
viewportHeight
)
throws
DecoderQueryException
{
int
maxVideoPixelsToRetain
=
Integer
.
MAX_VALUE
;
ArrayList
<
Integer
>
selectedIndexList
=
new
ArrayList
<
Integer
>();
ArrayList
<
Integer
>
selectedIndexList
=
new
ArrayList
<>();
int
maxDecodableFrameSize
=
MediaCodecUtil
.
maxH264DecodableFrameSize
();
// First pass to filter out formats that individually fail to meet the selection criteria.
...
...
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
View file @
9f9e432d
...
...
@@ -16,6 +16,7 @@
package
com
.
google
.
android
.
exoplayer
.
dash
;
import
com.google.android.exoplayer.BehindLiveWindowException
;
import
com.google.android.exoplayer.C
;
import
com.google.android.exoplayer.MediaFormat
;
import
com.google.android.exoplayer.TimeRange
;
import
com.google.android.exoplayer.TrackInfo
;
...
...
@@ -43,7 +44,6 @@ import com.google.android.exoplayer.extractor.ChunkIndex;
import
com.google.android.exoplayer.extractor.Extractor
;
import
com.google.android.exoplayer.extractor.mp4.FragmentedMp4Extractor
;
import
com.google.android.exoplayer.extractor.webm.WebmExtractor
;
import
com.google.android.exoplayer.text.webvtt.WebvttParser
;
import
com.google.android.exoplayer.upstream.DataSource
;
import
com.google.android.exoplayer.upstream.DataSpec
;
import
com.google.android.exoplayer.util.Clock
;
...
...
@@ -101,7 +101,7 @@ public class DashChunkSource implements ChunkSource {
private
final
TrackInfo
trackInfo
;
private
final
DataSource
dataSource
;
private
final
FormatEvaluator
e
valuator
;
private
final
FormatEvaluator
formatE
valuator
;
private
final
Evaluation
evaluation
;
private
final
Clock
systemClock
;
private
final
StringBuilder
headerBuilder
;
...
...
@@ -117,13 +117,14 @@ public class DashChunkSource implements ChunkSource {
private
final
int
adaptationSetIndex
;
private
final
int
[]
representationIndices
;
private
DrmInitData
drmInitData
;
private
MediaPresentationDescription
currentManifest
;
private
boolean
finishedCurrentManifest
;
private
DrmInitData
drmInitData
;
private
TimeRange
seekRange
;
private
long
[]
seekRangeValues
;
private
int
firstAvailableSegmentNum
;
private
int
lastAvailableSegmentNum
;
private
boolean
finishedCurrentManifest
;
private
boolean
lastChunkWasInitialization
;
private
IOException
fatalError
;
...
...
@@ -214,7 +215,7 @@ public class DashChunkSource implements ChunkSource {
this
.
adaptationSetIndex
=
adaptationSetIndex
;
this
.
representationIndices
=
representationIndices
;
this
.
dataSource
=
dataSource
;
this
.
e
valuator
=
formatEvaluator
;
this
.
formatE
valuator
=
formatEvaluator
;
this
.
systemClock
=
systemClock
;
this
.
liveEdgeLatencyUs
=
liveEdgeLatencyUs
;
this
.
elapsedRealtimeOffsetUs
=
elapsedRealtimeOffsetUs
;
...
...
@@ -232,7 +233,7 @@ public class DashChunkSource implements ChunkSource {
this
.
trackInfo
=
new
TrackInfo
(
representations
[
0
].
format
.
mimeType
,
periodDurationUs
);
this
.
formats
=
new
Format
[
representations
.
length
];
this
.
representationHolders
=
new
HashMap
<
String
,
RepresentationHolder
>();
this
.
representationHolders
=
new
HashMap
<>();
int
maxWidth
=
0
;
int
maxHeight
=
0
;
for
(
int
i
=
0
;
i
<
representations
.
length
;
i
++)
{
...
...
@@ -268,7 +269,8 @@ public class DashChunkSource implements ChunkSource {
@Override
public
void
enable
()
{
evaluator
.
enable
();
fatalError
=
null
;
formatEvaluator
.
enable
();
if
(
manifestFetcher
!=
null
)
{
manifestFetcher
.
enable
();
}
...
...
@@ -286,7 +288,7 @@ public class DashChunkSource implements ChunkSource {
@Override
public
void
disable
(
List
<?
extends
MediaChunk
>
queue
)
{
e
valuator
.
disable
();
formatE
valuator
.
disable
();
if
(
manifestFetcher
!=
null
)
{
manifestFetcher
.
disable
();
}
...
...
@@ -347,7 +349,7 @@ public class DashChunkSource implements ChunkSource {
evaluation
.
queueSize
=
queue
.
size
();
if
(
evaluation
.
format
==
null
||
!
lastChunkWasInitialization
)
{
e
valuator
.
evaluate
(
queue
,
playbackPositionUs
,
formats
,
evaluation
);
formatE
valuator
.
evaluate
(
queue
,
playbackPositionUs
,
formats
,
evaluation
);
}
Format
selectedFormat
=
evaluation
.
format
;
out
.
queueSize
=
evaluation
.
queueSize
;
...
...
@@ -362,6 +364,9 @@ public class DashChunkSource implements ChunkSource {
return
;
}
// In all cases where we return before instantiating a new chunk, we want out.chunk to be null.
out
.
chunk
=
null
;
RepresentationHolder
representationHolder
=
representationHolders
.
get
(
selectedFormat
.
id
);
Representation
selectedRepresentation
=
representationHolder
.
representation
;
DashSegmentIndex
segmentIndex
=
representationHolder
.
segmentIndex
;
...
...
@@ -426,7 +431,7 @@ public class DashChunkSource implements ChunkSource {
}
if
(
segmentNum
==
-
1
)
{
out
.
chunk
=
null
;
// We've reached the end of the stream.
return
;
}
...
...
@@ -566,8 +571,9 @@ public class DashChunkSource implements ChunkSource {
if
(
representationHolder
.
vttHeaderOffsetUs
!=
presentationTimeOffsetUs
)
{
// Update the VTT header.
headerBuilder
.
setLength
(
0
);
headerBuilder
.
append
(
WebvttParser
.
EXO_HEADER
).
append
(
"="
)
.
append
(
WebvttParser
.
OFFSET
).
append
(
presentationTimeOffsetUs
).
append
(
"\n"
);
headerBuilder
.
append
(
C
.
WEBVTT_EXO_HEADER
).
append
(
"="
)
.
append
(
C
.
WEBVTT_EXO_HEADER_OFFSET
).
append
(
presentationTimeOffsetUs
)
.
append
(
"\n"
);
representationHolder
.
vttHeader
=
headerBuilder
.
toString
().
getBytes
();
representationHolder
.
vttHeaderOffsetUs
=
presentationTimeOffsetUs
;
}
...
...
library/src/main/java/com/google/android/exoplayer/dash/mpd/MediaPresentationDescriptionParser.java
View file @
9f9e432d
...
...
@@ -112,7 +112,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
:
-
1
;
UtcTimingElement
utcTiming
=
null
;
List
<
Period
>
periods
=
new
ArrayList
<
Period
>();
List
<
Period
>
periods
=
new
ArrayList
<>();
do
{
xpp
.
next
();
if
(
isStartTag
(
xpp
,
"BaseURL"
))
{
...
...
@@ -152,7 +152,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
long
startMs
=
parseDuration
(
xpp
,
"start"
,
0
);
long
durationMs
=
parseDuration
(
xpp
,
"duration"
,
mpdDurationMs
);
SegmentBase
segmentBase
=
null
;
List
<
AdaptationSet
>
adaptationSets
=
new
ArrayList
<
AdaptationSet
>();
List
<
AdaptationSet
>
adaptationSets
=
new
ArrayList
<>();
do
{
xpp
.
next
();
if
(
isStartTag
(
xpp
,
"BaseURL"
))
{
...
...
@@ -188,7 +188,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
int
id
=
-
1
;
ContentProtectionsBuilder
contentProtectionsBuilder
=
new
ContentProtectionsBuilder
();
List
<
Representation
>
representations
=
new
ArrayList
<
Representation
>();
List
<
Representation
>
representations
=
new
ArrayList
<>();
do
{
xpp
.
next
();
if
(
isStartTag
(
xpp
,
"BaseURL"
))
{
...
...
@@ -432,7 +432,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
timeline
=
parseSegmentTimeline
(
xpp
);
}
else
if
(
isStartTag
(
xpp
,
"SegmentURL"
))
{
if
(
segments
==
null
)
{
segments
=
new
ArrayList
<
RangedUri
>();
segments
=
new
ArrayList
<>();
}
segments
.
add
(
parseSegmentUrl
(
xpp
,
baseUrl
));
}
...
...
@@ -499,7 +499,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
protected
List
<
SegmentTimelineElement
>
parseSegmentTimeline
(
XmlPullParser
xpp
)
throws
XmlPullParserException
,
IOException
{
List
<
SegmentTimelineElement
>
segmentTimeline
=
new
ArrayList
<
SegmentTimelineElement
>();
List
<
SegmentTimelineElement
>
segmentTimeline
=
new
ArrayList
<>();
long
elapsedTime
=
0
;
do
{
xpp
.
next
();
...
...
@@ -642,7 +642,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
*/
public
void
addAdaptationSetProtection
(
ContentProtection
contentProtection
)
{
if
(
adaptationSetProtections
==
null
)
{
adaptationSetProtections
=
new
ArrayList
<
ContentProtection
>();
adaptationSetProtections
=
new
ArrayList
<>();
}
maybeAddContentProtection
(
adaptationSetProtections
,
contentProtection
);
}
...
...
@@ -654,7 +654,7 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
*/
public
void
addRepresentationProtection
(
ContentProtection
contentProtection
)
{
if
(
currentRepresentationProtections
==
null
)
{
currentRepresentationProtections
=
new
ArrayList
<
ContentProtection
>();
currentRepresentationProtections
=
new
ArrayList
<>();
}
maybeAddContentProtection
(
currentRepresentationProtections
,
contentProtection
);
}
...
...
library/src/main/java/com/google/android/exoplayer/dash/mpd/UtcTimingElementResolver.java
View file @
9f9e432d
...
...
@@ -124,7 +124,7 @@ public class UtcTimingElementResolver implements Loader.Callback {
private
void
resolveHttp
(
UriLoadable
.
Parser
<
Long
>
parser
)
{
singleUseLoader
=
new
Loader
(
"utctiming"
);
singleUseLoadable
=
new
UriLoadable
<
Long
>(
timingElement
.
value
,
uriDataSource
,
parser
);
singleUseLoadable
=
new
UriLoadable
<>(
timingElement
.
value
,
uriDataSource
,
parser
);
singleUseLoader
.
startLoading
(
singleUseLoadable
,
this
);
}
...
...
library/src/main/java/com/google/android/exoplayer/drm/DrmInitData.java
View file @
9f9e432d
...
...
@@ -52,7 +52,7 @@ public abstract class DrmInitData {
public
Mapped
(
String
mimeType
)
{
super
(
mimeType
);
schemeData
=
new
HashMap
<
UUID
,
byte
[]
>();
schemeData
=
new
HashMap
<>();
}
@Override
...
...
library/src/main/java/com/google/android/exoplayer/drm/StreamingDrmSessionManager.java
View file @
9f9e432d
...
...
@@ -139,7 +139,7 @@ public class StreamingDrmSessionManager implements DrmSessionManager {
EventListener
eventListener
)
throws
UnsupportedSchemeException
{
HashMap
<
String
,
String
>
optionalKeyRequestParameters
;
if
(!
TextUtils
.
isEmpty
(
customData
))
{
optionalKeyRequestParameters
=
new
HashMap
<
String
,
String
>();
optionalKeyRequestParameters
=
new
HashMap
<>();
optionalKeyRequestParameters
.
put
(
PLAYREADY_CUSTOM_DATA_KEY
,
customData
);
}
else
{
optionalKeyRequestParameters
=
null
;
...
...
library/src/main/java/com/google/android/exoplayer/extractor/ExtractorSampleSource.java
View file @
9f9e432d
...
...
@@ -130,7 +130,7 @@ public class ExtractorSampleSource implements SampleSource, ExtractorOutput, Loa
this
.
remainingReleaseCount
=
downstreamRendererCount
;
this
.
requestedBufferSize
=
requestedBufferSize
;
this
.
minLoadableRetryCount
=
minLoadableRetryCount
;
sampleQueues
=
new
SparseArray
<
InternalTrackOutput
>();
sampleQueues
=
new
SparseArray
<>();
allocator
=
new
DefaultAllocator
(
BUFFER_FRAGMENT_LENGTH
);
pendingResetPositionUs
=
NO_RESET_PENDING
;
frameAccurateSeeking
=
true
;
...
...
library/src/main/java/com/google/android/exoplayer/extractor/RollingSampleBuffer.java
View file @
9f9e432d
...
...
@@ -57,7 +57,7 @@ import java.util.concurrent.LinkedBlockingDeque;
this
.
allocator
=
allocator
;
allocationLength
=
allocator
.
getIndividualAllocationLength
();
infoQueue
=
new
InfoQueue
();
dataQueue
=
new
LinkedBlockingDeque
<
Allocation
>();
dataQueue
=
new
LinkedBlockingDeque
<>();
extrasHolder
=
new
SampleExtrasHolder
();
scratch
=
new
ParsableByteArray
(
INITIAL_SCRATCH_SIZE
);
lastAllocationOffset
=
allocationLength
;
...
...
library/src/main/java/com/google/android/exoplayer/extractor/mp4/Atom.java
View file @
9f9e432d
...
...
@@ -122,8 +122,8 @@ import java.util.List;
public
ContainerAtom
(
int
type
,
long
endByteOffset
)
{
super
(
type
);
leafChildren
=
new
ArrayList
<
LeafAtom
>();
containerChildren
=
new
ArrayList
<
ContainerAtom
>();
leafChildren
=
new
ArrayList
<>();
containerChildren
=
new
ArrayList
<>();
this
.
endByteOffset
=
endByteOffset
;
}
...
...
library/src/main/java/com/google/android/exoplayer/extractor/mp4/AtomParsers.java
View file @
9f9e432d
...
...
@@ -396,7 +396,7 @@ import java.util.List;
if
(
nalUnitLengthFieldLength
==
3
)
{
throw
new
IllegalStateException
();
}
List
<
byte
[]>
initializationData
=
new
ArrayList
<
byte
[]
>();
List
<
byte
[]>
initializationData
=
new
ArrayList
<>();
// TODO: We should try and parse these using CodecSpecificDataUtil.parseSpsNalUnit, and
// expose the AVC profile and level somewhere useful; Most likely in MediaFormat.
int
numSequenceParameterSets
=
parent
.
readUnsignedByte
()
&
0x1F
;
...
...
@@ -472,7 +472,7 @@ import java.util.List;
int
height
=
parent
.
readUnsignedShort
();
parent
.
skipBytes
(
50
);
List
<
byte
[]>
initializationData
=
new
ArrayList
<
byte
[]
>(
1
);
List
<
byte
[]>
initializationData
=
new
ArrayList
<>(
1
);
int
childPosition
=
parent
.
getPosition
();
while
(
childPosition
-
position
<
size
)
{
parent
.
setPosition
(
childPosition
);
...
...
library/src/main/java/com/google/android/exoplayer/extractor/mp4/FragmentedMp4Extractor.java
View file @
9f9e432d
...
...
@@ -110,7 +110,7 @@ public final class FragmentedMp4Extractor implements Extractor {
nalLength
=
new
ParsableByteArray
(
4
);
encryptionSignalByte
=
new
ParsableByteArray
(
1
);
extendedTypeScratch
=
new
byte
[
16
];
containerAtoms
=
new
Stack
<
ContainerAtom
>();
containerAtoms
=
new
Stack
<>();
fragmentRun
=
new
TrackFragment
();
parserState
=
STATE_READING_ATOM_HEADER
;
}
...
...
library/src/main/java/com/google/android/exoplayer/extractor/mp4/Mp4Extractor.java
View file @
9f9e432d
...
...
@@ -71,7 +71,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
public
Mp4Extractor
()
{
atomHeader
=
new
ParsableByteArray
(
Atom
.
LONG_HEADER_SIZE
);
containerAtoms
=
new
Stack
<
Atom
.
ContainerAtom
>();
containerAtoms
=
new
Stack
<>();
nalStartCode
=
new
ParsableByteArray
(
H264Util
.
NAL_START_CODE
);
nalLength
=
new
ParsableByteArray
(
4
);
parserState
=
STATE_READING_ATOM_HEADER
;
...
...
@@ -216,7 +216,7 @@ public final class Mp4Extractor implements Extractor, SeekMap {
/** Updates the stored track metadata to reflect the contents of the specified moov atom. */
private
void
processMoovAtom
(
ContainerAtom
moov
)
{
List
<
Mp4Track
>
tracks
=
new
ArrayList
<
Mp4Track
>();
List
<
Mp4Track
>
tracks
=
new
ArrayList
<>();
long
earliestSampleOffset
=
Long
.
MAX_VALUE
;
for
(
int
i
=
0
;
i
<
moov
.
containerChildren
.
size
();
i
++)
{
Atom
.
ContainerAtom
atom
=
moov
.
containerChildren
.
get
(
i
);
...
...
library/src/main/java/com/google/android/exoplayer/extractor/ts/H264Reader.java
View file @
9f9e432d
...
...
@@ -224,7 +224,7 @@ import java.util.List;
byte
[]
ppsData
=
new
byte
[
pps
.
nalLength
];
System
.
arraycopy
(
sps
.
nalData
,
0
,
spsData
,
0
,
sps
.
nalLength
);
System
.
arraycopy
(
pps
.
nalData
,
0
,
ppsData
,
0
,
pps
.
nalLength
);
List
<
byte
[]>
initializationData
=
new
ArrayList
<
byte
[]
>();
List
<
byte
[]>
initializationData
=
new
ArrayList
<>();
initializationData
.
add
(
spsData
);
initializationData
.
add
(
ppsData
);
...
...
library/src/main/java/com/google/android/exoplayer/extractor/ts/TsExtractor.java
View file @
9f9e432d
...
...
@@ -85,7 +85,7 @@ public final class TsExtractor implements Extractor, SeekMap {
tsPacketBuffer
=
new
ParsableByteArray
(
TS_PACKET_SIZE
);
streamTypes
=
new
SparseBooleanArray
();
allowedPassthroughStreamTypes
=
getPassthroughStreamTypes
(
audioCapabilities
);
tsPayloadReaders
=
new
SparseArray
<
TsPayloadReader
>();
tsPayloadReaders
=
new
SparseArray
<>();
tsPayloadReaders
.
put
(
TS_PAT_PID
,
new
PatReader
());
lastPts
=
Long
.
MIN_VALUE
;
}
...
...
library/src/main/java/com/google/android/exoplayer/extractor/webm/DefaultEbmlReader.java
View file @
9f9e432d
...
...
@@ -37,7 +37,7 @@ import java.util.Stack;
private
static
final
int
VALID_FLOAT64_ELEMENT_SIZE_BYTES
=
8
;
private
final
byte
[]
scratch
=
new
byte
[
8
];
private
final
Stack
<
MasterElement
>
masterElementsStack
=
new
Stack
<
MasterElement
>();
private
final
Stack
<
MasterElement
>
masterElementsStack
=
new
Stack
<>();
private
final
VarintReader
varintReader
=
new
VarintReader
();
private
EbmlReaderOutput
output
;
...
...
library/src/main/java/com/google/android/exoplayer/extractor/webm/WebmExtractor.java
View file @
9f9e432d
...
...
@@ -665,7 +665,7 @@ public final class WebmExtractor implements Extractor {
durationUs
,
audioTrackFormat
.
channelCount
,
audioTrackFormat
.
sampleRate
,
parseVorbisCodecPrivate
());
}
else
if
(
audioTrackFormat
!=
null
&&
CODEC_ID_OPUS
.
equals
(
audioTrackFormat
.
codecId
))
{
ArrayList
<
byte
[]>
opusInitializationData
=
new
ArrayList
<
byte
[]
>(
3
);
ArrayList
<
byte
[]>
opusInitializationData
=
new
ArrayList
<>(
3
);
opusInitializationData
.
add
(
audioTrackFormat
.
codecPrivate
);
opusInitializationData
.
add
(
ByteBuffer
.
allocate
(
Long
.
SIZE
).
putLong
(
audioTrackFormat
.
codecDelayNs
).
array
());
...
...
@@ -757,7 +757,7 @@ public final class WebmExtractor implements Extractor {
}
byte
[]
vorbisBooks
=
new
byte
[
codecPrivate
.
length
-
offset
];
System
.
arraycopy
(
codecPrivate
,
offset
,
vorbisBooks
,
0
,
codecPrivate
.
length
-
offset
);
ArrayList
<
byte
[]>
initializationData
=
new
ArrayList
<
byte
[]
>(
2
);
ArrayList
<
byte
[]>
initializationData
=
new
ArrayList
<>(
2
);
initializationData
.
add
(
vorbisInfo
);
initializationData
.
add
(
vorbisBooks
);
return
initializationData
;
...
...
library/src/main/java/com/google/android/exoplayer/hls/HlsChunkSource.java
View file @
9f9e432d
...
...
@@ -516,7 +516,7 @@ public class HlsChunkSource {
}
private
static
Format
[]
buildEnabledFormats
(
List
<
Variant
>
variants
,
int
[]
variantIndices
)
{
ArrayList
<
Variant
>
enabledVariants
=
new
ArrayList
<
Variant
>();
ArrayList
<
Variant
>
enabledVariants
=
new
ArrayList
<>();
if
(
variantIndices
!=
null
)
{
for
(
int
i
=
0
;
i
<
variantIndices
.
length
;
i
++)
{
enabledVariants
.
add
(
variants
.
get
(
variantIndices
[
i
]));
...
...
@@ -526,8 +526,8 @@ public class HlsChunkSource {
enabledVariants
.
addAll
(
variants
);
}
ArrayList
<
Variant
>
definiteVideoVariants
=
new
ArrayList
<
Variant
>();
ArrayList
<
Variant
>
definiteAudioOnlyVariants
=
new
ArrayList
<
Variant
>();
ArrayList
<
Variant
>
definiteVideoVariants
=
new
ArrayList
<>();
ArrayList
<
Variant
>
definiteAudioOnlyVariants
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
enabledVariants
.
size
();
i
++)
{
Variant
variant
=
enabledVariants
.
get
(
i
);
if
(
variant
.
format
.
height
>
0
||
variantHasExplicitCodecWithPrefix
(
variant
,
"avc"
))
{
...
...
library/src/main/java/com/google/android/exoplayer/hls/HlsExtractorWrapper.java
View file @
9f9e432d
...
...
@@ -60,7 +60,7 @@ public final class HlsExtractorWrapper implements ExtractorOutput {
this
.
startTimeUs
=
startTimeUs
;
this
.
extractor
=
extractor
;
this
.
shouldSpliceIn
=
shouldSpliceIn
;
sampleQueues
=
new
SparseArray
<
DefaultTrackOutput
>();
sampleQueues
=
new
SparseArray
<>();
}
/**
...
...
@@ -70,7 +70,7 @@ public final class HlsExtractorWrapper implements ExtractorOutput {
*/
public
void
init
(
Allocator
allocator
)
{
this
.
allocator
=
allocator
;
this
.
extractor
.
init
(
this
);
extractor
.
init
(
this
);
}
/**
...
...
library/src/main/java/com/google/android/exoplayer/hls/HlsPlaylistParser.java
View file @
9f9e432d
...
...
@@ -106,7 +106,7 @@ public final class HlsPlaylistParser implements UriLoadable.Parser<HlsPlaylist>
public
HlsPlaylist
parse
(
String
connectionUrl
,
InputStream
inputStream
)
throws
IOException
,
ParserException
{
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
));
Queue
<
String
>
extraLines
=
new
LinkedList
<
String
>();
Queue
<
String
>
extraLines
=
new
LinkedList
<>();
String
line
;
try
{
while
((
line
=
reader
.
readLine
())
!=
null
)
{
...
...
@@ -137,8 +137,8 @@ public final class HlsPlaylistParser implements UriLoadable.Parser<HlsPlaylist>
private
static
HlsMasterPlaylist
parseMasterPlaylist
(
LineIterator
iterator
,
String
baseUri
)
throws
IOException
{
ArrayList
<
Variant
>
variants
=
new
ArrayList
<
Variant
>();
ArrayList
<
Subtitle
>
subtitles
=
new
ArrayList
<
Subtitle
>();
ArrayList
<
Variant
>
variants
=
new
ArrayList
<>();
ArrayList
<
Subtitle
>
subtitles
=
new
ArrayList
<>();
int
bitrate
=
0
;
String
codecs
=
null
;
int
width
=
-
1
;
...
...
@@ -202,7 +202,7 @@ public final class HlsPlaylistParser implements UriLoadable.Parser<HlsPlaylist>
int
targetDurationSecs
=
0
;
int
version
=
1
;
// Default version == 1.
boolean
live
=
true
;
List
<
Segment
>
segments
=
new
ArrayList
<
Segment
>();
List
<
Segment
>
segments
=
new
ArrayList
<>();
double
segmentDurationSecs
=
0.0
;
boolean
segmentDiscontinuity
=
false
;
...
...
library/src/main/java/com/google/android/exoplayer/hls/HlsSampleSource.java
View file @
9f9e432d
...
...
@@ -120,7 +120,7 @@ public class HlsSampleSource implements SampleSource, Loader.Callback {
this
.
eventListener
=
eventListener
;
this
.
eventSourceId
=
eventSourceId
;
this
.
pendingResetPositionUs
=
NO_RESET_PENDING
;
extractors
=
new
LinkedList
<
HlsExtractorWrapper
>();
extractors
=
new
LinkedList
<>();
allocator
=
new
DefaultAllocator
(
BUFFER_FRAGMENT_LENGTH
);
}
...
...
library/src/main/java/com/google/android/exoplayer/metadata/Id3Parser.java
View file @
9f9e432d
...
...
@@ -42,7 +42,7 @@ public class Id3Parser implements MetadataParser<Map<String, Object>> {
@Override
public
Map
<
String
,
Object
>
parse
(
byte
[]
data
,
int
size
)
throws
UnsupportedEncodingException
,
ParserException
{
Map
<
String
,
Object
>
metadata
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
metadata
=
new
HashMap
<>();
ParsableByteArray
id3Data
=
new
ParsableByteArray
(
data
,
size
);
int
id3Size
=
parseId3Header
(
id3Data
);
...
...
library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingChunkSource.java
View file @
9f9e432d
...
...
@@ -59,14 +59,11 @@ public class SmoothStreamingChunkSource implements ChunkSource {
private
static
final
int
MINIMUM_MANIFEST_REFRESH_PERIOD_MS
=
5000
;
private
static
final
int
INITIALIZATION_VECTOR_SIZE
=
8
;
private
final
ManifestFetcher
<
SmoothStreamingManifest
>
manifestFetcher
;
private
final
int
streamElementIndex
;
private
final
TrackInfo
trackInfo
;
private
final
DataSource
dataSource
;
private
final
FormatEvaluator
formatEvaluator
;
private
final
Evaluation
evaluation
;
private
final
long
liveEdgeLatencyUs
;
private
final
int
maxWidth
;
private
final
int
maxHeight
;
...
...
@@ -75,6 +72,9 @@ public class SmoothStreamingChunkSource implements ChunkSource {
private
final
DrmInitData
drmInitData
;
private
final
Format
[]
formats
;
private
final
ManifestFetcher
<
SmoothStreamingManifest
>
manifestFetcher
;
private
final
int
streamElementIndex
;
private
SmoothStreamingManifest
currentManifest
;
private
int
currentManifestChunkOffset
;
private
boolean
finishedCurrentManifest
;
...
...
@@ -153,8 +153,8 @@ public class SmoothStreamingChunkSource implements ChunkSource {
int
trackCount
=
trackIndices
!=
null
?
trackIndices
.
length
:
streamElement
.
tracks
.
length
;
formats
=
new
Format
[
trackCount
];
extractorWrappers
=
new
SparseArray
<
ChunkExtractorWrapper
>();
mediaFormats
=
new
SparseArray
<
MediaFormat
>();
extractorWrappers
=
new
SparseArray
<>();
mediaFormats
=
new
SparseArray
<>();
int
maxWidth
=
0
;
int
maxHeight
=
0
;
for
(
int
i
=
0
;
i
<
trackCount
;
i
++)
{
...
...
@@ -174,8 +174,8 @@ public class SmoothStreamingChunkSource implements ChunkSource {
extractorWrappers
.
put
(
trackIndex
,
new
ChunkExtractorWrapper
(
extractor
));
mediaFormats
.
put
(
trackIndex
,
mediaFormat
);
}
this
.
maxHeight
=
maxHeight
;
this
.
maxWidth
=
maxWidth
;
this
.
maxHeight
=
maxHeight
;
Arrays
.
sort
(
formats
,
new
DecreasingBandwidthComparator
());
}
...
...
@@ -194,6 +194,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
@Override
public
void
enable
()
{
fatalError
=
null
;
formatEvaluator
.
enable
();
if
(
manifestFetcher
!=
null
)
{
manifestFetcher
.
enable
();
}
...
...
@@ -201,6 +202,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
@Override
public
void
disable
(
List
<?
extends
MediaChunk
>
queue
)
{
formatEvaluator
.
disable
();
if
(
manifestFetcher
!=
null
)
{
manifestFetcher
.
disable
();
}
...
...
@@ -248,14 +250,13 @@ public class SmoothStreamingChunkSource implements ChunkSource {
out
.
chunk
=
null
;
return
;
}
else
if
(
out
.
queueSize
==
queue
.
size
()
&&
out
.
chunk
!=
null
&&
out
.
chunk
.
format
.
equals
(
evaluation
.
f
ormat
))
{
&&
out
.
chunk
.
format
.
equals
(
selectedF
ormat
))
{
// We already have a chunk, and the evaluation hasn't changed either the format or the size
// of the queue.
Do nothing
.
// of the queue.
Leave unchanged
.
return
;
}
// In all cases where we return before instantiating a new chunk at the bottom of this method,
// we want out.chunk to be null.
// In all cases where we return before instantiating a new chunk, we want out.chunk to be null.
out
.
chunk
=
null
;
StreamElement
streamElement
=
getElement
(
currentManifest
);
...
...
@@ -290,7 +291,9 @@ public class SmoothStreamingChunkSource implements ChunkSource {
// but continue to return the final chunk.
finishedCurrentManifest
=
true
;
}
}
else
if
(
chunkIndex
==
-
1
)
{
}
if
(
chunkIndex
==
-
1
)
{
// We've reached the end of the stream.
return
;
}
...
...
library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParser.java
View file @
9f9e432d
...
...
@@ -96,7 +96,7 @@ public class SmoothStreamingManifestParser implements UriLoadable.Parser<SmoothS
this
.
parent
=
parent
;
this
.
baseUri
=
baseUri
;
this
.
tag
=
tag
;
this
.
normalizedAttributes
=
new
LinkedList
<
Pair
<
String
,
Object
>
>();
this
.
normalizedAttributes
=
new
LinkedList
<>();
}
public
final
Object
parse
(
XmlPullParser
xmlParser
)
throws
XmlPullParserException
,
IOException
,
...
...
@@ -343,7 +343,7 @@ public class SmoothStreamingManifestParser implements UriLoadable.Parser<SmoothS
super
(
parent
,
baseUri
,
TAG
);
lookAheadCount
=
-
1
;
protectionElement
=
null
;
streamElements
=
new
LinkedList
<
StreamElement
>();
streamElements
=
new
LinkedList
<>();
}
@Override
...
...
@@ -473,7 +473,7 @@ public class SmoothStreamingManifestParser implements UriLoadable.Parser<SmoothS
public
StreamElementParser
(
ElementParser
parent
,
String
baseUri
)
{
super
(
parent
,
baseUri
,
TAG
);
this
.
baseUri
=
baseUri
;
tracks
=
new
LinkedList
<
TrackElement
>();
tracks
=
new
LinkedList
<>();
}
@Override
...
...
@@ -539,7 +539,7 @@ public class SmoothStreamingManifestParser implements UriLoadable.Parser<SmoothS
if
(
timescale
==
-
1
)
{
timescale
=
(
Long
)
getNormalizedAttribute
(
KEY_TIME_SCALE
);
}
startTimes
=
new
ArrayList
<
Long
>();
startTimes
=
new
ArrayList
<>();
}
private
int
parseType
(
XmlPullParser
parser
)
throws
ParserException
{
...
...
@@ -602,7 +602,7 @@ public class SmoothStreamingManifestParser implements UriLoadable.Parser<SmoothS
public
TrackElementParser
(
ElementParser
parent
,
String
baseUri
)
{
super
(
parent
,
baseUri
,
TAG
);
this
.
csd
=
new
LinkedList
<
byte
[]
>();
this
.
csd
=
new
LinkedList
<>();
}
@Override
...
...
library/src/main/java/com/google/android/exoplayer/text/SubtitleLayout.java
View file @
9f9e432d
...
...
@@ -49,7 +49,7 @@ public final class SubtitleLayout extends ViewGroup {
public
SubtitleLayout
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
subtitleViews
=
new
ArrayList
<
SubtitleView
>();
subtitleViews
=
new
ArrayList
<>();
fontScale
=
1
;
captionStyle
=
CaptionStyleCompat
.
DEFAULT
;
}
...
...
library/src/main/java/com/google/android/exoplayer/text/eia608/Eia608Parser.java
View file @
9f9e432d
...
...
@@ -109,7 +109,7 @@ public class Eia608Parser {
/* package */
Eia608Parser
()
{
seiBuffer
=
new
ParsableBitArray
();
stringBuilder
=
new
StringBuilder
();
captions
=
new
ArrayList
<
ClosedCaption
>();
captions
=
new
ArrayList
<>();
}
/* package */
boolean
canParse
(
String
mimeType
)
{
...
...
library/src/main/java/com/google/android/exoplayer/text/eia608/Eia608TrackRenderer.java
View file @
9f9e432d
...
...
@@ -88,7 +88,7 @@ public class Eia608TrackRenderer extends TrackRenderer implements Callback {
formatHolder
=
new
MediaFormatHolder
();
sampleHolder
=
new
SampleHolder
(
SampleHolder
.
BUFFER_REPLACEMENT_MODE_NORMAL
);
captionStringBuilder
=
new
StringBuilder
();
pendingCaptionLists
=
new
TreeSet
<
ClosedCaptionList
>();
pendingCaptionLists
=
new
TreeSet
<>();
}
@Override
...
...
@@ -230,8 +230,11 @@ public class Eia608TrackRenderer extends TrackRenderer implements Callback {
}
private
void
invokeRendererInternal
(
String
cueText
)
{
Cue
cue
=
new
Cue
(
cueText
);
textRenderer
.
onCues
(
Collections
.
singletonList
(
cue
));
if
(
cueText
==
null
)
{
textRenderer
.
onCues
(
Collections
.<
Cue
>
emptyList
());
}
else
{
textRenderer
.
onCues
(
Collections
.
singletonList
(
new
Cue
(
cueText
)));
}
}
private
void
maybeParsePendingSample
()
{
...
...
library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlNode.java
View file @
9f9e432d
...
...
@@ -76,7 +76,7 @@ import java.util.TreeSet;
public
void
addChild
(
TtmlNode
child
)
{
if
(
children
==
null
)
{
children
=
new
ArrayList
<
TtmlNode
>();
children
=
new
ArrayList
<>();
}
children
.
add
(
child
);
}
...
...
@@ -93,7 +93,7 @@ import java.util.TreeSet;
}
public
long
[]
getEventTimesUs
()
{
TreeSet
<
Long
>
eventTimeSet
=
new
TreeSet
<
Long
>();
TreeSet
<
Long
>
eventTimeSet
=
new
TreeSet
<>();
getEventTimes
(
eventTimeSet
,
false
);
long
[]
eventTimes
=
new
long
[
eventTimeSet
.
size
()];
Iterator
<
Long
>
eventTimeIterator
=
eventTimeSet
.
iterator
();
...
...
library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java
View file @
9f9e432d
...
...
@@ -105,7 +105,7 @@ public class TtmlParser implements SubtitleParser {
XmlPullParser
xmlParser
=
xmlParserFactory
.
newPullParser
();
xmlParser
.
setInput
(
inputStream
,
inputEncoding
);
TtmlSubtitle
ttmlSubtitle
=
null
;
LinkedList
<
TtmlNode
>
nodeStack
=
new
LinkedList
<
TtmlNode
>();
LinkedList
<
TtmlNode
>
nodeStack
=
new
LinkedList
<>();
int
unsupportedNodeDepth
=
0
;
int
eventType
=
xmlParser
.
getEventType
();
while
(
eventType
!=
XmlPullParser
.
END_DOCUMENT
)
{
...
...
library/src/main/java/com/google/android/exoplayer/text/webvtt/WebvttParser.java
View file @
9f9e432d
...
...
@@ -40,22 +40,7 @@ import java.util.regex.Pattern;
*/
public
class
WebvttParser
implements
SubtitleParser
{
static
final
String
TAG
=
"WebvttParser"
;
/**
* This parser allows a custom header to be prepended to the WebVTT data, in the form of a text
* line starting with this string.
*
* @hide
*/
public
static
final
String
EXO_HEADER
=
"EXO-HEADER"
;
/**
* A {@code OFFSET + value} element can be added to the custom header to specify an offset time
* (in microseconds) that should be subtracted from the embedded MPEGTS value.
*
* @hide
*/
public
static
final
String
OFFSET
=
"OFFSET:"
;
private
static
final
String
TAG
=
"WebvttParser"
;
private
static
final
long
SAMPLING_RATE
=
90
;
...
...
@@ -73,7 +58,8 @@ public class WebvttParser implements SubtitleParser {
private
static
final
String
WEBVTT_CUE_SETTING_STRING
=
"\\S*:\\S*"
;
private
static
final
Pattern
WEBVTT_CUE_SETTING
=
Pattern
.
compile
(
WEBVTT_CUE_SETTING_STRING
);
private
static
final
Pattern
MEDIA_TIMESTAMP_OFFSET
=
Pattern
.
compile
(
OFFSET
+
"\\d+"
);
private
static
final
Pattern
MEDIA_TIMESTAMP_OFFSET
=
Pattern
.
compile
(
C
.
WEBVTT_EXO_HEADER_OFFSET
+
"\\d+"
);
private
static
final
Pattern
MEDIA_TIMESTAMP
=
Pattern
.
compile
(
"MPEGTS:\\d+"
);
private
static
final
String
NON_NUMERIC_STRING
=
".*[^0-9].*"
;
...
...
@@ -95,7 +81,7 @@ public class WebvttParser implements SubtitleParser {
@Override
public
WebvttSubtitle
parse
(
InputStream
inputStream
,
String
inputEncoding
,
long
startTimeUs
)
throws
IOException
{
ArrayList
<
WebvttCue
>
subtitles
=
new
ArrayList
<
WebvttCue
>();
ArrayList
<
WebvttCue
>
subtitles
=
new
ArrayList
<>();
long
mediaTimestampUs
=
startTimeUs
;
long
mediaTimestampOffsetUs
=
0
;
...
...
@@ -108,7 +94,7 @@ public class WebvttParser implements SubtitleParser {
throw
new
ParserException
(
"Expected WEBVTT or EXO-HEADER. Got null"
);
}
if
(
line
.
startsWith
(
EXO_HEADER
))
{
if
(
line
.
startsWith
(
C
.
WEBVTT_
EXO_HEADER
))
{
// parse the timestamp offset, if present
Matcher
matcher
=
MEDIA_TIMESTAMP_OFFSET
.
matcher
(
line
);
if
(
matcher
.
find
())
{
...
...
library/src/main/java/com/google/android/exoplayer/text/webvtt/WebvttSubtitle.java
View file @
9f9e432d
...
...
@@ -100,7 +100,7 @@ public class WebvttSubtitle implements Subtitle {
for
(
int
i
=
0
;
i
<
numCues
;
i
++)
{
if
((
cueTimesUs
[
i
*
2
]
<=
timeUs
)
&&
(
timeUs
<
cueTimesUs
[
i
*
2
+
1
]))
{
if
(
list
==
null
)
{
list
=
new
ArrayList
<
Cue
>();
list
=
new
ArrayList
<>();
}
WebvttCue
cue
=
cues
.
get
(
i
);
if
(
cue
.
isNormalCue
())
{
...
...
library/src/main/java/com/google/android/exoplayer/upstream/DefaultAllocator.java
View file @
9f9e432d
...
...
@@ -25,41 +25,72 @@ import java.util.Arrays;
*/
public
final
class
DefaultAllocator
implements
Allocator
{
private
static
final
int
INITIAL_RECYCLED_ALLOCATION
_CAPACITY
=
100
;
private
static
final
int
AVAILABLE_EXTRA
_CAPACITY
=
100
;
private
final
int
individualAllocationSize
;
private
final
byte
[]
initialAllocationBlock
;
private
int
allocatedCount
;
private
int
recycled
Count
;
private
Allocation
[]
recycled
Allocations
;
private
int
available
Count
;
private
Allocation
[]
available
Allocations
;
/**
* Constructs an empty pool.
* Constructs an
initially
empty pool.
*
* @param individualAllocationSize The length of each individual allocation.
*/
public
DefaultAllocator
(
int
individualAllocationSize
)
{
this
(
individualAllocationSize
,
0
);
}
/**
* Constructs a pool with some {@link Allocation}s created up front.
* <p>
* Note: Initial {@link Allocation}s will never be discarded by {@link #trim(int)}.
*
* @param individualAllocationSize The length of each individual allocation.
* @param initialAllocationCount The number of allocations to create up front.
*/
public
DefaultAllocator
(
int
individualAllocationSize
,
int
initialAllocationCount
)
{
Assertions
.
checkArgument
(
individualAllocationSize
>
0
);
Assertions
.
checkArgument
(
initialAllocationCount
>=
0
);
this
.
individualAllocationSize
=
individualAllocationSize
;
this
.
recycledAllocations
=
new
Allocation
[
INITIAL_RECYCLED_ALLOCATION_CAPACITY
];
this
.
availableCount
=
initialAllocationCount
;
this
.
availableAllocations
=
new
Allocation
[
initialAllocationCount
+
AVAILABLE_EXTRA_CAPACITY
];
if
(
initialAllocationCount
>
0
)
{
initialAllocationBlock
=
new
byte
[
initialAllocationCount
*
individualAllocationSize
];
for
(
int
i
=
0
;
i
<
initialAllocationCount
;
i
++)
{
int
allocationOffset
=
i
*
individualAllocationSize
;
availableAllocations
[
i
]
=
new
Allocation
(
initialAllocationBlock
,
allocationOffset
);
}
}
else
{
initialAllocationBlock
=
null
;
}
}
@Override
public
synchronized
Allocation
allocate
()
{
allocatedCount
++;
return
recycledCount
>
0
?
recycledAllocations
[--
recycledCount
]
:
new
Allocation
(
new
byte
[
individualAllocationSize
],
0
);
Allocation
allocation
;
if
(
availableCount
>
0
)
{
allocation
=
availableAllocations
[--
availableCount
];
availableAllocations
[
availableCount
]
=
null
;
}
else
{
allocation
=
new
Allocation
(
new
byte
[
individualAllocationSize
],
0
);
}
return
allocation
;
}
@Override
public
synchronized
void
release
(
Allocation
allocation
)
{
// Weak sanity check that the allocation probably originated from this pool.
Assertions
.
checkArgument
(
allocation
.
data
.
length
==
individualAllocationSize
);
Assertions
.
checkArgument
(
allocation
.
data
==
initialAllocationBlock
||
allocation
.
data
.
length
==
individualAllocationSize
);
allocatedCount
--;
if
(
recycledCount
==
recycled
Allocations
.
length
)
{
recycledAllocations
=
Arrays
.
copyOf
(
recycledAllocations
,
recycled
Allocations
.
length
*
2
);
if
(
availableCount
==
available
Allocations
.
length
)
{
availableAllocations
=
Arrays
.
copyOf
(
availableAllocations
,
available
Allocations
.
length
*
2
);
}
recycledAllocations
[
recycled
Count
++]
=
allocation
;
availableAllocations
[
available
Count
++]
=
allocation
;
// Wake up threads waiting for the allocated size to drop.
notifyAll
();
}
...
...
@@ -67,12 +98,44 @@ public final class DefaultAllocator implements Allocator {
@Override
public
synchronized
void
trim
(
int
targetSize
)
{
int
targetAllocationCount
=
Util
.
ceilDivide
(
targetSize
,
individualAllocationSize
);
int
targetRecycledAllocationCount
=
Math
.
max
(
0
,
targetAllocationCount
-
allocatedCount
);
if
(
targetRecycledAllocationCount
<
recycledCount
)
{
Arrays
.
fill
(
recycledAllocations
,
targetRecycledAllocationCount
,
recycledCount
,
null
);
recycledCount
=
targetRecycledAllocationCount
;
int
targetAvailableCount
=
Math
.
max
(
0
,
targetAllocationCount
-
allocatedCount
);
if
(
targetAvailableCount
>=
availableCount
)
{
// We're already at or below the target.
return
;
}
if
(
initialAllocationBlock
!=
null
)
{
// Some allocations are backed by an initial block. We need to make sure that we hold onto all
// such allocations. Re-order the available allocations so that the ones backed by the initial
// block come first.
int
lowIndex
=
0
;
int
highIndex
=
availableCount
-
1
;
while
(
lowIndex
<=
highIndex
)
{
Allocation
lowAllocation
=
availableAllocations
[
lowIndex
];
if
(
lowAllocation
.
data
==
initialAllocationBlock
)
{
lowIndex
++;
}
else
{
Allocation
highAllocation
=
availableAllocations
[
lowIndex
];
if
(
highAllocation
.
data
!=
initialAllocationBlock
)
{
highIndex
--;
}
else
{
availableAllocations
[
lowIndex
++]
=
highAllocation
;
availableAllocations
[
highIndex
--]
=
lowAllocation
;
}
}
}
// lowIndex is the index of the first allocation not backed by an initial block.
targetAvailableCount
=
Math
.
max
(
targetAvailableCount
,
lowIndex
);
if
(
targetAvailableCount
>=
availableCount
)
{
// We're already at or below the target.
return
;
}
}
// Discard allocations beyond the target.
Arrays
.
fill
(
availableAllocations
,
targetAvailableCount
,
availableCount
,
null
);
availableCount
=
targetAvailableCount
;
}
@Override
public
synchronized
int
getTotalBytesAllocated
()
{
...
...
library/src/main/java/com/google/android/exoplayer/upstream/DefaultHttpDataSource.java
View file @
9f9e432d
...
...
@@ -61,7 +61,7 @@ public class DefaultHttpDataSource implements HttpDataSource {
private
static
final
String
TAG
=
"HttpDataSource"
;
private
static
final
Pattern
CONTENT_RANGE_HEADER
=
Pattern
.
compile
(
"^bytes (\\d+)-(\\d+)/(\\d+)$"
);
private
static
final
AtomicReference
<
byte
[]>
skipBufferReference
=
new
AtomicReference
<
byte
[]
>();
private
static
final
AtomicReference
<
byte
[]>
skipBufferReference
=
new
AtomicReference
<>();
private
final
boolean
allowCrossProtocolRedirects
;
private
final
int
connectTimeoutMillis
;
...
...
@@ -141,7 +141,7 @@ public class DefaultHttpDataSource implements HttpDataSource {
this
.
userAgent
=
Assertions
.
checkNotEmpty
(
userAgent
);
this
.
contentTypePredicate
=
contentTypePredicate
;
this
.
listener
=
listener
;
this
.
requestProperties
=
new
HashMap
<
String
,
String
>();
this
.
requestProperties
=
new
HashMap
<>();
this
.
connectTimeoutMillis
=
connectTimeoutMillis
;
this
.
readTimeoutMillis
=
readTimeoutMillis
;
this
.
allowCrossProtocolRedirects
=
allowCrossProtocolRedirects
;
...
...
library/src/main/java/com/google/android/exoplayer/upstream/NetworkLock.java
View file @
9f9e432d
...
...
@@ -62,7 +62,7 @@ public final class NetworkLock {
private
int
highestPriority
;
private
NetworkLock
()
{
queue
=
new
PriorityQueue
<
Integer
>();
queue
=
new
PriorityQueue
<>();
highestPriority
=
Integer
.
MAX_VALUE
;
}
...
...
library/src/main/java/com/google/android/exoplayer/upstream/cache/CacheSpan.java
View file @
9f9e432d
...
...
@@ -92,7 +92,8 @@ public final class CacheSpan implements Comparable<CacheSpan> {
return
new
CacheSpan
(
key
,
position
,
file
.
length
(),
true
,
lastAccessTimestamp
,
file
);
}
private
CacheSpan
(
String
key
,
long
position
,
long
length
,
boolean
isCached
,
// Visible for testing.
CacheSpan
(
String
key
,
long
position
,
long
length
,
boolean
isCached
,
long
lastAccessTimestamp
,
File
file
)
{
this
.
key
=
key
;
this
.
position
=
position
;
...
...
library/src/main/java/com/google/android/exoplayer/upstream/cache/LeastRecentlyUsedCacheEvictor.java
View file @
9f9e432d
...
...
@@ -30,7 +30,7 @@ public class LeastRecentlyUsedCacheEvictor implements CacheEvictor, Comparator<C
public
LeastRecentlyUsedCacheEvictor
(
long
maxBytes
)
{
this
.
maxBytes
=
maxBytes
;
this
.
leastRecentlyUsed
=
new
TreeSet
<
CacheSpan
>(
this
);
this
.
leastRecentlyUsed
=
new
TreeSet
<>(
this
);
}
@Override
...
...
library/src/main/java/com/google/android/exoplayer/upstream/cache/SimpleCache.java
View file @
9f9e432d
...
...
@@ -50,9 +50,9 @@ public class SimpleCache implements Cache {
public
SimpleCache
(
File
cacheDir
,
CacheEvictor
evictor
)
{
this
.
cacheDir
=
cacheDir
;
this
.
evictor
=
evictor
;
this
.
lockedSpans
=
new
HashMap
<
String
,
CacheSpan
>();
this
.
cachedSpans
=
new
HashMap
<
String
,
TreeSet
<
CacheSpan
>
>();
this
.
listeners
=
new
HashMap
<
String
,
ArrayList
<
Listener
>
>();
this
.
lockedSpans
=
new
HashMap
<>();
this
.
cachedSpans
=
new
HashMap
<>();
this
.
listeners
=
new
HashMap
<>();
// Start cache initialization.
final
ConditionVariable
conditionVariable
=
new
ConditionVariable
();
new
Thread
()
{
...
...
@@ -71,7 +71,7 @@ public class SimpleCache implements Cache {
public
synchronized
NavigableSet
<
CacheSpan
>
addListener
(
String
key
,
Listener
listener
)
{
ArrayList
<
Listener
>
listenersForKey
=
listeners
.
get
(
key
);
if
(
listenersForKey
==
null
)
{
listenersForKey
=
new
ArrayList
<
Listener
>();
listenersForKey
=
new
ArrayList
<>();
listeners
.
put
(
key
,
listenersForKey
);
}
listenersForKey
.
add
(
listener
);
...
...
@@ -92,12 +92,12 @@ public class SimpleCache implements Cache {
@Override
public
synchronized
NavigableSet
<
CacheSpan
>
getCachedSpans
(
String
key
)
{
TreeSet
<
CacheSpan
>
spansForKey
=
cachedSpans
.
get
(
key
);
return
spansForKey
==
null
?
null
:
new
TreeSet
<
CacheSpan
>(
spansForKey
);
return
spansForKey
==
null
?
null
:
new
TreeSet
<>(
spansForKey
);
}
@Override
public
synchronized
Set
<
String
>
getKeys
()
{
return
new
HashSet
<
String
>(
cachedSpans
.
keySet
());
return
new
HashSet
<>(
cachedSpans
.
keySet
());
}
@Override
...
...
@@ -263,7 +263,7 @@ public class SimpleCache implements Cache {
private
void
addSpan
(
CacheSpan
span
)
{
TreeSet
<
CacheSpan
>
spansForKey
=
cachedSpans
.
get
(
span
.
key
);
if
(
spansForKey
==
null
)
{
spansForKey
=
new
TreeSet
<
CacheSpan
>();
spansForKey
=
new
TreeSet
<>();
cachedSpans
.
put
(
span
.
key
,
spansForKey
);
}
spansForKey
.
add
(
span
);
...
...
library/src/main/java/com/google/android/exoplayer/util/CodecSpecificDataUtil.java
View file @
9f9e432d
...
...
@@ -132,7 +132,7 @@ public final class CodecSpecificDataUtil {
// data does not consist of NAL start code delimited units.
return
null
;
}
List
<
Integer
>
starts
=
new
ArrayList
<
Integer
>();
List
<
Integer
>
starts
=
new
ArrayList
<>();
int
nalUnitIndex
=
0
;
do
{
starts
.
add
(
nalUnitIndex
);
...
...
library/src/main/java/com/google/android/exoplayer/util/ManifestFetcher.java
View file @
9f9e432d
...
...
@@ -146,7 +146,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
*/
public
void
singleLoad
(
Looper
callbackLooper
,
final
ManifestCallback
<
T
>
callback
)
{
SingleFetchHelper
fetchHelper
=
new
SingleFetchHelper
(
new
UriLoadable
<
T
>(
manifestUrl
,
uriDataSource
,
parser
),
callbackLooper
,
callback
);
new
UriLoadable
<>(
manifestUrl
,
uriDataSource
,
parser
),
callbackLooper
,
callback
);
fetchHelper
.
startLoading
();
}
...
...
@@ -219,7 +219,7 @@ public class ManifestFetcher<T> implements Loader.Callback {
loader
=
new
Loader
(
"manifestLoader"
);
}
if
(!
loader
.
isLoading
())
{
currentLoadable
=
new
UriLoadable
<
T
>(
manifestUrl
,
uriDataSource
,
parser
);
currentLoadable
=
new
UriLoadable
<>(
manifestUrl
,
uriDataSource
,
parser
);
loader
.
startLoading
(
currentLoadable
,
this
);
notifyManifestRefreshStarted
();
}
...
...
library/src/main/java/com/google/android/exoplayer/util/SlidingPercentile.java
View file @
9f9e432d
...
...
@@ -67,7 +67,7 @@ public class SlidingPercentile {
public
SlidingPercentile
(
int
maxWeight
)
{
this
.
maxWeight
=
maxWeight
;
recycledSamples
=
new
Sample
[
MAX_RECYCLED_SAMPLES
];
samples
=
new
ArrayList
<
Sample
>();
samples
=
new
ArrayList
<>();
currentSortOrder
=
SORT_ORDER_NONE
;
}
...
...
library/src/test/.classpath
View file @
9f9e432d
...
...
@@ -5,6 +5,5 @@
<classpathentry
kind=
"con"
path=
"com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"
/>
<classpathentry
exported=
"true"
kind=
"con"
path=
"com.android.ide.eclipse.adt.LIBRARIES"
/>
<classpathentry
exported=
"true"
kind=
"con"
path=
"com.android.ide.eclipse.adt.DEPENDENCIES"
/>
<classpathentry
combineaccessrules=
"false"
kind=
"src"
path=
"/ExoPlayerDemo"
/>
<classpathentry
kind=
"output"
path=
"bin/classes"
/>
</classpath>
library/src/test/.settings/org.eclipse.jdt.core.prefs
0 → 100644
View file @
9f9e432d
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.source=1.7
library/src/test/AndroidManifest.xml
View file @
9f9e432d
...
...
@@ -15,16 +15,19 @@
-->
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
package=
"com.google.android.exoplayer.tests"
>
<uses-sdk
android:minSdkVersion=
"9"
android:targetSdkVersion=
"22"
/>
<application>
<application
android:debuggable=
"true"
android:allowBackup=
"false"
tools:ignore=
"MissingApplicationIcon,HardcodedDebugMode"
>
<uses-library
android:name=
"android.test.runner"
/>
</application>
<instrumentation
android:targetPackage=
"com.google.android.exoplayer.
demo
"
android:targetPackage=
"com.google.android.exoplayer.
tests
"
android:name=
"android.test.InstrumentationTestRunner"
/>
</manifest>
library/src/test/java/com/google/android/exoplayer/MediaFormatTest.java
View file @
9f9e432d
...
...
@@ -37,7 +37,7 @@ public class MediaFormatTest extends TestCase {
byte
[]
initData1
=
new
byte
[]
{
1
,
2
,
3
};
byte
[]
initData2
=
new
byte
[]
{
4
,
5
,
6
};
List
<
byte
[]>
initData
=
new
ArrayList
<
byte
[]
>();
List
<
byte
[]>
initData
=
new
ArrayList
<>();
initData
.
add
(
initData1
);
initData
.
add
(
initData2
);
...
...
library/src/test/java/com/google/android/exoplayer/dash/DashChunkSourceTest.java
View file @
9f9e432d
...
...
@@ -383,7 +383,7 @@ public class DashChunkSourceTest extends InstrumentationTestCase {
}
private
static
MediaPresentationDescription
generateVodMpd
()
{
List
<
Representation
>
representations
=
new
ArrayList
<
Representation
>();
List
<
Representation
>
representations
=
new
ArrayList
<>();
SingleSegmentBase
segmentBase1
=
new
SingleSegmentBase
(
"https://example.com/1.mp4"
);
Representation
representation1
=
...
...
@@ -399,10 +399,10 @@ public class DashChunkSourceTest extends InstrumentationTestCase {
}
private
static
MediaPresentationDescription
generateLiveMpdWithTimeline
(
long
startTime
)
{
List
<
Representation
>
representations
=
new
ArrayList
<
Representation
>();
List
<
Representation
>
representations
=
new
ArrayList
<>();
List
<
SegmentTimelineElement
>
segmentTimeline
=
new
ArrayList
<
SegmentTimelineElement
>();
List
<
RangedUri
>
mediaSegments
=
new
ArrayList
<
RangedUri
>();
List
<
SegmentTimelineElement
>
segmentTimeline
=
new
ArrayList
<>();
List
<
RangedUri
>
mediaSegments
=
new
ArrayList
<>();
long
byteStart
=
0
;
for
(
int
i
=
0
;
i
<
LIVE_SEGMENT_COUNT
;
i
++)
{
segmentTimeline
.
add
(
new
SegmentTimelineElement
(
startTime
,
LIVE_SEGMENT_DURATION_MS
));
...
...
@@ -423,7 +423,7 @@ public class DashChunkSourceTest extends InstrumentationTestCase {
private
static
MediaPresentationDescription
generateLiveMpdWithTemplate
(
boolean
limitTimeshiftBuffer
)
{
List
<
Representation
>
representations
=
new
ArrayList
<
Representation
>();
List
<
Representation
>
representations
=
new
ArrayList
<>();
UrlTemplate
initializationTemplate
=
null
;
UrlTemplate
mediaTemplate
=
UrlTemplate
.
compile
(
"$RepresentationID$/$Number$"
);
...
...
@@ -464,7 +464,7 @@ public class DashChunkSourceTest extends InstrumentationTestCase {
long
seekPositionMs
,
long
seekRangeStartMs
,
long
seekRangeEndMs
,
long
chunkStartTimeMs
,
long
chunkEndTimeMs
)
{
DashChunkSource
chunkSource
=
setupLiveEdgeTimelineTest
(
startTimeMs
,
liveEdgeLatencyMs
);
List
<
MediaChunk
>
queue
=
new
ArrayList
<
MediaChunk
>();
List
<
MediaChunk
>
queue
=
new
ArrayList
<>();
ChunkOperationHolder
out
=
new
ChunkOperationHolder
();
chunkSource
.
getChunkOperation
(
queue
,
seekPositionMs
*
1000
,
0
,
out
);
TimeRange
seekRange
=
chunkSource
.
getSeekRange
();
...
...
@@ -482,7 +482,7 @@ public class DashChunkSourceTest extends InstrumentationTestCase {
long
chunkEndTimeMs
,
boolean
limitTimeshiftBuffer
)
{
DashChunkSource
chunkSource
=
setupLiveEdgeTemplateTest
(
startTimeMs
,
liveEdgeLatencyMs
,
limitTimeshiftBuffer
);
List
<
MediaChunk
>
queue
=
new
ArrayList
<
MediaChunk
>();
List
<
MediaChunk
>
queue
=
new
ArrayList
<>();
ChunkOperationHolder
out
=
new
ChunkOperationHolder
();
chunkSource
.
getChunkOperation
(
queue
,
seekPositionMs
*
1000
,
0
,
out
);
TimeRange
seekRange
=
chunkSource
.
getSeekRange
();
...
...
library/src/test/java/com/google/android/exoplayer/extractor/mp4/Mp4ExtractorTest.java
View file @
9f9e432d
...
...
@@ -267,7 +267,7 @@ public class Mp4ExtractorTest extends TestCase {
private
static
byte
[]
getStsc
()
{
int
samplesPerChunk
=
-
1
;
List
<
Integer
>
samplesInChunkChangeIndices
=
new
ArrayList
<
Integer
>();
List
<
Integer
>
samplesInChunkChangeIndices
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
SAMPLES_IN_CHUNK
.
length
;
i
++)
{
if
(
SAMPLES_IN_CHUNK
[
i
]
!=
samplesPerChunk
)
{
samplesInChunkChangeIndices
.
add
(
i
);
...
...
library/src/test/java/com/google/android/exoplayer/extractor/webm/DefaultEbmlReaderTest.java
View file @
9f9e432d
...
...
@@ -173,7 +173,7 @@ public class DefaultEbmlReaderTest extends TestCase {
private
static
final
int
ID_DURATION
=
0x4489
;
private
static
final
int
ID_SIMPLE_BLOCK
=
0xA3
;
private
final
List
<
String
>
events
=
new
ArrayList
<
String
>();
private
final
List
<
String
>
events
=
new
ArrayList
<>();
@Override
public
int
getElementType
(
int
id
)
{
...
...
library/src/test/java/com/google/android/exoplayer/testutil/FakeDataSource.java
View file @
9f9e432d
...
...
@@ -169,7 +169,7 @@ public final class FakeDataSource implements DataSource {
private
boolean
simulateUnknownLength
;
public
Builder
()
{
segments
=
new
ArrayList
<
Segment
>();
segments
=
new
ArrayList
<>();
}
/**
...
...
library/src/test/java/com/google/android/exoplayer/text/webvtt/WebvttSubtitleTest.java
View file @
9f9e432d
...
...
@@ -34,7 +34,7 @@ public class WebvttSubtitleTest extends TestCase {
private
WebvttSubtitle
emptySubtitle
=
new
WebvttSubtitle
(
new
ArrayList
<
WebvttCue
>(),
0
);
private
ArrayList
<
WebvttCue
>
simpleSubtitleCues
=
new
ArrayList
<
WebvttCue
>();
private
ArrayList
<
WebvttCue
>
simpleSubtitleCues
=
new
ArrayList
<>();
{
WebvttCue
firstCue
=
new
WebvttCue
(
1000000
,
2000000
,
FIRST_SUBTITLE_STRING
);
simpleSubtitleCues
.
add
(
firstCue
);
...
...
@@ -44,7 +44,7 @@ public class WebvttSubtitleTest extends TestCase {
}
private
WebvttSubtitle
simpleSubtitle
=
new
WebvttSubtitle
(
simpleSubtitleCues
,
0
);
private
ArrayList
<
WebvttCue
>
overlappingSubtitleCues
=
new
ArrayList
<
WebvttCue
>();
private
ArrayList
<
WebvttCue
>
overlappingSubtitleCues
=
new
ArrayList
<>();
{
WebvttCue
firstCue
=
new
WebvttCue
(
1000000
,
3000000
,
FIRST_SUBTITLE_STRING
);
overlappingSubtitleCues
.
add
(
firstCue
);
...
...
@@ -54,7 +54,7 @@ public class WebvttSubtitleTest extends TestCase {
}
private
WebvttSubtitle
overlappingSubtitle
=
new
WebvttSubtitle
(
overlappingSubtitleCues
,
0
);
private
ArrayList
<
WebvttCue
>
nestedSubtitleCues
=
new
ArrayList
<
WebvttCue
>();
private
ArrayList
<
WebvttCue
>
nestedSubtitleCues
=
new
ArrayList
<>();
{
WebvttCue
firstCue
=
new
WebvttCue
(
1000000
,
4000000
,
FIRST_SUBTITLE_STRING
);
nestedSubtitleCues
.
add
(
firstCue
);
...
...
library/src/test/java/com/google/android/exoplayer/util/UtilTest.java
View file @
9f9e432d
...
...
@@ -53,7 +53,7 @@ public class UtilTest extends TestCase {
}
public
void
testListBinarySearchFloor
()
{
List
<
Integer
>
values
=
new
ArrayList
<
Integer
>();
List
<
Integer
>
values
=
new
ArrayList
<>();
assertEquals
(-
1
,
Util
.
binarySearchFloor
(
values
,
0
,
false
,
false
));
assertEquals
(
0
,
Util
.
binarySearchFloor
(
values
,
0
,
false
,
true
));
...
...
@@ -107,7 +107,7 @@ public class UtilTest extends TestCase {
}
public
void
testListBinarySearchCeil
()
{
List
<
Integer
>
values
=
new
ArrayList
<
Integer
>();
List
<
Integer
>
values
=
new
ArrayList
<>();
assertEquals
(
0
,
Util
.
binarySearchCeil
(
values
,
0
,
false
,
false
));
assertEquals
(-
1
,
Util
.
binarySearchCeil
(
values
,
0
,
false
,
true
));
...
...
library/src/test/project.properties
View file @
9f9e432d
...
...
@@ -12,3 +12,4 @@
# Project target.
target
=
android-22
android.library.reference.1
=
../main
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