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
dec01c83
authored
Aug 30, 2022
by
a.mochalov
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix ProgressiveDownloader infinite loop doe to priority
parent
62881821
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
13 deletions
library/core/src/main/java/com/google/android/exoplayer2/offline/ProgressiveDownloader.java
library/core/src/main/java/com/google/android/exoplayer2/offline/ProgressiveDownloader.java
View file @
dec01c83
...
@@ -88,19 +88,7 @@ public final class ProgressiveDownloader implements Downloader {
...
@@ -88,19 +88,7 @@ public final class ProgressiveDownloader implements Downloader {
public
void
download
(
@Nullable
ProgressListener
progressListener
)
public
void
download
(
@Nullable
ProgressListener
progressListener
)
throws
IOException
,
InterruptedException
{
throws
IOException
,
InterruptedException
{
this
.
progressListener
=
progressListener
;
this
.
progressListener
=
progressListener
;
downloadRunnable
=
downloadRunnable
=
createDownloadTask
();
new
RunnableFutureTask
<
Void
,
IOException
>()
{
@Override
protected
Void
doWork
()
throws
IOException
{
cacheWriter
.
cache
();
return
null
;
}
@Override
protected
void
cancelWork
()
{
cacheWriter
.
cancel
();
}
};
if
(
priorityTaskManager
!=
null
)
{
if
(
priorityTaskManager
!=
null
)
{
priorityTaskManager
.
add
(
C
.
PRIORITY_DOWNLOAD
);
priorityTaskManager
.
add
(
C
.
PRIORITY_DOWNLOAD
);
...
@@ -119,6 +107,8 @@ public final class ProgressiveDownloader implements Downloader {
...
@@ -119,6 +107,8 @@ public final class ProgressiveDownloader implements Downloader {
Throwable
cause
=
Assertions
.
checkNotNull
(
e
.
getCause
());
Throwable
cause
=
Assertions
.
checkNotNull
(
e
.
getCause
());
if
(
cause
instanceof
PriorityTooLowException
)
{
if
(
cause
instanceof
PriorityTooLowException
)
{
// The next loop iteration will block until the task is able to proceed.
// The next loop iteration will block until the task is able to proceed.
// recreate downloadRunnable in order to prevent error state caching
downloadRunnable
=
createDownloadTask
();
}
else
if
(
cause
instanceof
IOException
)
{
}
else
if
(
cause
instanceof
IOException
)
{
throw
(
IOException
)
cause
;
throw
(
IOException
)
cause
;
}
else
{
}
else
{
...
@@ -161,4 +151,19 @@ public final class ProgressiveDownloader implements Downloader {
...
@@ -161,4 +151,19 @@ public final class ProgressiveDownloader implements Downloader {
:
((
bytesCached
*
100
f
)
/
contentLength
);
:
((
bytesCached
*
100
f
)
/
contentLength
);
progressListener
.
onProgress
(
contentLength
,
bytesCached
,
percentDownloaded
);
progressListener
.
onProgress
(
contentLength
,
bytesCached
,
percentDownloaded
);
}
}
private
RunnableFutureTask
<
Void
,
IOException
>
createDownloadTask
()
{
return
new
RunnableFutureTask
<
Void
,
IOException
>()
{
@Override
protected
Void
doWork
()
throws
IOException
{
cacheWriter
.
cache
();
return
null
;
}
@Override
protected
void
cancelWork
()
{
cacheWriter
.
cancel
();
}
};
}
}
}
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