1550 Commits

Author SHA1 Message Date
tonihei
6b782d1011 Replace MediaItemFiller by asynchronous callback.
The MediaItemFiller is not flexible enough for most realworld usages
because:
 - it doesn't allow asynchronous resolution of MediaItems (e.g. to
   look up URIs from a database)
 - it doesn't allow to batch updates for multiple items or do more
   advanced customizations (e.g. expanding a mediaId representing
   a playlist to multiple items).

Both issues can be solved by passing in a list of items and
returning a ListenableFuture. The callback itself can also move
into MediaSession.Callback for consistency with the other
callbacks.

PiperOrigin-RevId: 451857319
2022-05-30 16:48:41 +00:00
ibaker
cad1440e66 Wrap framework AudioAttributes in new AudioAttributesV21 class
PiperOrigin-RevId: 451831531
2022-05-30 16:44:27 +00:00
ibaker
26a1817ebf Rollback of e01bb47263
*** Original commit ***

Rollback of 07302a23bd

*** Original commit ***

Remove `@Nullable` from `MediaSource.Factory` setters

The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default imple...

***

PiperOrigin-RevId: 450453325
2022-05-23 17:12:22 +01:00
ibaker
1d139174fd Rollback of 07302a23bd5894d57514c68b2db499ac46726e77
*** Original commit ***

Remove `@Nullable` from `MediaSource.Factory` setters

The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

PiperOrigin-RevId: 450410833
2022-05-23 13:01:22 +01:00
ibaker
07039a45b0 Remove @Nullable from some Dash/Hls/SsMediaSource.Factory methods
The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

Follow-up to 07302a23bd

