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
b6f4fbb7
authored
Apr 28, 2021
by
bachinger
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove AutoClosable implementation of PlayerCommandQueue
PiperOrigin-RevId: 370875532
parent
b336df3e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
20 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/PlayerCommandQueue.java
View file @
b6f4fbb7
...
@@ -39,7 +39,7 @@ import java.util.List;
...
@@ -39,7 +39,7 @@ import java.util.List;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.Callable
;
/** Manages the queue of player actions and handles running them one by one. */
/** Manages the queue of player actions and handles running them one by one. */
/* package */
class
PlayerCommandQueue
implements
AutoCloseable
{
/* package */
class
PlayerCommandQueue
{
private
static
final
String
TAG
=
"PlayerCommandQueue"
;
private
static
final
String
TAG
=
"PlayerCommandQueue"
;
private
static
final
boolean
DEBUG
=
false
;
private
static
final
boolean
DEBUG
=
false
;
...
@@ -141,9 +141,6 @@ import java.util.concurrent.Callable;
...
@@ -141,9 +141,6 @@ import java.util.concurrent.Callable;
@GuardedBy
(
"lock"
)
@GuardedBy
(
"lock"
)
private
final
Deque
<
PlayerCommand
>
pendingPlayerCommandQueue
;
private
final
Deque
<
PlayerCommand
>
pendingPlayerCommandQueue
;
@GuardedBy
(
"lock"
)
private
boolean
closed
;
// Should be only used on the handler.
// Should be only used on the handler.
@Nullable
private
AsyncPlayerCommandResult
pendingAsyncPlayerCommandResult
;
@Nullable
private
AsyncPlayerCommandResult
pendingAsyncPlayerCommandResult
;
...
@@ -154,17 +151,6 @@ import java.util.concurrent.Callable;
...
@@ -154,17 +151,6 @@ import java.util.concurrent.Callable;
pendingPlayerCommandQueue
=
new
ArrayDeque
<>();
pendingPlayerCommandQueue
=
new
ArrayDeque
<>();
}
}
@Override
public
void
close
()
{
synchronized
(
lock
)
{
if
(
closed
)
{
return
;
}
closed
=
true
;
}
reset
();
}
public
void
reset
()
{
public
void
reset
()
{
handler
.
removeCallbacksAndMessages
(
/* token= */
null
);
handler
.
removeCallbacksAndMessages
(
/* token= */
null
);
List
<
PlayerCommand
>
queue
;
List
<
PlayerCommand
>
queue
;
...
@@ -187,11 +173,6 @@ import java.util.concurrent.Callable;
...
@@ -187,11 +173,6 @@ import java.util.concurrent.Callable;
@CommandCode
int
commandCode
,
Callable
<
Boolean
>
command
,
@Nullable
Object
tag
)
{
@CommandCode
int
commandCode
,
Callable
<
Boolean
>
command
,
@Nullable
Object
tag
)
{
SettableFuture
<
PlayerResult
>
result
=
SettableFuture
.
create
();
SettableFuture
<
PlayerResult
>
result
=
SettableFuture
.
create
();
synchronized
(
lock
)
{
synchronized
(
lock
)
{
if
(
closed
)
{
// OK to set result with lock hold because developers cannot add listener here.
result
.
set
(
new
PlayerResult
(
PlayerResult
.
RESULT_ERROR_INVALID_STATE
,
/* item= */
null
));
return
result
;
}
PlayerCommand
playerCommand
=
new
PlayerCommand
(
commandCode
,
command
,
result
,
tag
);
PlayerCommand
playerCommand
=
new
PlayerCommand
(
commandCode
,
command
,
result
,
tag
);
result
.
addListener
(
result
.
addListener
(
()
->
{
()
->
{
...
...
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