15163 Commits

Author SHA1 Message Date
bachinger
5a4e244d94 Normalize constructors of SessionTokenImplBase/SessionTokenImplLegacy
#minor-release

PiperOrigin-RevId: 463328436
(cherry picked from commit 428fc896355828e11bf352c9b2c70abf2f13dc2d)
2022-07-26 14:12:19 +00:00
hmzh
959043cca3 Add seeking to arbitrary time points
PiperOrigin-RevId: 463328405
(cherry picked from commit 9c33b47f15778ce5b0c05bbc059df0fdff2c15c3)
2022-07-26 14:12:07 +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
olly
4a89538116 DownloadService: Attempt to clarify the static map
PiperOrigin-RevId: 463315188
(cherry picked from commit ac8d80a044dce4d5897730433b8f6417b0209b7a)
2022-07-26 12:49:34 +00:00
hschlueter
4001e699a1 Replace Size with Pair in effects.
Size requires API 21. Using Pair instead will allow effects to be
used from API 18 during previewing once they are moved out of
transformer.

PiperOrigin-RevId: 463206474
(cherry picked from commit 4adf19939839baa3eaf018fef0d1b58049fd3b91)
2022-07-25 23:39:59 +00:00
hschlueter
bb7db5a13c Only recreate output EGLSurface when Surface changed.
PiperOrigin-RevId: 463193768
(cherry picked from commit 5db7778ca322676a6e6445c473184dc1055d4c22)
2022-07-25 22:38:28 +00:00
olly
7b969e8df0 DASH: Parse and use EventStream.presentationTimeOffset
Issue: google/ExoPlayer#10460
#minor-release
PiperOrigin-RevId: 463163839
(cherry picked from commit 3786b64217a5044ed505c2e3939f07bece0605a6)
2022-07-25 20:28:20 +00:00
tonihei
c4ce6b7511 Merge pull request #119 from ittiam-systems:rtp_h263_test_and_fix
PiperOrigin-RevId: 463146426
(cherry picked from commit e54d2f56584d2f62d9bc26edf057408a9be84228)
2022-08-08 08:01:44 +00:00
bachinger
b4172b3490 Exclude Metadata from Format when bundling from TrackGroup
#minor-release

PiperOrigin-RevId: 463062454
(cherry picked from commit 8ce3d4dc729f53c3f44649ae790d7f6b3a63d5da)
2022-07-25 12:29:44 +00:00
hschlueter
9eeb4bc272 Allow stream offset passed to GlEffectsFrameProcessor to change.
This is needed for applying effects to a playlist.

The effects are applied based on the presentation time of the
frame in its corresponding media item and the offset is added
back before encoding.

Each time the offset changes, end of input stream is signalled
to the texture processors. This is needed because the texture
processors can expect monotonically increasing timestamp within
the same input stream but when the offset changes, the timstamps
jump back to 0.

PiperOrigin-RevId: 462714966
(cherry picked from commit 30e5bc9837e2423cd2bb426c5797211e0f6ad76b)
2022-07-22 22:18:55 +00:00
Rohit Kumar Singh
ca6835bf0a
Merge pull request #120 from androidx/release-1.0
r1.0.0 beta02
2022-07-22 09:31:34 +00:00
christosts
faf1f35feb DefaultMediaNotificationProvider: limit requests to load same bitmap
The DefaultMediaNotificationProvider caches the last loaded artwork
bitmap so that the bitmap isn't loaded again when the notification is
updated, e.g., the player is transiting from playing to paused. However,
loading bitmap requests for bitmaps that are already being loaded are
not suppressed. For example, if the notification is updated while the
artwork is still downloading, the same artwork might be downloaded
multiple times.

This change suppresses a bitmap load request if the same artwork is
still being loaded, to avoid additional artwork downloads.

#minor-release

PiperOrigin-RevId: 462572221
(cherry picked from commit dd2c16bc459af50c126b9666d3134595ba58e4cb)
2022-07-22 09:05:10 +00:00
rohks
5880fdd515 Refactor unreleased changes in RELEASENOTES.md
#minor-release