PiperOrigin-RevId: 450395941
2022-05-24 11:07:57 +01:00
ibaker
07302a23bd Remove @Nullable from MediaSource.Factory setters
The null-behaviour of these methods creates a minimization footgun,
because **any** call to these setters will prevent R8 from removing
the default implementation (even if it's never used by the app) - this
is because R8 can't tell the default implementation is only used if the
parameter is `null`.

PiperOrigin-RevId: 450386627
2022-05-24 11:07:07 +01:00
tonihei
38b1338844 Remove 5G-NSA detection on API 29/30.
This detection relies on an unsupported workaround and may trigger
permission warnings in tools analyzing permission usage although
no permission is needed or requested by app code.

Given the majority of 5G-NSA playbacks are on API 31+ by now,
we can remove this path to avoid the permission confusion and the
unsupported detection workaround.

PiperOrigin-RevId: 450382586
2022-05-24 11:06:09 +01:00
ibaker
cd142872bb Rename MediaSession.Builder.setSessionCallback to setCallback
Follow-up to c78c1f5891

PiperOrigin-RevId: 449492810
2022-05-24 10:59:06 +01:00
ibaker
c78c1f5891 Rename nested session callback interfaces to just Callback
This is consistent with other nested callback/listener interfaces like
`Player.Listener`.

PiperOrigin-RevId: 449476261
2022-05-24 10:57:02 +01:00
tonihei
1a171a004a Add missing equals to MergingMediaPeriod.ForwardingTrackSelection
This causes a bug where the forwarded selections are no longer
assumed equal and the child MediaPeriods will think they need
to reset streams even though the selection stayed the same.

Issue: Issue: google/ExoPlayer#10248
PiperOrigin-RevId: 449454038
2022-05-24 10:53:39 +01:00
rohks
c728647290 Create new class to store cues and timestamp.
We need to pass timestamp for the list of cues so we are defining a new class CueGroup which will store both cues and timestamp.

PiperOrigin-RevId: 449212054
2022-05-24 10:49:48 +01:00
Ian Baker
05ce399558 Merge pull request #64 from ittiam-systems:rtp-vp9
PiperOrigin-RevId: 448978892
2022-05-24 10:46:15 +01:00
bachinger
9b07d71f66 Remove all handler messages when controller is released
Issue: androidx/media#74
PiperOrigin-RevId: 448205908
2022-05-24 10:33:49 +01:00
ibaker
4f616d6003 Remove ExoPlayer's RawCcExtractor
RawCC is a Google-internal subtitle format, and is no longer used with
ExoPlayer.

PiperOrigin-RevId: 446950691
2022-05-09 11:02:25 +01:00
yschimke
80928e730c 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-09 10:59:41 +01:00
olly
90ce9a6787 Add AV1 support to the getCodecMaxInputSize function.
PiperOrigin-RevId: 445973162
2022-05-09 10:43:33 +01:00
olly
a16c0b3068 Reading AV1 initialization data.
We add an entire class like we do for parsing other codec initialization formats; it's currently not doing any parsing though (... initialization data is really simple for AV1 though: just the entire contents of the box).

For testing, we add the sample file, having been re-encoded with ffmpeg (and we also happen to have another av1 file, too).

PiperOrigin-RevId: 444890282
2022-05-09 10:24:18 +01:00
claincly
7af91fc9d5 Ignore mandatory SDP fields as ExoPlayer doesn't use them
Issue: google/ExoPlayer#10049
PiperOrigin-RevId: 444833508
2022-05-09 10:20:38 +01:00
Ian Baker
2898d41f4a Merge pull request #9967 from jruesga:cea708-handle-multiple-service-blocks
PiperOrigin-RevId: 444816821
2022-05-09 10:18:14 +01:00
bachinger
dee83cc7db Update session position info on timeline change
This fixes an inconsistent state of the `PlayerInfo` when the index of the playing
media item is changed by a playlist modification. In this inconsistent state,
calling `Playerinfo.getCurrentMediaItem` can produce an
`ArrayIndexOutOfBoundException` (see stack trace in GH issue).

This change takes the following measurements:

- always update sessionPosition and timeline of the PlayerInfo together in
  `MediaSessionImpl.PlayerListener` where the PlayerInfo originates from
- add an assertion to avoid building a `PlayerInfo` instance in an inconsistent
  state
- reduce the window of opportunity for concurrent access to
  `mediaSessionImpl.playerInfo` when dispatching player info changes in
  `MediaSessionImpl`

Issue: androidx/media#51
PiperOrigin-RevId: 444812661
2022-05-09 10:16:33 +01:00
Ian Baker
9369348d6f Merge pull request #10150 from egor-n:dev-v2-8435-outlinecolour
PiperOrigin-RevId: 444787307
2022-05-09 10:15:05 +01:00
Ian Baker
9e7c8380c2 Merge pull request #10214 from cedricxperi:dev-v2
PiperOrigin-RevId: 444585404
2022-05-09 10:14:11 +01:00
claincly
59ced5325c Catch unchecked exception in RtspSessionTiming parsing.
Issue: google/ExoPlayer#10165
#minor-release
PiperOrigin-RevId: 443653894
2022-04-26 15:01:29 +01:00
claincly
16b0cee0b6 Fix Basic authentication header
Issue: google/ExoPlayer#9544

The header must include the word "Basic", but the word is missing.

#minor-release

PiperOrigin-RevId: 443386880
2022-04-26 14:56:38 +01:00
Ian Baker
85c09753ef Merge pull request #59 from h6ah4i:fix/cleanup-callbacks-on-media-controller-release
PiperOrigin-RevId: 441253378
2022-04-26 14:32:15 +01:00
olly
83daa052cb Rename TracksInfo and TrackGroupInfo
1. TracksInfo is renamed to Tracks
2. TracksInfo.TrackGroupInfo is renamed to Tracks.Group

PiperOrigin-RevId: 441232373
2022-04-26 14:30:14 +01:00
olly
296efbb395 Reading AV1 initialization data.
We add an entire class like we do for parsing other codec initialization formats; it's currently not doing any parsing though (... initialization data is really simple for AV1 though: just the entire contents of the box).

For testing, we add the sample file, having been re-encoded with ffmpeg (and we also happen to have another av1 file, too).

PiperOrigin-RevId: 439453823
2022-04-06 11:58:54 +01:00
Ian Baker
ea61511a24 Merge pull request #10047 from LuGO0:9432/added-filtering-for-forced-text-tracks
PiperOrigin-RevId: 439262085
2022-04-06 11:50:35 +01:00
olly
21d085f8a9 Reading average and peak bitrates from esds boxes.
This provides better compatibility with MediaExtractor, which does read these fields; we also need them for being able to mux file contents into another mp4 file.

Also, there is a minor refactor included so that we have an actual type for esds box contents instead of a pair.

PiperOrigin-RevId: 438673825
2022-04-06 11:39:05 +01:00
olly
7bbcf1c4c1 Decrease polling rate for IMA Video Ads from 100ms to 200ms
PiperOrigin-RevId: 438634901
2022-04-06 11:38:05 +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
christosts
bd5ca15af6 Fallback to chunkful preparation if CODECS does not contain audio
Issue: google/ExoPlayer#10065

#minor-release

PiperOrigin-RevId: 438281023
2022-04-06 11:27:22 +01:00
Ian Baker
f48babb4ed Merge pull request #35 from ittiam-systems:rtp-mpeg4
PiperOrigin-RevId: 438000682
2022-04-06 11:19:08 +01:00
Ian Baker
e3a9ed6581 Merge pull request #56 from ittiam-systems:rtp_wav
PiperOrigin-RevId: 437783926
2022-04-06 11:14:43 +01:00
Ian Baker
9f29d22659 Merge pull request #47 from ittiam-systems:rtp-vp8
PiperOrigin-RevId: 437710223
2022-04-06 11:05:54 +01:00
Ian Baker
a11c22b67e Merge pull request #46 from ittiam-systems:rtp_amr
PiperOrigin-RevId: 437274290
2022-04-06 11:03:43 +01:00
andrewlewis
c87d16ca63 Handle non-standard MIME type on LG AC3 decoder
PiperOrigin-RevId: 437057336
2022-03-25 14:06:06 +00:00
ibaker
81d5055e12 Switch the RELEASENOTES source-of-truth from exoplayer2 to media3
Both files will be updated when new versions are released, but
unreleased notes will only be accumulated in the media3 file.

PiperOrigin-RevId: 433736599
2022-03-15 00:35:50 +00:00
olly
29fb77ea3a Rollback of 98e039d872
*** Original commit ***

Rollback of aa22bc2dbe

*** Original commit ***

Fix PlayerView touch handling

Overriding onTouchEvent was causing multiple issues, and
appears to be unnecessary. Removing the override fixes:

1. StyledPlayerView accessibility issue where "hide player
   controls" actually toggled play/pause.
2. Delivery of events to a registered OnClick...

***

PiperOrigin-RevId: 434502423
2022-03-14 17:29:56 +00:00
aquilescanta
06da55527f Force CMake version 3.21.0+ for the FFMPEG extension
Issue: google/ExoPlayer#9933
#minor-release
PiperOrigin-RevId: 434449816
2022-03-14 13:42:31 +00:00
ibaker
b165f2c098 Switch the RELEASENOTES source-of-truth from exoplayer2 to media3
Both files will be updated when new versions are released, but
unreleased notes will only be accumulated in the media3 file.

PiperOrigin-RevId: 433736599
2022-03-24 17:23:19 +00:00
ibaker
583249345a Version bump to exoplayer:2.17.1 and media3:1.0.0-alpha03
#minor-release

PiperOrigin-RevId: 433467068
(cherry picked from commit af6f6bb40666d5c27fd4274ad5e3479cf593ce04)
2022-03-09 16:38:20 +00:00
ibaker
153b16a888 Version bump to exoplayer:2.17.1 and media3:1.0.0-alpha03
#minor-release

PiperOrigin-RevId: 433467068
2022-03-09 14:51:19 +00:00
ibaker
af6f6bb406 Version bump to exoplayer:2.17.1 and media3:1.0.0-alpha03
#minor-release

PiperOrigin-RevId: 433467068
2022-03-09 14:51:19 +00:00
olly
ff6e641fbb Rollback of 20282151b5
*** Original commit ***

Fix PlayerView touch handling

Overriding onTouchEvent was causing multiple issues, and
appears to be unnecessary. Removing the override fixes:

1. StyledPlayerView accessibility issue where "hide player
   controls" actually toggled play/pause.
2. Delivery of events to a registered OnClickListener when
   useController is false.
3. Delivery of events to a registered OnLongClickListener
   in all configurations.
4. Incorrectly treating a sequence of touch events that
   exit the bounds of the vi...

***

PiperOrigin-RevId: 433262414
2022-03-09 15:34:01 +00:00
olly
20282151b5 Fix PlayerView touch handling
Overriding onTouchEvent was causing multiple issues, and
appears to be unnecessary. Removing the override fixes:

1. StyledPlayerView accessibility issue where "hide player
   controls" actually toggled play/pause.
2. Delivery of events to a registered OnClickListener when
   useController is false.
3. Delivery of events to a registered OnLongClickListener
   in all configurations.
4. Incorrectly treating a sequence of touch events that
   exit the bounds of the view before ACTION_UP as a click,
   both for delivery to OnClickListener and for toggling
   the controls.

Note: After this change, control visibility will not be
toggled if the application developer explicitly sets the
view to be non-clickable. I think that's probably working
as intended though. It seems correct that a non-clickable
view would not respond to clicks.

Issue: google/ExoPlayer#8627
Issue: google/ExoPlayer#9605
Issue: google/ExoPlayer#9861
PiperOrigin-RevId: 433016626
2022-03-09 15:19:43 +00:00
olly
b2a5298e27 Decouple UI module from ExoPlayer
This change rewrites the UI module's track selection
components to depend on the Player API, allowing us to
finally remove the UI module's dependency on ExoPlayer
as a concrete player implementation.

PiperOrigin-RevId: 432989318
2022-03-09 15:16:18 +00:00
ibaker
8e386ef21c More 2.17.0 release note fixes
#minor-release

PiperOrigin-RevId: 432154626
(cherry picked from commit 986928a89c7291ce997153e1b9351f2b4fb94f69)
2022-03-08 16:58:05 +00:00
ibaker
405795ca98 Cross-reference the corresponding media3 and exoplayer releases
PiperOrigin-RevId: 431376857
(cherry picked from commit 3e9dfaa5865217420c2ac5dc8f103a7c2d9f152d)
2022-03-08 16:58:05 +00:00
ibaker
bc1bcab553 Remove exoplayer-only release note from media3
There's no media3 equivalent to the
`com.google.android.exoplayer:exoplayer` dependency.

PiperOrigin-RevId: 430955037
(cherry picked from commit 8ae74ad873e18cd8510b9a398a264b3359766347)
2022-03-08 16:58:05 +00:00