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
ac54b4f6
authored
May 22, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Cleanup/Sync with internal tree
parent
67d01549
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
51 additions
and
29 deletions
demo/src/main/java/com/google/android/exoplayer/demo/player/DashRendererBuilder.java
library/build.gradle
library/src/main/java/com/google/android/exoplayer/MediaCodecUtil.java
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
library/src/main/java/com/google/android/exoplayer/hls/HlsExtractorWrapper.java
library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingChunkSource.java
library/src/main/java/com/google/android/exoplayer/text/eia608/Eia608TrackRenderer.java
library/src/main/java/com/google/android/exoplayer/upstream/cache/CacheSpan.java
library/src/test/.classpath
library/src/test/AndroidManifest.xml
library/src/test/java/com/google/android/exoplayer/text/webvtt/WebvttSubtitleTest.java
library/src/test/project.properties
demo/src/main/java/com/google/android/exoplayer/demo/player/DashRendererBuilder.java
View file @
ac54b4f6
...
@@ -131,8 +131,7 @@ public class DashRendererBuilder implements RendererBuilder,
...
@@ -131,8 +131,7 @@ public class DashRendererBuilder implements RendererBuilder,
this
.
callback
=
callback
;
this
.
callback
=
callback
;
MediaPresentationDescriptionParser
parser
=
new
MediaPresentationDescriptionParser
();
MediaPresentationDescriptionParser
parser
=
new
MediaPresentationDescriptionParser
();
manifestDataSource
=
new
DefaultUriDataSource
(
context
,
userAgent
);
manifestDataSource
=
new
DefaultUriDataSource
(
context
,
userAgent
);
manifestFetcher
=
new
ManifestFetcher
<>(
url
,
manifestDataSource
,
manifestFetcher
=
new
ManifestFetcher
<>(
url
,
manifestDataSource
,
parser
);
parser
);
manifestFetcher
.
singleLoad
(
player
.
getMainHandler
().
getLooper
(),
this
);
manifestFetcher
.
singleLoad
(
player
.
getMainHandler
().
getLooper
(),
this
);
}
}
...
...
library/build.gradle
View file @
ac54b4f6
...
@@ -38,9 +38,19 @@ android {
...
@@ -38,9 +38,19 @@ android {
lintOptions
{
lintOptions
{
abortOnError
false
abortOnError
false
}
}
sourceSets
{
androidTest
{
assets
.
srcDirs
=
[
'src/test/assets'
]
java
.
srcDirs
=
[
'src/test/java'
]
}
}
}
}
dependencies
{
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
->
android
.
libraryVariants
.
all
{
variant
->
...
...
library/src/main/java/com/google/android/exoplayer/MediaCodecUtil.java
View file @
ac54b4f6
...
@@ -52,8 +52,7 @@ public class MediaCodecUtil {
...
@@ -52,8 +52,7 @@ public class MediaCodecUtil {
private
static
final
String
TAG
=
"MediaCodecUtil"
;
private
static
final
String
TAG
=
"MediaCodecUtil"
;
private
static
final
HashMap
<
CodecKey
,
Pair
<
String
,
CodecCapabilities
>>
codecs
=
private
static
final
HashMap
<
CodecKey
,
Pair
<
String
,
CodecCapabilities
>>
codecs
=
new
HashMap
<>();
new
HashMap
<>();
/**
/**
* Get information about the decoder that will be used for a given mime type.
* Get information about the decoder that will be used for a given mime type.
...
...
library/src/main/java/com/google/android/exoplayer/dash/DashChunkSource.java
View file @
ac54b4f6
...
@@ -101,7 +101,7 @@ public class DashChunkSource implements ChunkSource {
...
@@ -101,7 +101,7 @@ public class DashChunkSource implements ChunkSource {
private
final
TrackInfo
trackInfo
;
private
final
TrackInfo
trackInfo
;
private
final
DataSource
dataSource
;
private
final
DataSource
dataSource
;
private
final
FormatEvaluator
e
valuator
;
private
final
FormatEvaluator
formatE
valuator
;
private
final
Evaluation
evaluation
;
private
final
Evaluation
evaluation
;
private
final
Clock
systemClock
;
private
final
Clock
systemClock
;
private
final
StringBuilder
headerBuilder
;
private
final
StringBuilder
headerBuilder
;
...
@@ -117,13 +117,14 @@ public class DashChunkSource implements ChunkSource {
...
@@ -117,13 +117,14 @@ public class DashChunkSource implements ChunkSource {
private
final
int
adaptationSetIndex
;
private
final
int
adaptationSetIndex
;
private
final
int
[]
representationIndices
;
private
final
int
[]
representationIndices
;
private
DrmInitData
drmInitData
;
private
MediaPresentationDescription
currentManifest
;
private
MediaPresentationDescription
currentManifest
;
private
boolean
finishedCurrentManifest
;
private
DrmInitData
drmInitData
;
private
TimeRange
seekRange
;
private
TimeRange
seekRange
;
private
long
[]
seekRangeValues
;
private
long
[]
seekRangeValues
;
private
int
firstAvailableSegmentNum
;
private
int
firstAvailableSegmentNum
;
private
int
lastAvailableSegmentNum
;
private
int
lastAvailableSegmentNum
;
private
boolean
finishedCurrentManifest
;
private
boolean
lastChunkWasInitialization
;
private
boolean
lastChunkWasInitialization
;
private
IOException
fatalError
;
private
IOException
fatalError
;
...
@@ -214,7 +215,7 @@ public class DashChunkSource implements ChunkSource {
...
@@ -214,7 +215,7 @@ public class DashChunkSource implements ChunkSource {
this
.
adaptationSetIndex
=
adaptationSetIndex
;
this
.
adaptationSetIndex
=
adaptationSetIndex
;
this
.
representationIndices
=
representationIndices
;
this
.
representationIndices
=
representationIndices
;
this
.
dataSource
=
dataSource
;
this
.
dataSource
=
dataSource
;
this
.
e
valuator
=
formatEvaluator
;
this
.
formatE
valuator
=
formatEvaluator
;
this
.
systemClock
=
systemClock
;
this
.
systemClock
=
systemClock
;
this
.
liveEdgeLatencyUs
=
liveEdgeLatencyUs
;
this
.
liveEdgeLatencyUs
=
liveEdgeLatencyUs
;
this
.
elapsedRealtimeOffsetUs
=
elapsedRealtimeOffsetUs
;
this
.
elapsedRealtimeOffsetUs
=
elapsedRealtimeOffsetUs
;
...
@@ -268,7 +269,8 @@ public class DashChunkSource implements ChunkSource {
...
@@ -268,7 +269,8 @@ public class DashChunkSource implements ChunkSource {
@Override
@Override
public
void
enable
()
{
public
void
enable
()
{
evaluator
.
enable
();
fatalError
=
null
;
formatEvaluator
.
enable
();
if
(
manifestFetcher
!=
null
)
{
if
(
manifestFetcher
!=
null
)
{
manifestFetcher
.
enable
();
manifestFetcher
.
enable
();
}
}
...
@@ -286,7 +288,7 @@ public class DashChunkSource implements ChunkSource {
...
@@ -286,7 +288,7 @@ public class DashChunkSource implements ChunkSource {
@Override
@Override
public
void
disable
(
List
<?
extends
MediaChunk
>
queue
)
{
public
void
disable
(
List
<?
extends
MediaChunk
>
queue
)
{
e
valuator
.
disable
();
formatE
valuator
.
disable
();
if
(
manifestFetcher
!=
null
)
{
if
(
manifestFetcher
!=
null
)
{
manifestFetcher
.
disable
();
manifestFetcher
.
disable
();
}
}
...
@@ -347,7 +349,7 @@ public class DashChunkSource implements ChunkSource {
...
@@ -347,7 +349,7 @@ public class DashChunkSource implements ChunkSource {
evaluation
.
queueSize
=
queue
.
size
();
evaluation
.
queueSize
=
queue
.
size
();
if
(
evaluation
.
format
==
null
||
!
lastChunkWasInitialization
)
{
if
(
evaluation
.
format
==
null
||
!
lastChunkWasInitialization
)
{
e
valuator
.
evaluate
(
queue
,
playbackPositionUs
,
formats
,
evaluation
);
formatE
valuator
.
evaluate
(
queue
,
playbackPositionUs
,
formats
,
evaluation
);
}
}
Format
selectedFormat
=
evaluation
.
format
;
Format
selectedFormat
=
evaluation
.
format
;
out
.
queueSize
=
evaluation
.
queueSize
;
out
.
queueSize
=
evaluation
.
queueSize
;
...
@@ -362,6 +364,9 @@ public class DashChunkSource implements ChunkSource {
...
@@ -362,6 +364,9 @@ public class DashChunkSource implements ChunkSource {
return
;
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
);
RepresentationHolder
representationHolder
=
representationHolders
.
get
(
selectedFormat
.
id
);
Representation
selectedRepresentation
=
representationHolder
.
representation
;
Representation
selectedRepresentation
=
representationHolder
.
representation
;
DashSegmentIndex
segmentIndex
=
representationHolder
.
segmentIndex
;
DashSegmentIndex
segmentIndex
=
representationHolder
.
segmentIndex
;
...
@@ -426,7 +431,7 @@ public class DashChunkSource implements ChunkSource {
...
@@ -426,7 +431,7 @@ public class DashChunkSource implements ChunkSource {
}
}
if
(
segmentNum
==
-
1
)
{
if
(
segmentNum
==
-
1
)
{
out
.
chunk
=
null
;
// We've reached the end of the stream.
return
;
return
;
}
}
...
...
library/src/main/java/com/google/android/exoplayer/hls/HlsExtractorWrapper.java
View file @
ac54b4f6
...
@@ -70,7 +70,7 @@ public final class HlsExtractorWrapper implements ExtractorOutput {
...
@@ -70,7 +70,7 @@ public final class HlsExtractorWrapper implements ExtractorOutput {
*/
*/
public
void
init
(
Allocator
allocator
)
{
public
void
init
(
Allocator
allocator
)
{
this
.
allocator
=
allocator
;
this
.
allocator
=
allocator
;
this
.
extractor
.
init
(
this
);
extractor
.
init
(
this
);
}
}
/**
/**
...
...
library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingChunkSource.java
View file @
ac54b4f6
...
@@ -59,14 +59,11 @@ public class SmoothStreamingChunkSource implements ChunkSource {
...
@@ -59,14 +59,11 @@ public class SmoothStreamingChunkSource implements ChunkSource {
private
static
final
int
MINIMUM_MANIFEST_REFRESH_PERIOD_MS
=
5000
;
private
static
final
int
MINIMUM_MANIFEST_REFRESH_PERIOD_MS
=
5000
;
private
static
final
int
INITIALIZATION_VECTOR_SIZE
=
8
;
private
static
final
int
INITIALIZATION_VECTOR_SIZE
=
8
;
private
final
ManifestFetcher
<
SmoothStreamingManifest
>
manifestFetcher
;
private
final
int
streamElementIndex
;
private
final
TrackInfo
trackInfo
;
private
final
TrackInfo
trackInfo
;
private
final
DataSource
dataSource
;
private
final
DataSource
dataSource
;
private
final
FormatEvaluator
formatEvaluator
;
private
final
FormatEvaluator
formatEvaluator
;
private
final
Evaluation
evaluation
;
private
final
Evaluation
evaluation
;
private
final
long
liveEdgeLatencyUs
;
private
final
long
liveEdgeLatencyUs
;
private
final
int
maxWidth
;
private
final
int
maxWidth
;
private
final
int
maxHeight
;
private
final
int
maxHeight
;
...
@@ -75,6 +72,9 @@ public class SmoothStreamingChunkSource implements ChunkSource {
...
@@ -75,6 +72,9 @@ public class SmoothStreamingChunkSource implements ChunkSource {
private
final
DrmInitData
drmInitData
;
private
final
DrmInitData
drmInitData
;
private
final
Format
[]
formats
;
private
final
Format
[]
formats
;
private
final
ManifestFetcher
<
SmoothStreamingManifest
>
manifestFetcher
;
private
final
int
streamElementIndex
;
private
SmoothStreamingManifest
currentManifest
;
private
SmoothStreamingManifest
currentManifest
;
private
int
currentManifestChunkOffset
;
private
int
currentManifestChunkOffset
;
private
boolean
finishedCurrentManifest
;
private
boolean
finishedCurrentManifest
;
...
@@ -174,8 +174,8 @@ public class SmoothStreamingChunkSource implements ChunkSource {
...
@@ -174,8 +174,8 @@ public class SmoothStreamingChunkSource implements ChunkSource {
extractorWrappers
.
put
(
trackIndex
,
new
ChunkExtractorWrapper
(
extractor
));
extractorWrappers
.
put
(
trackIndex
,
new
ChunkExtractorWrapper
(
extractor
));
mediaFormats
.
put
(
trackIndex
,
mediaFormat
);
mediaFormats
.
put
(
trackIndex
,
mediaFormat
);
}
}
this
.
maxHeight
=
maxHeight
;
this
.
maxWidth
=
maxWidth
;
this
.
maxWidth
=
maxWidth
;
this
.
maxHeight
=
maxHeight
;
Arrays
.
sort
(
formats
,
new
DecreasingBandwidthComparator
());
Arrays
.
sort
(
formats
,
new
DecreasingBandwidthComparator
());
}
}
...
@@ -194,6 +194,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
...
@@ -194,6 +194,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
@Override
@Override
public
void
enable
()
{
public
void
enable
()
{
fatalError
=
null
;
fatalError
=
null
;
formatEvaluator
.
enable
();
if
(
manifestFetcher
!=
null
)
{
if
(
manifestFetcher
!=
null
)
{
manifestFetcher
.
enable
();
manifestFetcher
.
enable
();
}
}
...
@@ -201,6 +202,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
...
@@ -201,6 +202,7 @@ public class SmoothStreamingChunkSource implements ChunkSource {
@Override
@Override
public
void
disable
(
List
<?
extends
MediaChunk
>
queue
)
{
public
void
disable
(
List
<?
extends
MediaChunk
>
queue
)
{
formatEvaluator
.
disable
();
if
(
manifestFetcher
!=
null
)
{
if
(
manifestFetcher
!=
null
)
{
manifestFetcher
.
disable
();
manifestFetcher
.
disable
();
}
}
...
@@ -248,14 +250,13 @@ public class SmoothStreamingChunkSource implements ChunkSource {
...
@@ -248,14 +250,13 @@ public class SmoothStreamingChunkSource implements ChunkSource {
out
.
chunk
=
null
;
out
.
chunk
=
null
;
return
;
return
;
}
else
if
(
out
.
queueSize
==
queue
.
size
()
&&
out
.
chunk
!=
null
}
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
// 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
;
return
;
}
}
// In all cases where we return before instantiating a new chunk at the bottom of this method,
// In all cases where we return before instantiating a new chunk, we want out.chunk to be null.
// we want out.chunk to be null.
out
.
chunk
=
null
;
out
.
chunk
=
null
;
StreamElement
streamElement
=
getElement
(
currentManifest
);
StreamElement
streamElement
=
getElement
(
currentManifest
);
...
@@ -290,7 +291,9 @@ public class SmoothStreamingChunkSource implements ChunkSource {
...
@@ -290,7 +291,9 @@ public class SmoothStreamingChunkSource implements ChunkSource {
// but continue to return the final chunk.
// but continue to return the final chunk.
finishedCurrentManifest
=
true
;
finishedCurrentManifest
=
true
;
}
}
}
else
if
(
chunkIndex
==
-
1
)
{
}
if
(
chunkIndex
==
-
1
)
{
// We've reached the end of the stream.
// We've reached the end of the stream.
return
;
return
;
}
}
...
...
library/src/main/java/com/google/android/exoplayer/text/eia608/Eia608TrackRenderer.java
View file @
ac54b4f6
...
@@ -230,8 +230,11 @@ public class Eia608TrackRenderer extends TrackRenderer implements Callback {
...
@@ -230,8 +230,11 @@ public class Eia608TrackRenderer extends TrackRenderer implements Callback {
}
}
private
void
invokeRendererInternal
(
String
cueText
)
{
private
void
invokeRendererInternal
(
String
cueText
)
{
Cue
cue
=
new
Cue
(
cueText
);
if
(
cueText
==
null
)
{
textRenderer
.
onCues
(
Collections
.
singletonList
(
cue
));
textRenderer
.
onCues
(
Collections
.<
Cue
>
emptyList
());
}
else
{
textRenderer
.
onCues
(
Collections
.
singletonList
(
new
Cue
(
cueText
)));
}
}
}
private
void
maybeParsePendingSample
()
{
private
void
maybeParsePendingSample
()
{
...
...
library/src/main/java/com/google/android/exoplayer/upstream/cache/CacheSpan.java
View file @
ac54b4f6
...
@@ -92,7 +92,8 @@ public final class CacheSpan implements Comparable<CacheSpan> {
...
@@ -92,7 +92,8 @@ public final class CacheSpan implements Comparable<CacheSpan> {
return
new
CacheSpan
(
key
,
position
,
file
.
length
(),
true
,
lastAccessTimestamp
,
file
);
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
)
{
long
lastAccessTimestamp
,
File
file
)
{
this
.
key
=
key
;
this
.
key
=
key
;
this
.
position
=
position
;
this
.
position
=
position
;
...
...
library/src/test/.classpath
View file @
ac54b4f6
...
@@ -5,6 +5,5 @@
...
@@ -5,6 +5,5 @@
<classpathentry
kind=
"con"
path=
"com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"
/>
<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.LIBRARIES"
/>
<classpathentry
exported=
"true"
kind=
"con"
path=
"com.android.ide.eclipse.adt.DEPENDENCIES"
/>
<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"
/>
<classpathentry
kind=
"output"
path=
"bin/classes"
/>
</classpath>
</classpath>
library/src/test/AndroidManifest.xml
View file @
ac54b4f6
...
@@ -15,16 +15,19 @@
...
@@ -15,16 +15,19 @@
-->
-->
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
package=
"com.google.android.exoplayer.tests"
>
package=
"com.google.android.exoplayer.tests"
>
<uses-sdk
android:minSdkVersion=
"9"
android:targetSdkVersion=
"22"
/>
<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"
/>
<uses-library
android:name=
"android.test.runner"
/>
</application>
</application>
<instrumentation
<instrumentation
android:targetPackage=
"com.google.android.exoplayer.
demo
"
android:targetPackage=
"com.google.android.exoplayer.
tests
"
android:name=
"android.test.InstrumentationTestRunner"
/>
android:name=
"android.test.InstrumentationTestRunner"
/>
</manifest>
</manifest>
library/src/test/java/com/google/android/exoplayer/text/webvtt/WebvttSubtitleTest.java
View file @
ac54b4f6
...
@@ -54,7 +54,6 @@ public class WebvttSubtitleTest extends TestCase {
...
@@ -54,7 +54,6 @@ public class WebvttSubtitleTest extends TestCase {
}
}
private
WebvttSubtitle
overlappingSubtitle
=
new
WebvttSubtitle
(
overlappingSubtitleCues
,
0
);
private
WebvttSubtitle
overlappingSubtitle
=
new
WebvttSubtitle
(
overlappingSubtitleCues
,
0
);
@SuppressWarnings
(
"unused"
)
private
ArrayList
<
WebvttCue
>
nestedSubtitleCues
=
new
ArrayList
<>();
private
ArrayList
<
WebvttCue
>
nestedSubtitleCues
=
new
ArrayList
<>();
{
{
WebvttCue
firstCue
=
new
WebvttCue
(
1000000
,
4000000
,
FIRST_SUBTITLE_STRING
);
WebvttCue
firstCue
=
new
WebvttCue
(
1000000
,
4000000
,
FIRST_SUBTITLE_STRING
);
...
...
library/src/test/project.properties
View file @
ac54b4f6
...
@@ -12,3 +12,4 @@
...
@@ -12,3 +12,4 @@
# Project target.
# Project target.
target
=
android-22
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