media/extensions
yschimke 0f502b2a0e Workaround for OkHttp Interrupt issues.
Relates to https://github.com/square/okhttp/issues/3146. This was from https://github.com/androidx/media/pull/71.

There is a draft PR https://github.com/square/okhttp/pull/7185/files which documents OkHttp's ideal handling of cancellation including interrupts.

But a few key points

1) This is a target state, and OkHttp does not currently handle interrupts correctly.  In the past this has been identified, and the advice is to avoid interrupts on Http threads, see discussion on https://github.com/square/okhttp/issues/1902. Also an attempt at a fix here https://github.com/square/okhttp/pull/7023 which wasn't in a form to land.

2) Even with this fixed, it is likely to never be optimal, because of OkHttp sharing a socket connection for multiple inflight requests.

From https://github.com/square/okhttp/pull/7185

```
Thread.interrupt() is Clumsy
----------------------------

`Thread.interrupt()` is Java's built-in mechanism to cancel an in-flight `Thread`, regardless of
what work it's currently performing.

We recommend against using `Thread.interrupt()` with OkHttp because it may disrupt shared resources
including HTTP/2 connections and cache files. In particular, calling `Thread.interrupt()` may cause
unrelated threads' call to fail with an `IOException`.
```

This PR leaves the Loader/DataSource thread parked on a countdown latch, while this may seem wasteful and an additional context switch. However in practice the response isn't returned until the Http2Connection and Http2Reader have a response from the server and these means effectively parking in a `wait()` statement here 9e039e9412/okhttp/src/jvmMain/kotlin/okhttp3/internal/http2/Http2Stream.kt (L140)

PiperOrigin-RevId: 446652468
2022-05-05 09:15:06 +01:00
..
av1 Make sure native library loads use correct class loader 2022-02-17 15:06:12 +00:00
cast Rename Player.COMMAND_GET_TRACK_INFOS to COMMAND_GET_TRACKS 2022-04-26 15:34:35 +01:00
cronet Remove references to deprecated DefaultDataSourceFactory from dev guide 2022-03-24 15:13:09 +00:00
ffmpeg Force CMake version 3.21.0+ for the FFMPEG extension 2022-03-15 00:49:09 +00:00
flac Make sure native library loads use correct class loader 2022-02-17 15:06:12 +00:00
ima Misc fix on parameter comment 2022-05-03 14:48:16 +01:00
leanback Fixes for some minor misc issues 2021-11-15 10:58:32 +00:00
media2 Mark all non-public IntDefs as only TYPE_USE 2022-02-04 15:07:19 +00:00
mediasession Fix the position of IntDefs to match TYPE_USE 2022-02-08 12:34:06 +00:00
okhttp Workaround for OkHttp Interrupt issues. 2022-05-05 09:15:06 +01:00
opus Libopus Support For WebM DiscardPadding 2022-02-18 15:03:02 +00:00
rtmp Remove references to deprecated DefaultDataSourceFactory from dev guide 2022-03-24 15:13:09 +00:00
vp9 Make sure native library loads use correct class loader 2022-02-17 15:06:12 +00:00
workmanager Reformat some javadoc 2022-02-18 15:02:33 +00:00
README.md Tweak and add READMEs + remove refs to V1 2017-08-17 22:59:34 +01:00

ExoPlayer extensions

ExoPlayer extensions are modules that depend on external libraries to provide additional functionality. Browse the individual extensions and their READMEs to learn more.