78 Commits

Author SHA1 Message Date
ibaker
14b0dcb957 Add missing @param tags
Dackka generates a warning if a method has at least one `@param` tag,
but not all of them are documented.

PiperOrigin-RevId: 513873453
(cherry picked from commit cb7d565fd47fc0b818ec0d5c7529e19df44022b5)
2023-03-14 16:19:20 +00:00
tonihei
cdc07e2175 Forward seek command details to seekTo method in BasePlayer
BasePlayer simplifies implementations by handling all the various
seek methods and forwarding to a single method that can then be
implemented by subclasses. However, this loses the information about
the concrete entry point used for seeking, which is relevant when
the subclass wants to verify or filter by Player.Command. This
can be improved by adding the command as a new parameter. Since
we have to change the method anyway, we can also incorporate the
boolean flag about whether the current item is repeated to avoid
the separate method.

PiperOrigin-RevId: 494948094
(cherry picked from commit ab6fc6a08d0908afe59e7cd17fcaefa96acf1816)
2023-01-25 18:17:15 +00:00
ibaker
3df6949c52 Add javadoc links to README files
Fix some other link titles and destinations spotted along the way.

#minor-release

PiperOrigin-RevId: 493276172
(cherry picked from commit 636a4a8538ccfb235eeca7d9131d4b5d4d95e9aa)
2023-01-25 18:01:21 +00:00
tonihei
f9c6fb4e90 Ensure messages sent on a dead thread don't block FakeClock execution
FakeClock keeps an internal list of messages to be executed to
ensure deterministic serialization. The next message from the list
is triggered by a separate helper message sent to the real Handler.
However, if the target HandlerThread is no longer alive (e.g. when
it quit itself during the message execution), this helper
message is never executed and the entire message execution chain
is stuck forever.

This can be solved by checking the return values of Hander.post or
Handler.sendMessage, which are false if the message won't be
delivered. If the messages are not delivered, we can unblock the
chain by marking the message as complete and triggering the next
one.

PiperOrigin-RevId: 491275031
(cherry picked from commit 8fcc06309323847b47ed8ab225cd861335448d36)
2023-01-25 17:41:00 +00:00
tonihei
8767605f5c Remove flakiness from DefaultAnalyticsCollectorTest
Our FakeClock generally makes sure that playback tests are fully
deterministic. However, this fails if the test uses blocking waits
with clock.onThreadBlocked and where relevant Handlers are created
without using the clock.

To fix the flakiness, we can make the following adjustments:
 - Use TestExoPlayerBuilder instead of legacy ExoPlayerTestRunner
   to avoid onThreadBlocked calls. This also makes the tests more
   readable.
 - Use clock to create Handler for FakeVideoRenderer and
   FakeAudioRenderer. Ideally, this should be passed through
   RenderersFactory, but it's too disruptive given this is a
   public API.
 - Use clock for MediaSourceList and MediaPeriodQueue update
   handler.

PiperOrigin-RevId: 490907495
(cherry picked from commit 6abc94a8b7180979c520fc581310b87bf297b1bb)
2023-01-25 17:41:00 +00:00
tonihei
8cc37db8e5 Rename getVideoSurfaceSize to getSurfaceSize
This better matches the callback name (onSurfaceSizeChanged) and
probably cause less confusion with getVideoSize.

PiperOrigin-RevId: 488669786
(cherry picked from commit 1143edc59ac96ec8524e8203d9445dbb0f006630)
2022-11-17 10:06:29 +00:00
ibaker
e05e319d3b Add missing IntDef on MediaSource.Factory.getSupportedTypes overrides
Without this the annotation isn't shown in javadoc (same in Dackka)

No annotation:
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/source/DefaultMediaSourceFactory.html#getSupportedTypes()

Annotation present:
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/source/MediaSource.Factory.html#getSupportedTypes()

#minor-release

PiperOrigin-RevId: 487498450
(cherry picked from commit 4f04a284ed888768b14388daf8530c47df704994)
2022-11-10 12:24:56 +00:00
ibaker
ba0466b198 Fix Dackka/Metalava errors in test_utils module
This involves reducing the visibility of methods/constructors that
are already unusable outside the `androidx.media3.test.utils` package.

#minor-release

PiperOrigin-RevId: 487473005
(cherry picked from commit 3ab881351e04bcf921f946c8e74e4a0cf5989768)
2022-11-10 10:00:48 +00:00
Googler
b780635c0b Add 'Player.getVideoSurfaceSize' that returns the size of the surface
on which the video is rendered.

Design Doc: go/aaos-mu-media-dd