PiperOrigin-RevId: 462395554
(cherry picked from commit 2312c185af22ab5f035538209a8b1acd4193dd4d)
2022-07-21 15:56:10 +00:00
rohks
c77d701e3d Move release notes for Issue: google/ExoPlayer#10429 to unreleased changes
#minor-release

PiperOrigin-RevId: 462391856
(cherry picked from commit 5c41b5a2709d9ea084a4e5802e12020820e4d817)
2022-07-21 15:38:38 +00:00
bachinger
9cf85c5574 Enable subtitle selection in session demo app
Issue: androidx/media#102
#minor-release
PiperOrigin-RevId: 462391045
(cherry picked from commit 7fa3f99304b3cfbfaf35acd2017eb71db68faafa)
2022-07-21 15:34:46 +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
Rohit Singh
86e2361c50 Remove unreleased changes section from RELEASENOTES.md 2022-07-21 14:42:42 +00:00
rohks
cae428c7a6 Modify release date for 2.18.1 and media3:1.0.0-beta02
Also rearranged release notes to correctly show when the changes were released.

PiperOrigin-RevId: 462361982
(cherry picked from commit 26c8478de667180cb8137a20ae88df285c0bb046)
2022-07-21 14:17:51 +00:00
olly
f4e3924676 Expand setOutputSurface workaround to more FireOS devices
Issue: google/ExoPlayer#10454
PiperOrigin-RevId: 462375294
(cherry picked from commit 649b70f935ab688428cf69f01605f9902ca822ee)
2022-07-21 14:03:54 +00:00
tonihei
29246fb1b2 Ensure pending commands are still sent in MediaController.release()
We currently clear all pending messages, including the one that flushes
pending commands to the MediaSession. To ensure all commands that have
been called before controller.release() are still sent, we can manually
trigger the flush message from the release call.

Related to handling the final flush because disconnecting the controller,
MediaSessionStub didn't post the removal of the controller to the
session thread, creating a race condition between removing the controller
and actually handling the flush.

