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
84e13e3b
authored
Jul 22, 2020
by
ibaker
Committed by
Oliver Woodman
Jul 24, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Replace media2 SettableFuture with Guava version
PiperOrigin-RevId: 322530026
parent
3191afe8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
92 deletions
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/SessionPlayerConnector.java
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/SettableFuture.java
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/PlayerCommandQueue.java
View file @
84e13e3b
...
@@ -24,6 +24,7 @@ import androidx.media2.common.SessionPlayer;
...
@@ -24,6 +24,7 @@ import androidx.media2.common.SessionPlayer;
import
androidx.media2.common.SessionPlayer.PlayerResult
;
import
androidx.media2.common.SessionPlayer.PlayerResult
;
import
com.google.android.exoplayer2.util.Log
;
import
com.google.android.exoplayer2.util.Log
;
import
com.google.common.util.concurrent.ListenableFuture
;
import
com.google.common.util.concurrent.ListenableFuture
;
import
com.google.common.util.concurrent.SettableFuture
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.RetentionPolicy
;
...
...
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/SessionPlayerConnector.java
View file @
84e13e3b
...
@@ -35,6 +35,7 @@ import com.google.android.exoplayer2.PlaybackPreparer;
...
@@ -35,6 +35,7 @@ import com.google.android.exoplayer2.PlaybackPreparer;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.Player
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.common.util.concurrent.ListenableFuture
;
import
com.google.common.util.concurrent.ListenableFuture
;
import
com.google.common.util.concurrent.SettableFuture
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
...
extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/SettableFuture.java
deleted
100644 → 0
View file @
3191afe8
/*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
google
.
android
.
exoplayer2
.
ext
.
media2
;
import
androidx.concurrent.futures.CallbackToFutureAdapter
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.common.util.concurrent.ListenableFuture
;
import
java.util.concurrent.ExecutionException
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeoutException
;
import
java.util.concurrent.atomic.AtomicReference
;
/**
* A replacement of com.google.common.util.concurrent.SettableFuture with CallbackToFutureAdapter to
* avoid the dependency on Guava.
*/
@SuppressWarnings
(
"ShouldNotSubclass"
)
/* package */
class
SettableFuture
<
V
>
implements
ListenableFuture
<
V
>
{
static
<
V
>
SettableFuture
<
V
>
create
()
{
return
new
SettableFuture
<>();
}
private
final
ListenableFuture
<
V
>
future
;
private
final
CallbackToFutureAdapter
.
Completer
<
V
>
completer
;
SettableFuture
()
{
AtomicReference
<
CallbackToFutureAdapter
.
Completer
<
V
>>
completerRef
=
new
AtomicReference
<>();
future
=
CallbackToFutureAdapter
.
getFuture
(
completer
->
{
completerRef
.
set
(
completer
);
return
null
;
});
completer
=
Assertions
.
checkNotNull
(
completerRef
.
get
());
}
@Override
public
void
addListener
(
Runnable
listener
,
Executor
executor
)
{
Assertions
.
checkNotNull
(
listener
);
Assertions
.
checkNotNull
(
executor
);
future
.
addListener
(
listener
,
executor
);
}
@Override
public
boolean
cancel
(
boolean
mayInterruptIfRunning
)
{
return
future
.
cancel
(
mayInterruptIfRunning
);
}
@Override
public
boolean
isCancelled
()
{
return
future
.
isCancelled
();
}
@Override
public
boolean
isDone
()
{
return
future
.
isDone
();
}
@Override
public
V
get
()
throws
ExecutionException
,
InterruptedException
{
return
future
.
get
();
}
@Override
public
V
get
(
long
timeout
,
TimeUnit
unit
)
throws
ExecutionException
,
InterruptedException
,
TimeoutException
{
return
future
.
get
(
timeout
,
unit
);
}
void
set
(
V
value
)
{
completer
.
set
(
value
);
}
void
setException
(
Throwable
throwable
)
{
completer
.
setException
(
throwable
);
}
}
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