PiperOrigin-RevId: 485884772
2022-11-03 15:50:19 +00:00
huangdarwin
3fd8e47245 Test: Rename to avoid redundant substrings.
Rename test files to avoid substrings that can be implied by the directory name,
like "Transformation" and "Test"

No functional changes. Renaming-only.

PiperOrigin-RevId: 477724724
(cherry picked from commit 62b95a71902349e95693174f83bb48e6927d5249)
2022-09-29 14:54:25 +00:00
tonihei
e1b947ec92 Add setPreferredAudioDevice method to ExoPlayer
This allows to access the associated functionality of AudioTrack and
fills a feature gap to MediaPlayer, which has a similar method.

Issue: androidx/media#135
PiperOrigin-RevId: 476398964
(cherry picked from commit a069ebda47fffd692838b29aa9acd1b51df86151)
2022-09-23 17:05:43 +00:00
huangdarwin
ab37184917 HDR: Assert output C.ColorTransfer for tests.
To confirm that tone mapping did or did not happen.

PiperOrigin-RevId: 476354606
(cherry picked from commit 87fd51a39b784707d9f28caac6fa6d6abc6b8b33)
2022-09-23 13:33:28 +00:00
bachinger
e6a725b6c2 Add withAvailableAd for server side inserted ad groups
#minor-release