Issue: androidx/media#99
PiperOrigin-RevId: 462342860
(cherry picked from commit ee209690cb54fc800cf3a213f5075c9aaf51463c)
2022-07-21 10:10:22 +00:00
ibaker
0667c74dc5 Slightly disentangle MediaBrowser/Controller(Impl)Base/Legacy
These constructors are currently very intertwined, passing `this`
references from the constructor of one to the constructor of another
before the first constructor is complete (and so the `this` reference
isn't really valid yet).

This change uses checker framework `@UnderInitialization` and
`@NotOnlyInitialized` annotations to make it more clear that the
references are not available yet. For the one 'direct' access needed
in the second constructor (calling `getApplicationLooper()`) we now
pass the `applicationLooper` directly alongside (to avoid needing to
dereference the reference 'too early').

This change also ensures that where a class hierarchy has a
'dependent' class hierarchy, the 'subclass' instance is always used
(by both subclass and superclass) without casting or manually hiding
the superclass field, by defining an overridable `getFoo()` method
instead and always using it.

#minor-release

PiperOrigin-RevId: 462335043
(cherry picked from commit 287c757944720c6804e8f1cc074e28134f7da528)
2022-07-21 09:20:33 +00:00
huangdarwin
06d3c07a1c HDR: Implement HLG EOTF and OETF.
This allows us to use BT.2020 RGB linear for intermediate shaders, which also
allows us to re-enable PeriodicVignetteProcessor, which should work properly in
linear color-spaces.

Manually tested by adding a GlEffectsWrapper, and confirming that HLG HDR editing still looks correct.

PiperOrigin-RevId: 462265821
(cherry picked from commit 2f977eeec93be5cc71fda57f80362c1bc639c041)
2022-07-21 00:24:41 +00:00
olly
e959af40f1 Add ContrastProcessor for contrast adjustments.
PiperOrigin-RevId: 462232813
(cherry picked from commit 714edc93be549f93194ad0a1d7e187c32b49d1e8)
2022-07-20 21:38:10 +00:00
tonihei
33c5aa7a88 Rename seq to sequenceNumber in MediaSessionStub
"seq" is not a well-defined abbreviation and the value is
also an integer, so sequenceNumber is better than just sequence.

PiperOrigin-RevId: 462129581
(cherry picked from commit 4a4a74edffe39fbb745513a42235a523da7bb185)
2022-07-20 13:47:47 +00:00
christosts
62a2d76d00 Make DefaultMediaNotificationProvider more configurable
Add a Builder to constructor DefaultMediaNotificationProvider. The
Builder can also set the provider's:
- notification ID
- notification channel ID
- notification channel name

The change adds an API for apps to set the small icon in notifications.

#minor-release
Issue: androidx/media#104
PiperOrigin-RevId: 462111536
(cherry picked from commit 436ff6d86a4b8de5324d3b3b08bb655b75ca6632)
2022-07-20 11:41:30 +00:00
tonihei
eb823a9ab7 Run MediaSessionStub commands in order
Some commands are run asynchronously and subsequent commands need
to wait until the previous one finished. This can be supported
by returning a Future for each command and using the existing
command execution logic to wait for each Future to complete.

As some MediaSessionStub code is now executed delayed to when it
was originally created, we also need to check if the session is
not released before triggering any actions or sending result codes.

Issue: androidx/media#85
PiperOrigin-RevId: 462101136
(cherry picked from commit 7cb7636ed954f0737aaac2f9cf556715a2ee9b37)
2022-07-20 10:34:22 +00:00
tonihei
d84662e5ce Properly chain commands in MediaSessionStub
The commands currently use a task and a postTask that are chained
together manually. In some cases, e.g. when adding MediaItems,
the postTask is already a chain of commands in itself.

To allow using the entire command handling as a single task
(for simplified queueing), we can change the implementation to
always create a single task. If multiple subtasks need to be
chained together, we can do that by wrapping the method calls.
In case a task is asynchronous, we can also use Futures to
chain them together.

Overall, this is just a refactoring and changes no logic.

Issue: androidx/media#85
PiperOrigin-RevId: 462085724
(cherry picked from commit 45f1f5b37858ce937164be568a598dbb84bf654b)
2022-07-20 08:56:08 +00:00
ibaker
4cbbbc89c1 Add @code tags to DefaultDataSource javadoc
#minor-release

PiperOrigin-RevId: 461902089
(cherry picked from commit ac300c4a00c9e3bbe5cbc8d0fdd9f1c38f918888)
2022-07-19 16:29:20 +00:00
tonihei
053f68ae46 Add Util helper methods to work with Futures
This adds two methods that are helpful when working with Futures.
One is a version of postOrRun that can indicate completion by a
Future and the other is a simplified version of Guava's
Futures.transformAsync (which can't be used as it's in Beta).

PiperOrigin-RevId: 461896598
(cherry picked from commit f9eec0c0e88db28c758be5e738e9c82291f090bd)
2022-07-19 16:04:45 +00:00
bachinger
a1fc19d3c5 Exclude tracks if COMMAND_GET_TRACKS is not available
Issue: androidx/media#102
#minor-release
PiperOrigin-RevId: 461891031
(cherry picked from commit 5bf9e2fb31d9cc1dea5152e63f738b8d03fcacb3)
2022-07-19 15:39:27 +00:00
bachinger
1622b57974 Remove okhttp related proguard rules
Issue: androidx/media#10310
#minor-release
PiperOrigin-RevId: 461889651
(cherry picked from commit 5adf708b43971c3c56df5f1db7c44cef0e58bb3d)
2022-07-19 15:32:38 +00:00
samrobinson
8dbf6f9f0d Don't include case statement if it falls through to default.
PiperOrigin-RevId: 461888238
(cherry picked from commit 21016eaadfde74ba0e1e6acacc8f187cb4555974)
2022-07-19 15:25:58 +00:00
huangdarwin
82e1eda417 Only apply a MediaFormat-generated ColorInfo if it's valid.
Otherwise, invalid ColorInfo instances generated using faulty
MediaFormat#getInteger values could cause exceptions.

Confirmed that b/239435670 reproduces without this CL, and does not reproduce
with this CL.

PiperOrigin-RevId: 461862191
(cherry picked from commit 87198fe7f8df62a4b9087bc7f2c3cda237f789b2)
2022-07-19 13:00:02 +00:00
ibaker
d5e0c7597a Add fail-fast null checks to the stable Player API
This will help developers self-diagnose issues like Issue: google/ExoPlayer#10392
where the NPE occurs far from the original null value because a field
gets assigned to null.

This change aims to ensure that every stable method on Player,
ExoPlayer and ExoPlayer.Builder that takes a non-null type will fail
with an NPE before returning.

#minor-release

PiperOrigin-RevId: 461846580
(cherry picked from commit e1fde5d530a43b64f6e0603843ccafe7692e8453)
2022-07-19 11:05:40 +00:00
bachinger
c37c6812d6 Remove unused argument
PiperOrigin-RevId: 461830378
(cherry picked from commit e8b5aad3d703ef99b0d03957f16c704b05b7883c)
2022-07-19 09:16:55 +00:00
tonihei
481205a88f Use Futures for MediaSession command queue instead of Runnables
Some commands may be asynchronous and subsequent commands need to
wait for them to complete before running. This change updates the
queue to use (and listen to) Futures instead of calling Runnables
directly. The commands are currently still added as Runanbles
though, so this change is a no-op.

Also moves the permission check in MediaSessionImpl to before
queueing the command because the permission should be check at
the time of calling the method.

When executing the comamnds in the queue, we need to be careful
to avoid recursion in the same thread (which happens when both
the Future is immediate and running on the correct thread already).
To avoid recursion, we detect this case and loop the commands
instead.

Issue: androidx/media#85
PiperOrigin-RevId: 461827264
(cherry picked from commit dee80788e4fc5e82739ae014a5d2759b77f03daa)
2022-07-19 08:59:30 +00:00
huangdarwin
54cdec4614 HDR: Use FP16 color representation for texture processors.
* Introduced `useHdr` for `GlEffect#toGlTextureProcessor`, so
  `TextureProcessor` implementations can decide how to handle HDR.
* Creating FP16 color textures for HDR input.

Tested via manual testing, adding a no-op GlEffectWrapper to the transformation to
force use of intermediate textures, adding a linear ramp to the fragment shader,
and trying to ascertain that there's a real reduction in posterization when
switching from 4-bit to 8-bit unsigned bytes, and again from 8-bit unsigned bytes
to 16-bit floating point.

PiperOrigin-RevId: 461613117
(cherry picked from commit ba9c9bb96471a9589d391ae498ebb0c194a5b41e)
2022-07-18 14:21:17 +00:00
huangdarwin
add44470cf HDR: Throw when unexpected color transfer encountered.
This may happen when a containers' color transfer incorrectly does not match
the video's color transfer.

An example of a file with such a mismatch is the current Transformer demo HDR10
sample file.

Manually tested by confirming that no errors are emitted for SDR and HLG sample
files, and that errors are emitted for our incorrect HDR10 sample file.

PiperOrigin-RevId: 461583532
(cherry picked from commit 9f7a159bc4c8a82653fdbb6d62e4f79b020cff06)
2022-07-18 11:20:31 +00:00
bachinger
24bfe3a5e0 Implement getCurrentTracks in MediaController
After this change the current tracks are sent to the controller as part of
`PlayerInfo` and call `Listener.onTracksChanged()` in case of a change in tracks.

PiperOrigin-RevId: 461578695
(cherry picked from commit 9a895cd18f020a4f9df24c142406e91507a76605)
2022-07-18 10:47:57 +00:00
bachinger
db25954dfd Use the current overrides of the player as preset
Issue: google/ExoPlayer#10429
PiperOrigin-RevId: 461577039
(cherry picked from commit 5c2aabca660e7618ebe410d8ab7de95acc76ee1a)
2022-07-18 10:36:01 +00:00
andrewlewis
04fa2fda2a Make minor fixes to HDR handling
- Update profile selection logic to pick an HDR-compatible profile when doing HDR editing on H.264/AVC videos.
- Handle doing the capabilities check for all MIME types that support HDR (not just H.265/HEVC).
- Fix a bug where we would pass an HDR input color format to the encoder when using tone-mapping.
- Tweak how `EncoderWrapper` works so decisions at made at construction time.

Manually tested cases:
- Transformation of an SDR video.
- Transformation of an HDR video to AVC (which triggers fallback/tone-mapping on a device that doesn't support HDR editing for AVC).
- Transformation of an HDR video with HDR editing.

PiperOrigin-RevId: 461572973
(cherry picked from commit 604ab7fcdaa759025536feb673a3abb93196a829)
2022-07-18 10:09:35 +00:00
andrewlewis
c4e64c3d0d Update demo HDR10 video URL
The old URL doesn't correctly signal the HDR10 color info in the container.

The new URL signals ST2084 (PQ) transfer function and BT.2020 color space as expected.

PiperOrigin-RevId: 461560107
(cherry picked from commit 794e366b3661e9dfec01abcbd4598a26bec9e235)
2022-07-18 08:51:54 +00:00
rohks
37f11161ce Version bump to exoplayer:2.18.1 and media3:1.0.0-beta02
#minor-release

PiperOrigin-RevId: 461162552
(cherry picked from commit be27daebc4e598a4c0d532779649a77f82650911)
2022-07-15 10:39:34 +00:00
olly
6eb30ce233 Add TODOs for registerReceiver calls without flag
PiperOrigin-RevId: 461165173
(cherry picked from commit 9271572e950230a24da69a6ec5838dd838ea672d)
2022-07-15 10:34:53 +00:00
samrobinson
ac2a5e56b0 Add additional video files.
These are providing more variety and complexity.

All files are okay to be public.

PiperOrigin-RevId: 460935247
(cherry picked from commit b87fa45fea56a50b5c035c7ca18eaf19697e60bf)
2022-07-14 12:27:05 +00:00
hschlueter
4e92c4260a Use COLOR_Format32bitABGR2101010 for HDR encoder configuration.
Also remove VideoEncoderSettings.colorProfile as there are no
concrete use cases for customizing this and it clashes with picking
the color format automatically based on SDR vs. HDR.

PiperOrigin-RevId: 460746987
(cherry picked from commit 7954eeb3c2fa274d9343cbf51963a3cccf3270c7)
2022-07-13 17:20:33 +00:00
tonihei
dfe8bee0cf Fix setDataSourceFactory handling in DefaultMediaSourceFactory
The call doesn't currently reset the already loaded suppliers and
factories. Also fix the supplier loading code to use a local copy
of the current dataSourceFactory to avoid leaking an updated
instance to a later invocation.

Issue: androidx/media#116

PiperOrigin-RevId: 460721541
(cherry picked from commit adc50515e93e6fdcf303d168e8388050503c46ef)
2022-07-13 15:27:55 +00:00
Rohit Singh
3abffb7583 Merge pull request #10185 from TiVo:p-custom-logger
PiperOrigin-RevId: 460689252
(cherry picked from commit bd8723e35a195e0e67816a64e74266bac9fe5058)
2022-07-13 17:45:54 +00:00
tonihei
45f1473dcd Use SingleThreadExecutor to release AudioTracks
We currently start a simple Thread to release AudioTracks
asynchronously. If many AudioTracks are released at the same
time, this may lead to OOM situations because we attempt to
create multiple new threads.

This can be improved by using a shared SingleThreadExecutor.
In the simple case of one simmultaneous release, it's exactly
the same behavior as before: create a thread and release it
as soon as it's done. For multiple simultanous releases we
get the advantage of sharing a single thread to avoid creating
more than one at the same time.

Issue: google/ExoPlayer#10057
PiperOrigin-RevId: 460698942
(cherry picked from commit 9a616c0cee447b7bd809c0dfc4c9d864fc9fee56)
2022-07-13 13:24:04 +00:00
samrobinson
00aea7519b Fix assertion error when using high quality targeting API.
Add test that verifies SSIM with API enabled.

#minor-release

PiperOrigin-RevId: 460692420
(cherry picked from commit f903869eb880508812c0dc2e1a8b01ecf0597f45)
2022-07-13 12:48:02 +00:00