ExoPlayer
ExoPlayer copied to clipboard
fix ProgressiveDownloader infinite loop
We could get an infinite loop inside the ProgressiveDownloader as downloadRunnable(RunnableFutureTask) could cache the PriorityTooLowException and then we would loop forever until the ProgressiveDownloader would be cancelled.
Detailed explanation: Thread 1 - ProgressiveDownloader working thread Thread 2 - ExoPlayerImpl working thread
- ProgressiveDownloader adds C.PRIORITY_DOWNLOAD (Thread 1)
- ProgressiveDownloader proceeds with C.PRIORITY_DOWNLOAD (Thread 1)
- ExoPlayerImpl add C.PRIORITY_PLAYBACK (Thread 2)
- ProgressiveDownloader using PriorityDataSource trying proceedOrThrow and receives an PriorityTooLowException
- RunnableFutureTask caches the PriorityTooLowException
- ExoPlayerImpl removes C.PRIORITY_PLAYBACK
- infinite loop as RunnableFutureTask on get check the cached error state.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Thanks for reporting! We interestingly already fixed a similar issue in https://github.com/roblav96/ExoPlayer/commit/18f7d85c91996c0b6109b2bdec6f8e5ed7a50e44, but only for external retry loops that call the download method again. The internal loop after a PriorityTooLowException has the same problem of course and needs to be fixed as well.