PiperOrigin-RevId: 472714732
(cherry picked from commit 70e82a29b76ef780e8bed691a3f62df0d6d626e6)
2022-09-07 14:01:26 +00:00
Googler
e49cde80d8 Fix 1 ErrorProneStyle finding:
* Non-standard parameter comment; prefer `/* paramName= */ arg`
  (see http://go/bugpattern/ParameterComment)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/error-prone-bug for category ErrorProneStyle if there's an issue with the CL content.
* File a bug under go/rosie-bug if there's an issue with how the CL was managed.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/java/com/google/android/libraries/media/METADATA which is reachable following include_presubmits from //depot/google3/third_party/java_src/android_libs/media/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

#codehealth

Tested:
    Local presubmit tests passed.
PiperOrigin-RevId: 470953422
(cherry picked from commit 52d32be8df3960cbde78c7764e86d9ebb2994472)
2022-08-30 11:23:53 +00:00
christosts
3739e12b5d ExtractorAsserts: add comments on method arguments
PiperOrigin-RevId: 463320634
(cherry picked from commit 3aa5f259a54e6308a25616b090a931db263ded59)
2022-07-26 13:23:36 +00:00
ibaker
878279425b 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
(cherry picked from commit 2deb435625c7569cb0bd250848adaa846884dc50)
2022-07-21 15:24:07 +00:00
tonihei
95fcaf0742 Add method to check if tunneling is enabled.
Issue: google/ExoPlayer#2518
PiperOrigin-RevId: 460482615
(cherry picked from commit 549496f1fa308fc229f539823573610bc0d06871)
2022-07-12 16:31:38 +00:00
Marc Baechinger
1bbaec9c1b Merge pull request #96 from fengdai:release
PiperOrigin-RevId: 458883441
(cherry picked from commit 8e5af4a3aa43a3f2e0fd96415adf800a0abf8507)
2022-07-04 19:56:41 +00:00
ibaker
8b2b7868f3 Consider shuffle order in Timeline.equals()
Previously two timelines that differed only in shuffle order were
considered equal, which resulted in no call to
Player.Listener.onTimelineChanged when calling
ExoPlayer.setShuffleOrder. This in turn resulted in no call to
MediaControllerCompat.Callback.onQueueChanged.

Also make a small fix inside ExoPlayerImpl.setShuffleOrder, to ensure
that the new shuffle order is used when constructing the masked
timeline.

Issue: google/ExoPlayer#9889
#minor-release
PiperOrigin-RevId: 457703727
(cherry picked from commit 6f9ce4056cc427076ba48189ab192e65234da4d8)
2022-06-28 12:15:54 +00:00
ibaker
968169c784 Use a helper function and Truth Correspondence instead of NoUidTimeline
NoUidTimeline still exists as a private detail of TestUtil, but it no
longer extends ForwardingTimeline because the interactions are quite
hard to reason about.

#minor-release

PiperOrigin-RevId: 457703593
(cherry picked from commit 2a2d9e360baa6e1a44be53c39fbcd69079f34dcc)
2022-06-28 12:15:03 +00:00
bachinger
676f766e39 Make HttpDataSourceTestEnv require API 19
PiperOrigin-RevId: 454945333
(cherry picked from commit 7f89531c5b0c894946c2ca4bf54cfc66e3d4507b)
2022-06-15 16:52:51 +00:00
ibaker
f3574f2354 Rename DefaultTrackSelector.ParametersBuilder to Parameters.Builder
We generally nest the `Builder` for `Foo` inside `Foo`. In this case,
there's already a `DefaultTrackSelector.Parameters.Builder` type visible
to a developer, it just happens to be the 'common'
`TrackSelectorParameters.Builder`, so using it is a bit weird. For
example this code snippet doesn't compile because
`DefaultTrackSelector.Parameters.Builder#build()` returns
`TrackSelectionParameters`. This CL fixes that problem and the code
snippet now compiles.

```java
DefaultTrackSelector.Parameters params =
   new DefaultTrackSelector.Parameters.Builder(context).build()
```

#minor-release

PiperOrigin-RevId: 453215702
(cherry picked from commit 247c2d845dbe0887f556fd3d44cdbc4d97f7451a)
2022-06-07 17:54:55 +00:00
ibaker
af91fdbf54 Add @deprecated javadoc to all @Deprecated @Override methods
This ensures the 'use X instead' message is easily visible in the
generated HTML for the overriding method. Currently it's not, e.g.:
https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/BasePlayer.html#getCurrentWindowIndex()

#minor-release

PiperOrigin-RevId: 452002224
(cherry picked from commit b8ca5b8951325ed89063b2e30e1c7fd3b78f5e97)
2022-05-31 13:51:49 +00:00
aquilescanta
9d460023a2 Use fluent assertions
Gives a bit more information upon failures

PiperOrigin-RevId: 451882968
2022-05-30 16:55:07 +00:00
ibaker
8f3b4f590f Fix typos flagged by lint
PiperOrigin-RevId: 451135097
2022-05-30 16:30:11 +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
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
rohks
001090cc43 Migrate leaf listeners of Player to new onCues override
PiperOrigin-RevId: 449587030
2022-05-24 11:02:03 +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
ibaker
9a67b30750 Migrate usages from C.TYPE_* to C.CONTENT_TYPE_*
PiperOrigin-RevId: 446156308
2022-05-09 10:46:04 +01:00
ibaker
fd6b57469d Fix calculations that may lose precision compared to their target type
PiperOrigin-RevId: 444861268
2022-05-09 10:21:44 +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
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
olly
5d8ac644a6 Move TrackGroupArray back to ExoPlayer
PiperOrigin-RevId: 435325454
2022-03-17 13:08:56 +00:00
olly
2ea902c1b2 Move TrackSelection back to ExoPlayer module
PiperOrigin-RevId: 433729648
2022-03-24 17:21:11 +00:00
olly
fdbae6379d Simplify application of track overrides
PiperOrigin-RevId: 432485797
2022-03-04 18:54:25 +00:00
olly
bdc3af1416 Remove deprecated Player track methods
getCurrentTrackGroups and getCurrentTrackSelections are
retained for now, but moved from Player to ExoPlayer, to
ease the transition for some application code that currently
uses these methods.

PiperOrigin-RevId: 430036355
2022-02-22 10:35:04 +00:00
olly
fdd3973a09 Fix potential NPE in test_utils WebServerDispatcher
PiperOrigin-RevId: 429338648
2022-02-18 14:56:01 +00:00
Ian Baker
38717ce969 Reformat some javadoc 2022-02-18 14:54:02 +00:00
bachinger
f3cc5327cd Do not manipulate the duration of SSAI periods in FakeTimeline
#minor-release

PiperOrigin-RevId: 428727560
2022-02-17 11:52:23 +00:00
bachinger
a72f04f9b0 Resolve media period ids in multi-period windows
Ignorable ad periods are skipped to resolve the media period id with the
ad playback state of the resulting period. In case of a change in the period
position un-played ad periods are rolled forward to be played.

PiperOrigin-RevId: 428011116
2022-02-17 10:26:59 +00:00
tonihei
6dae8746ad Stop using SimpleExoPlayer for tests
The class is deprecated and all tests should preferably use the
non-deprecated code paths.

PiperOrigin-RevId: 428007986
2022-02-17 10:25:19 +00:00
krocard
8f7c91a1ad Split AnalyticsCollector in interface and default Impl
This will allow R8 to strip out the implementation
if it is not needed for an app.

#minor-release

PiperOrigin-RevId: 427983730
2022-02-17 10:23:00 +00:00
tonihei
5cc3ce9a50 Remove deprecated EventListener
PiperOrigin-RevId: 427133817
2022-02-08 11:07:50 +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
olly
631b107bda Revert of 9c8c0a59823e2a49451fbdf7040107c6cea43cc5
PiperOrigin-RevId: 426994820
2022-02-08 11:07:24 +00:00
olly
9c8c0a5982 Remove deprecated EventListener
PiperOrigin-RevId: 426876984
2022-02-08 10:21:37 +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