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
c4808182
authored
Apr 30, 2019
by
tonihei
Committed by
Oliver Woodman
Apr 30, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix some random AndroidStudio warnings.
PiperOrigin-RevId: 245956915
parent
0bb32a8f
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
83 additions
and
124 deletions
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueNavigator.java
library/core/src/main/java/com/google/android/exoplayer2/C.java
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
library/core/src/main/java/com/google/android/exoplayer2/analytics/DefaultPlaybackSessionManager.java
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java
library/core/src/main/java/com/google/android/exoplayer2/drm/DrmInitData.java
library/core/src/main/java/com/google/android/exoplayer2/drm/OfflineLicenseHelper.java
library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/VorbisUtil.java
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecUtil.java
library/core/src/main/java/com/google/android/exoplayer2/metadata/MetadataRenderer.java
library/core/src/main/java/com/google/android/exoplayer2/trackselection/MappingTrackSelector.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultBandwidthMeter.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSink.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java
library/core/src/test/java/com/google/android/exoplayer2/offline/ActionFileUpgradeUtilTest.java
library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java
library/core/src/test/java/com/google/android/exoplayer2/trackselection/AdaptiveTrackSelectionTest.java
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/SimpleCacheTest.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaPeriod.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SphericalSurfaceView.java
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/CacheAsserts.java
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/MediaPeriodAsserts.java
demos/main/src/main/java/com/google/android/exoplayer2/demo/DownloadTracker.java
View file @
c4808182
...
...
@@ -82,7 +82,6 @@ public class DownloadTracker {
return
download
!=
null
&&
download
.
state
!=
Download
.
STATE_FAILED
;
}
@SuppressWarnings
(
"unchecked"
)
public
DownloadRequest
getDownloadRequest
(
Uri
uri
)
{
Download
download
=
downloads
.
get
(
uri
);
return
download
!=
null
&&
download
.
state
!=
Download
.
STATE_FAILED
?
download
.
request
:
null
;
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java
View file @
c4808182
...
...
@@ -952,8 +952,7 @@ public final class MediaSessionConnector {
}
if
(
description
.
getMediaId
()
!=
null
)
{
builder
.
putString
(
MediaMetadataCompat
.
METADATA_KEY_MEDIA_ID
,
String
.
valueOf
(
description
.
getMediaId
()));
MediaMetadataCompat
.
METADATA_KEY_MEDIA_ID
,
description
.
getMediaId
());
}
if
(
description
.
getMediaUri
()
!=
null
)
{
builder
.
putString
(
...
...
extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/TimelineQueueNavigator.java
View file @
c4808182
...
...
@@ -80,7 +80,7 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
* <p>Often artworks and icons need to be loaded asynchronously. In such a case, return a {@link
* MediaDescriptionCompat} without the images, load your images asynchronously off the main thread
* and then call {@link MediaSessionConnector#invalidateMediaSessionQueue()} to make the connector
* update the queue by calling
{@link #getMediaDescription(Player, int)}
again.
* update the queue by calling
this method
again.
*
* @param player The current player.
* @param windowIndex The timeline window index for which to provide a description.
...
...
library/core/src/main/java/com/google/android/exoplayer2/C.java
View file @
c4808182
...
...
@@ -494,7 +494,6 @@ public final class C {
/** Indicates that a buffer is (at least partially) encrypted. */
public
static
final
int
BUFFER_FLAG_ENCRYPTED
=
1
<<
30
;
// 0x40000000
/** Indicates that a buffer should be decoded but not rendered. */
@SuppressWarnings
(
"NumericOverflow"
)
public
static
final
int
BUFFER_FLAG_DECODE_ONLY
=
1
<<
31
;
// 0x80000000
/**
...
...
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
View file @
c4808182
...
...
@@ -302,7 +302,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
// Handler.Callback implementation.
@SuppressWarnings
(
"unchecked"
)
@Override
public
boolean
handleMessage
(
Message
msg
)
{
try
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/analytics/DefaultPlaybackSessionManager.java
View file @
c4808182
...
...
@@ -253,13 +253,11 @@ public final class DefaultPlaybackSessionManager implements PlaybackSessionManag
if
(
windowIndex
==
C
.
INDEX_UNSET
)
{
return
false
;
}
if
(
adMediaPeriodId
!=
null
)
{
int
newPeriodIndex
=
newTimeline
.
getIndexOfPeriod
(
adMediaPeriodId
.
periodUid
);
if
(
newPeriodIndex
==
C
.
INDEX_UNSET
)
{
return
false
;
}
if
(
adMediaPeriodId
==
null
)
{
return
true
;
}
return
true
;
int
newPeriodIndex
=
newTimeline
.
getIndexOfPeriod
(
adMediaPeriodId
.
periodUid
);
return
newPeriodIndex
!=
C
.
INDEX_UNSET
;
}
public
boolean
belongsToSession
(
...
...
library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java
View file @
c4808182
...
...
@@ -1218,7 +1218,6 @@ public final class DefaultAudioSink implements AudioSink {
audioTrack
.
setVolume
(
volume
);
}
@SuppressWarnings
(
"deprecation"
)
private
static
void
setVolumeInternalV3
(
AudioTrack
audioTrack
,
float
volume
)
{
audioTrack
.
setStereoVolume
(
volume
,
volume
);
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/DefaultDrmSession.java
View file @
c4808182
...
...
@@ -500,7 +500,6 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
@Override
@SuppressWarnings
(
"unchecked"
)
public
void
handleMessage
(
Message
msg
)
{
Object
request
=
msg
.
obj
;
Object
response
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/DrmInitData.java
View file @
c4808182
...
...
@@ -428,7 +428,6 @@ public final class DrmInitData implements Comparator<SchemeData>, Parcelable {
dest
.
writeByte
((
byte
)
(
requiresSecureDecryption
?
1
:
0
));
}
@SuppressWarnings
(
"hiding"
)
public
static
final
Parcelable
.
Creator
<
SchemeData
>
CREATOR
=
new
Parcelable
.
Creator
<
SchemeData
>()
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/OfflineLicenseHelper.java
View file @
c4808182
...
...
@@ -92,7 +92,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
* @throws UnsupportedDrmException If the Widevine DRM scheme is unsupported or cannot be
* instantiated.
* @see DefaultDrmSessionManager#DefaultDrmSessionManager(java.util.UUID, ExoMediaDrm,
* MediaDrmCallback, HashMap
, Handler, DefaultDrmSessionEventListener
)
* MediaDrmCallback, HashMap)
*/
public
static
OfflineLicenseHelper
<
FrameworkMediaCrypto
>
newWidevineInstance
(
String
defaultLicenseUrl
,
...
...
@@ -115,7 +115,7 @@ public final class OfflineLicenseHelper<T extends ExoMediaCrypto> {
* @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument
* to {@link MediaDrm#getKeyRequest(byte[], byte[], String, int, HashMap)}. May be null.
* @see DefaultDrmSessionManager#DefaultDrmSessionManager(java.util.UUID, ExoMediaDrm,
* MediaDrmCallback, HashMap
, Handler, DefaultDrmSessionEventListener
)
* MediaDrmCallback, HashMap)
*/
public
OfflineLicenseHelper
(
UUID
uuid
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/extractor/ogg/VorbisUtil.java
View file @
c4808182
...
...
@@ -218,40 +218,38 @@ import java.util.Arrays;
int
mappingsCount
=
bitArray
.
readBits
(
6
)
+
1
;
for
(
int
i
=
0
;
i
<
mappingsCount
;
i
++)
{
int
mappingType
=
bitArray
.
readBits
(
16
);
switch
(
mappingType
)
{
case
0
:
int
submaps
;
if
(
bitArray
.
readBit
())
{
submaps
=
bitArray
.
readBits
(
4
)
+
1
;
}
else
{
submaps
=
1
;
}
int
couplingSteps
;
if
(
bitArray
.
readBit
())
{
couplingSteps
=
bitArray
.
readBits
(
8
)
+
1
;
for
(
int
j
=
0
;
j
<
couplingSteps
;
j
++)
{
bitArray
.
skipBits
(
iLog
(
channels
-
1
));
// magnitude
bitArray
.
skipBits
(
iLog
(
channels
-
1
));
// angle
}
}
/*else {
couplingSteps = 0;
}*/
if
(
bitArray
.
readBits
(
2
)
!=
0x00
)
{
throw
new
ParserException
(
"to reserved bits must be zero after mapping coupling steps"
);
}
if
(
submaps
>
1
)
{
for
(
int
j
=
0
;
j
<
channels
;
j
++)
{
bitArray
.
skipBits
(
4
);
// mappingMux
}
}
for
(
int
j
=
0
;
j
<
submaps
;
j
++)
{
bitArray
.
skipBits
(
8
);
// discard
bitArray
.
skipBits
(
8
);
// submapFloor
bitArray
.
skipBits
(
8
);
// submapResidue
}
break
;
default
:
Log
.
e
(
TAG
,
"mapping type other than 0 not supported: "
+
mappingType
);
if
(
mappingType
!=
0
)
{
Log
.
e
(
TAG
,
"mapping type other than 0 not supported: "
+
mappingType
);
continue
;
}
int
submaps
;
if
(
bitArray
.
readBit
())
{
submaps
=
bitArray
.
readBits
(
4
)
+
1
;
}
else
{
submaps
=
1
;
}
int
couplingSteps
;
if
(
bitArray
.
readBit
())
{
couplingSteps
=
bitArray
.
readBits
(
8
)
+
1
;
for
(
int
j
=
0
;
j
<
couplingSteps
;
j
++)
{
bitArray
.
skipBits
(
iLog
(
channels
-
1
));
// magnitude
bitArray
.
skipBits
(
iLog
(
channels
-
1
));
// angle
}
}
/*else {
couplingSteps = 0;
}*/
if
(
bitArray
.
readBits
(
2
)
!=
0x00
)
{
throw
new
ParserException
(
"to reserved bits must be zero after mapping coupling steps"
);
}
if
(
submaps
>
1
)
{
for
(
int
j
=
0
;
j
<
channels
;
j
++)
{
bitArray
.
skipBits
(
4
);
// mappingMux
}
}
for
(
int
j
=
0
;
j
<
submaps
;
j
++)
{
bitArray
.
skipBits
(
8
);
// discard
bitArray
.
skipBits
(
8
);
// submapFloor
bitArray
.
skipBits
(
8
);
// submapResidue
}
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecUtil.java
View file @
c4808182
...
...
@@ -827,7 +827,6 @@ public final class MediaCodecUtil {
}
@SuppressWarnings
(
"deprecation"
)
private
static
final
class
MediaCodecListCompatV16
implements
MediaCodecListCompat
{
@Override
...
...
library/core/src/main/java/com/google/android/exoplayer2/metadata/MetadataRenderer.java
View file @
c4808182
...
...
@@ -177,7 +177,6 @@ public final class MetadataRenderer extends BaseRenderer implements Callback {
pendingMetadataCount
=
0
;
}
@SuppressWarnings
(
"unchecked"
)
@Override
public
boolean
handleMessage
(
Message
msg
)
{
switch
(
msg
.
what
)
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/trackselection/MappingTrackSelector.java
View file @
c4808182
...
...
@@ -156,10 +156,10 @@ public abstract class MappingTrackSelector extends TrackSelector {
public
@RendererSupport
int
getRendererSupport
(
int
rendererIndex
)
{
int
bestRendererSupport
=
RENDERER_SUPPORT_NO_TRACKS
;
int
[][]
rendererFormatSupport
=
rendererFormatSupports
[
rendererIndex
];
for
(
int
i
=
0
;
i
<
rendererFormatSupport
.
length
;
i
++
)
{
for
(
int
j
=
0
;
j
<
rendererFormatSupport
[
i
].
length
;
j
++
)
{
for
(
int
[]
trackGroupFormatSupport
:
rendererFormatSupport
)
{
for
(
int
trackFormatSupport
:
trackGroupFormatSupport
)
{
int
trackRendererSupport
;
switch
(
rendererFormatSupport
[
i
][
j
]
&
RendererCapabilities
.
FORMAT_SUPPORT_MASK
)
{
switch
(
trackFormatSupport
&
RendererCapabilities
.
FORMAT_SUPPORT_MASK
)
{
case
RendererCapabilities
.
FORMAT_HANDLED
:
return
RENDERER_SUPPORT_PLAYABLE_TRACKS
;
case
RendererCapabilities
.
FORMAT_EXCEEDS_CAPABILITIES
:
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DefaultBandwidthMeter.java
View file @
c4808182
...
...
@@ -342,7 +342,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
totalElapsedTimeMs
+=
sampleElapsedTimeMs
;
totalBytesTransferred
+=
sampleBytesTransferred
;
if
(
sampleElapsedTimeMs
>
0
)
{
float
bitsPerSecond
=
(
sampleBytesTransferred
*
8000
)
/
sampleElapsedTimeMs
;
float
bitsPerSecond
=
(
sampleBytesTransferred
*
8000
f
)
/
sampleElapsedTimeMs
;
slidingPercentile
.
addSample
((
int
)
Math
.
sqrt
(
sampleBytesTransferred
),
bitsPerSecond
);
if
(
totalElapsedTimeMs
>=
ELAPSED_MILLIS_FOR_ESTIMATE
||
totalBytesTransferred
>=
BYTES_TRANSFERRED_FOR_ESTIMATE
)
{
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CacheDataSink.java
View file @
c4808182
...
...
@@ -199,7 +199,6 @@ public final class CacheDataSink implements DataSink {
outputStreamBytesWritten
=
0
;
}
@SuppressWarnings
(
"ThrowFromFinallyBlock"
)
private
void
closeCurrentOutputStream
()
throws
IOException
{
if
(
outputStream
==
null
)
{
return
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java
View file @
c4808182
...
...
@@ -94,7 +94,7 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
@Nullable
private
Storage
previousStorage
;
/** Returns whether the file is an index file. */
public
static
final
boolean
isIndexFile
(
String
fileName
)
{
public
static
boolean
isIndexFile
(
String
fileName
)
{
// Atomic file backups add additional suffixes to the file name.
return
fileName
.
startsWith
(
FILE_NAME_ATOMIC
);
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java
View file @
c4808182
...
...
@@ -780,7 +780,6 @@ public final class SimpleCache implements Cache {
*
* @param files The files belonging to the root directory.
* @return The loaded UID, or {@link #UID_UNSET} if a UID has not yet been created.
* @throws IOException If there is an error loading or generating the UID.
*/
private
static
long
loadUid
(
File
[]
files
)
{
for
(
File
file
:
files
)
{
...
...
library/core/src/test/java/com/google/android/exoplayer2/offline/ActionFileUpgradeUtilTest.java
View file @
c4808182
...
...
@@ -198,7 +198,6 @@ public class ActionFileUpgradeUtilTest {
assertThat
(
download
.
state
).
isEqualTo
(
state
);
}
@SuppressWarnings
(
"unchecked"
)
private
static
List
<
StreamKey
>
asList
(
StreamKey
...
streamKeys
)
{
return
Arrays
.
asList
(
streamKeys
);
}
...
...
library/core/src/test/java/com/google/android/exoplayer2/offline/DownloadManagerTest.java
View file @
c4808182
...
...
@@ -763,15 +763,10 @@ public class DownloadManagerTest {
private
void
block
()
throws
InterruptedException
{
try
{
while
(
true
)
{
try
{
blocker
.
block
();
break
;
}
catch
(
InterruptedException
e
)
{
interrupted
=
true
;
throw
e
;
}
}
blocker
.
block
();
}
catch
(
InterruptedException
e
)
{
interrupted
=
true
;
throw
e
;
}
finally
{
blocker
.
close
();
}
...
...
library/core/src/test/java/com/google/android/exoplayer2/trackselection/AdaptiveTrackSelectionTest.java
View file @
c4808182
...
...
@@ -266,14 +266,9 @@ public final class AdaptiveTrackSelectionTest {
/* mediaChunkIterators= */
THREE_EMPTY_MEDIA_CHUNK_ITERATORS
);
ArgumentMatcher
<
Format
[]>
matcher
=
new
ArgumentMatcher
<
Format
[]>()
{
@Override
public
boolean
matches
(
Format
[]
argument
)
{
Format
[]
formats
=
(
Format
[])
argument
;
return
formats
.
length
==
3
formats
->
formats
.
length
==
3
&&
Arrays
.
asList
(
formats
).
containsAll
(
Arrays
.
asList
(
format1
,
format2
,
format3
));
}
};
verify
(
estimator
)
.
getBitrates
(
argThat
(
matcher
),
...
...
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/SimpleCacheTest.java
View file @
c4808182
...
...
@@ -401,11 +401,8 @@ public class SimpleCacheTest {
private
static
void
addCache
(
SimpleCache
simpleCache
,
String
key
,
int
position
,
int
length
)
throws
IOException
{
File
file
=
simpleCache
.
startFile
(
key
,
position
,
length
);
FileOutputStream
fos
=
new
FileOutputStream
(
file
);
try
{
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
file
))
{
fos
.
write
(
generateData
(
key
,
position
,
length
));
}
finally
{
fos
.
close
();
}
simpleCache
.
commitFile
(
file
,
length
);
}
...
...
@@ -413,11 +410,8 @@ public class SimpleCacheTest {
private
static
void
assertCachedDataReadCorrect
(
CacheSpan
cacheSpan
)
throws
IOException
{
assertThat
(
cacheSpan
.
isCached
).
isTrue
();
byte
[]
expected
=
generateData
(
cacheSpan
.
key
,
(
int
)
cacheSpan
.
position
,
(
int
)
cacheSpan
.
length
);
FileInputStream
inputStream
=
new
FileInputStream
(
cacheSpan
.
file
);
try
{
try
(
FileInputStream
inputStream
=
new
FileInputStream
(
cacheSpan
.
file
))
{
assertThat
(
toByteArray
(
inputStream
)).
isEqualTo
(
expected
);
}
finally
{
inputStream
.
close
();
}
}
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaPeriod.java
View file @
c4808182
...
...
@@ -219,9 +219,8 @@ import java.util.regex.Pattern;
int
totalTracksInPreviousAdaptationSets
=
0
;
int
tracksInCurrentAdaptationSet
=
manifestAdaptationSets
.
get
(
adaptationSetIndices
[
0
]).
representations
.
size
();
for
(
int
i
=
0
;
i
<
trackIndices
.
length
;
i
++)
{
while
(
trackIndices
[
i
]
>=
totalTracksInPreviousAdaptationSets
+
tracksInCurrentAdaptationSet
)
{
for
(
int
trackIndex
:
trackIndices
)
{
while
(
trackIndex
>=
totalTracksInPreviousAdaptationSets
+
tracksInCurrentAdaptationSet
)
{
currentAdaptationSetIndex
++;
totalTracksInPreviousAdaptationSets
+=
tracksInCurrentAdaptationSet
;
tracksInCurrentAdaptationSet
=
...
...
@@ -234,7 +233,7 @@ import java.util.regex.Pattern;
new
StreamKey
(
periodIndex
,
adaptationSetIndices
[
currentAdaptationSetIndex
],
trackInd
ices
[
i
]
-
totalTracksInPreviousAdaptationSets
));
trackInd
ex
-
totalTracksInPreviousAdaptationSets
));
}
}
return
streamKeys
;
...
...
@@ -515,10 +514,9 @@ import java.util.regex.Pattern;
int
[]
adaptationSetIndices
=
new
int
[
1
+
extraAdaptationSetIds
.
length
];
adaptationSetIndices
[
0
]
=
i
;
int
outputIndex
=
1
;
for
(
int
j
=
0
;
j
<
extraAdaptationSetIds
.
length
;
j
++
)
{
for
(
String
adaptationSetId
:
extraAdaptationSetIds
)
{
int
extraIndex
=
idToIndexMap
.
get
(
Integer
.
parseInt
(
extraAdaptationSetIds
[
j
]),
/* valueIfKeyNotFound= */
-
1
);
idToIndexMap
.
get
(
Integer
.
parseInt
(
adaptationSetId
),
/* valueIfKeyNotFound= */
-
1
);
if
(
extraIndex
!=
-
1
)
{
adaptationSetUsedFlags
[
extraIndex
]
=
true
;
adaptationSetIndices
[
outputIndex
]
=
extraIndex
;
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java
View file @
c4808182
...
...
@@ -100,7 +100,7 @@ public class DashManifestParser extends DefaultHandler
long
durationMs
=
parseDuration
(
xpp
,
"mediaPresentationDuration"
,
C
.
TIME_UNSET
);
long
minBufferTimeMs
=
parseDuration
(
xpp
,
"minBufferTime"
,
C
.
TIME_UNSET
);
String
typeString
=
xpp
.
getAttributeValue
(
null
,
"type"
);
boolean
dynamic
=
typeString
!=
null
&&
"dynamic"
.
equals
(
typeString
);
boolean
dynamic
=
"dynamic"
.
equals
(
typeString
);
long
minUpdateTimeMs
=
dynamic
?
parseDuration
(
xpp
,
"minimumUpdatePeriod"
,
C
.
TIME_UNSET
)
:
C
.
TIME_UNSET
;
long
timeShiftBufferDepthMs
=
dynamic
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java
View file @
c4808182
...
...
@@ -17,7 +17,6 @@ package com.google.android.exoplayer2.ui;
import
android.annotation.SuppressLint
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.res.Resources
;
import
android.content.res.TypedArray
;
...
...
@@ -1076,8 +1075,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
* Should be called when the player is visible to the user and if {@code surface_type} is {@code
* spherical_view}. It is the counterpart to {@link #onPause()}.
*
* <p>This method should typically be called in {@
link Activity#onStart()}, or {@link
* Activity
#
onResume()} for API versions <= 23.
* <p>This method should typically be called in {@
code Activity.onStart()}, or {@code
* Activity
.
onResume()} for API versions <= 23.
*/
public
void
onResume
()
{
if
(
surfaceView
instanceof
SphericalSurfaceView
)
{
...
...
@@ -1089,8 +1088,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
* Should be called when the player is no longer visible to the user and if {@code surface_type}
* is {@code spherical_view}. It is the counterpart to {@link #onResume()}.
*
* <p>This method should typically be called in {@
link Activity#onStop()}, or {@link
* Activity
#
onPause()} for API versions <= 23.
* <p>This method should typically be called in {@
code Activity.onStop()}, or {@code
* Activity
.
onPause()} for API versions <= 23.
*/
public
void
onPause
()
{
if
(
surfaceView
instanceof
SphericalSurfaceView
)
{
...
...
@@ -1316,7 +1315,6 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
logo
.
setBackgroundColor
(
resources
.
getColor
(
R
.
color
.
exo_edit_mode_background_color
,
null
));
}
@SuppressWarnings
(
"deprecation"
)
private
static
void
configureEditModeLogo
(
Resources
resources
,
ImageView
logo
)
{
logo
.
setImageDrawable
(
resources
.
getDrawable
(
R
.
drawable
.
exo_edit_mode_logo
));
logo
.
setBackgroundColor
(
resources
.
getColor
(
R
.
color
.
exo_edit_mode_background_color
));
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/spherical/SphericalSurfaceView.java
View file @
c4808182
...
...
@@ -80,7 +80,6 @@ public final class SphericalSurfaceView extends GLSurfaceView {
private
final
SensorManager
sensorManager
;
private
final
@Nullable
Sensor
orientationSensor
;
private
final
OrientationListener
orientationListener
;
private
final
Renderer
renderer
;
private
final
Handler
mainHandler
;
private
final
TouchTracker
touchTracker
;
private
final
SceneRenderer
scene
;
...
...
@@ -114,7 +113,7 @@ public final class SphericalSurfaceView extends GLSurfaceView {
this
.
orientationSensor
=
orientationSensor
;
scene
=
new
SceneRenderer
();
renderer
=
new
Renderer
(
scene
);
Renderer
renderer
=
new
Renderer
(
scene
);
touchTracker
=
new
TouchTracker
(
context
,
renderer
,
PX_PER_DEGREES
);
WindowManager
windowManager
=
(
WindowManager
)
context
.
getSystemService
(
Context
.
WINDOW_SERVICE
);
...
...
@@ -332,7 +331,7 @@ public final class SphericalSurfaceView extends GLSurfaceView {
private
float
calculateFieldOfViewInYDirection
(
float
aspect
)
{
boolean
landscapeMode
=
aspect
>
1
;
if
(
landscapeMode
)
{
double
halfFovX
=
FIELD_OF_VIEW_DEGREES
/
2
;
double
halfFovX
=
FIELD_OF_VIEW_DEGREES
/
2
f
;
double
tanY
=
Math
.
tan
(
Math
.
toRadians
(
halfFovX
))
/
aspect
;
double
halfFovY
=
Math
.
toDegrees
(
Math
.
atan
(
tanY
));
return
(
float
)
(
halfFovY
*
2
);
...
...
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/CacheAsserts.java
View file @
c4808182
...
...
@@ -114,14 +114,11 @@ public final class CacheAsserts {
*/
public
static
void
assertReadData
(
DataSource
dataSource
,
DataSpec
dataSpec
,
byte
[]
expected
)
throws
IOException
{
DataSourceInputStream
inputStream
=
new
DataSourceInputStream
(
dataSource
,
dataSpec
);
byte
[]
bytes
=
null
;
try
{
try
(
DataSourceInputStream
inputStream
=
new
DataSourceInputStream
(
dataSource
,
dataSpec
))
{
bytes
=
Util
.
toByteArray
(
inputStream
);
}
catch
(
IOException
e
)
{
// Ignore
}
finally
{
inputStream
.
close
();
}
assertThat
(
bytes
).
isEqualTo
(
expected
);
}
...
...
testutils_robolectric/src/main/java/com/google/android/exoplayer2/testutil/MediaPeriodAsserts.java
View file @
c4808182
...
...
@@ -176,8 +176,8 @@ public final class MediaPeriodAsserts {
for
(
int
i
=
0
;
i
<
trackGroup
.
length
;
i
++)
{
allFormats
.
add
(
trackGroup
.
getFormat
(
i
));
}
for
(
int
i
=
0
;
i
<
formats
.
length
;
i
++
)
{
if
(!
allFormats
.
remove
(
format
s
[
i
]
))
{
for
(
Format
format
:
formats
)
{
if
(!
allFormats
.
remove
(
format
))
{
return
false
;
}
}
...
...
@@ -189,22 +189,21 @@ public final class MediaPeriodAsserts {
DummyMainThread
dummyMainThread
=
new
DummyMainThread
();
ConditionVariable
preparedCondition
=
new
ConditionVariable
();
dummyMainThread
.
runOnMainThread
(
()
->
{
mediaPeriod
.
prepare
(
new
Callback
()
{
@Override
public
void
onPrepared
(
MediaPeriod
mediaPeriod
)
{
trackGroupArray
.
set
(
mediaPeriod
.
getTrackGroups
());
preparedCondition
.
open
();
}
@Override
public
void
onContinueLoadingRequested
(
MediaPeriod
source
)
{
// Ignore.
}
},
/* positionUs= */
0
);
});
()
->
mediaPeriod
.
prepare
(
new
Callback
()
{
@Override
public
void
onPrepared
(
MediaPeriod
mediaPeriod
)
{
trackGroupArray
.
set
(
mediaPeriod
.
getTrackGroups
());
preparedCondition
.
open
();
}
@Override
public
void
onContinueLoadingRequested
(
MediaPeriod
source
)
{
// Ignore.
}
},
/* positionUs= */
0
));
try
{
preparedCondition
.
block
();
}
catch
(
InterruptedException
e
)
{
...
...
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