20 Commits

Author SHA1 Message Date
ibaker
2deb435625 Annotate methods that always return this with @CanIgnoreReturnValue
It's always safe to ignore the result of these methods, because the
caller already has a reference to the returned value.

PiperOrigin-RevId: 462388947
2022-08-08 07:55:25 +00:00
ibaker
ac300c4a00 Add @code tags to DefaultDataSource javadoc
#minor-release

PiperOrigin-RevId: 461902089
2022-07-21 12:52:19 +00:00
ibaker
cb04297420 Remove InvalidResponseCodeException#headerFields from the stable API
Representing HTTP headers in a `java.util.Map` is error-prone, because
the names (keys) need to be case-insensitive (per
[RFC 2616 section 4.2](https://datatracker.ietf.org/doc/html/rfc2616#section-4.2))
but this is fundamentally technically incompatible with the `Map`
interface (e.g. with headers `{"key": ["val_1", "val_2"]}` then
`get("key")` and `get("KeY")` both return the same list, but `size()`
returns `1`). It also breaks as soon as you copy the `Map` into a
non-case-insensitive (i.e. normal) `Map` implementation, e.g. Guava's
`ImmutableMap`. It's risky that a line as 'innocent' as
`ImmutableMap.copyOf(headers)` could break things so badly.

For now it's enough to keep this field unstable (it's currently the only
reference to HTTP headers in the stable API). We can consider
stabilising an improved HTTP header representation in future.

PiperOrigin-RevId: 450708598
2022-05-26 11:51:27 +00:00
aquilescanta
e008a78ea6 Disable transcoding when reading content URIs
Before this change, we list the formats for which we don't
want transcoding. This change disables transcoding altogether.

This was tested by checking that transcoding takes place on a
short camera recording only when the added flag is not present
(and AndroidManifest does not declare support for HEVC).

PiperOrigin-RevId: 446986580
2022-05-09 11:04:52 +01:00
ibaker
89c4bbec5b Stabilise HttpDataSource and its nested exceptions
PiperOrigin-RevId: 438558981
2022-04-06 11:36:53 +01:00
hschlueter
81ab6c730d Fix non-inclusive language in class names.
https://source.android.com/setup/contribute/respectful-code#term-examples

PiperOrigin-RevId: 438335305
2022-04-06 11:28:30 +01:00
ibaker
be4cbb886b Stabilise DefaultDataSource.Factory, including 2 constructors
This allows apps to customise the HTTP DataSource while still supporting
non-HTTP URIs as well, as documented in our dev guide:
https://exoplayer.dev/network-stacks.html#configuring-exoplayer-to-use-a-specific-network-stack

PiperOrigin-RevId: 437209880
2022-03-25 14:06:58 +00:00
ibaker
fe8996e634 Allow stable API users to customise the DataSource used
Also stabilise the 3 HTTP-based DataSource implementations:
* DefaultHttpDataSource
* OkHttpDataSource
* CronetDataSource

PiperOrigin-RevId: 436690643
2022-03-23 10:05:27 +00:00
Ian Baker
38717ce969 Reformat some javadoc 2022-02-18 14:54:02 +00:00
tonihei
287182952d Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 427131569
2022-02-08 11:07:50 +00:00
olly
1f7174e731 Revert of 87420e5f9bd1671cd3068185f7358f5faba53e71
PiperOrigin-RevId: 426996878
2022-02-08 11:07:43 +00:00
ibaker
87420e5f9b Fix the position of IntDefs to match TYPE_USE
#minor-release

PiperOrigin-RevId: 426855255
2022-02-07 10:49:31 +00:00
ibaker
2522815d7b Add TYPE_USE to 'frequently used' IntDefs in a backwards-compatible way
This ensures Kotlin usages of these IntDef annotations in the 'old'
position will continue to compile.

'Frequently used' is a subjective judgement. I have a parallel change
that marks all the other public IntDefs in the library as TYPE_USE
(those that I've judged to be 'rarely used' by apps).

A follow-up change will fix the positions of existing usages to be as if
they're only TYPE_USE.

#minor-release

PiperOrigin-RevId: 426427334
2022-02-07 10:48:39 +00:00
ibaker
01c814e2f0 Mark all public 'rarely used' IntDefs as only TYPE_USE
This is a breaking change if the annotation itself is in use in Kotlin
code. It's judged that the IntDefs in this commit are unlikely to be
referred to often in Kotlin code. This is because they're either:
- Related to esoteric parts of the library, or
- In a common part of the library but only returned from methods (and
  never passed to callback methods).

A follow-up change will fix the positions of existing usages to match
this new config.

#minor-release

PiperOrigin-RevId: 426410237
2022-02-07 10:47:50 +00:00
ibaker
a4f67ccf6a Change DefaultHttpDataSourceTest to an instrumentation test
The Robolectric implementation of HttpURLConnection forwards to the JRE
implementation [1], which behaves differently to the Android one
available on devices and emulators. For these tests to be a realistic
test of the HTTP stack used in real playbacks we can't use Robolectric.

Similar to d1e12dcddf

[1] https://github.com/robolectric/robolectric/issues/6769#issuecomment-943556156

PiperOrigin-RevId: 416013662
2022-01-05 10:00:46 +00:00
ibaker
191185096c Remove null keys from DefaultHttpDataSource#getResponseHeaders
PiperOrigin-RevId: 410507648
2021-11-19 14:56:43 +00:00
ibaker
ded68ed981 Add contract tests for DataSource#getResponseHeaders
PiperOrigin-RevId: 408840409
2021-11-19 14:33:46 +00:00
ibaker
d1e12dcddf Make DefaultHttpDataSourceContractTest an instrumentation test
Robolectric uses the JRE HttpURLConnection [1], while real Android
devices and emulators use OkHttp to implement HttpURLConnection. This
can lead to important differences in behaviour, so it's better to use
instrumentation tests when specific HTTP behaviour is important.

[1] https://github.com/robolectric/robolectric/issues/6769#issuecomment-943556156

PiperOrigin-RevId: 408840295
2021-11-19 14:32:49 +00:00
bachinger
222db48298 Make package in test manifest consistent
PiperOrigin-RevId: 406255369
2021-11-08 15:18:26 +00:00
Andrew Lewis
933e207b3e Update to androidx.media3
PiperOrigin-RevId: 405656499
2021-10-27 09:12:46 +01:00