1057 Commits

Author SHA1 Message Date
bachinger
5a1223777c Update presentation time of metadata when the stream offset changes
The stream offset is used to calculate the presentation time of
a metadata object when reading and later when playing, to calculate
the current presentation time to decide whether to send the metadata
to the output.

Accordingly, the presentation time of a pending metadata that has been
calculated with a given offset needs to be recalculated when the
stream offset changes.

#minor-release

PiperOrigin-RevId: 472499943
2022-10-19 21:18:28 +00:00
Googler
90e684a6dc Add @SuppressWarnings to nullness errors detected by a newer version of the Checker Framework
PiperOrigin-RevId: 471137219
2022-10-19 20:25:27 +00:00
huangdarwin
e6a1936ba9 Effect: Add some FrameProcessor javadoc.
In particular, make it a bit more clear that "rendering" and "releasing" frames are
related concepts, and how they differ from one another in conjunction with frame
dropping.

PiperOrigin-RevId: 471037733
2022-10-19 20:21:43 +00:00
huangdarwin
a2139109e3 HDR: Add PQ support.
Use the PQ OETF and EOTF to ensure that intermediate fragment shader operations
using PQ are in linear BT.2020 rather than PQ and HLG-1 BT.2020.

Also, swap the OETF and EOTF in shaders, as they were used incorrectly before

Manually tested by verifying transformer demo HLG and PQ videos look the same with and without this CL, including with a BitmapOverlayProcessor enabled to test flows both with one MatrixTransformationProcessor that skips HDR TFs, and with one that doesn't.

PiperOrigin-RevId: 469736067
2022-10-19 19:24:54 +00:00
Googler
010ecec89d Reassign TODO to new bug.
PiperOrigin-RevId: 468672505
2022-10-19 19:06:04 +00:00
Googler
4e7f9c575d Change onOutputFrameAvailable timestamp from nanos to micros.
Upstream timestamps from the decoder are also in microseconds,
so using microseconds here is consistent with that.

PiperOrigin-RevId: 468659099
2022-10-19 18:57:51 +00:00
Googler
2c063546a1 Allow frame release to be controlled outside FrameProcessor.
Adds a method to FrameProcessor.Listener to be called when an
output frame is available and a method releaseOutputFrame in
FrameProcessor allowing the caller to trigger release of the
oldest available output frame at a given timestamp. Late frames
or frames with unset release times are dropped in the
FinalMatrixTransformationProcessorWrapper.

More than one output frame can become available before they are
released if the penultimate GlTextureProcessor is capable of producing
multiple output frames. Processing continues while waiting for
releaseOutputFrame to be called. Frame release tasks are prioritized
over other tasks.

PiperOrigin-RevId: 468473072
2022-10-19 18:50:08 +00:00
tonihei
29208ec1ed Define CueGroup.EMPTY_TIME_ZERO for convenience
We create an empty CueGroup in many places as default or
where none is needed. Instead, we can define a constant
for this purpose and reuse it.

PiperOrigin-RevId: 467944841
2022-10-19 18:30:47 +00:00
tonihei
9a7fde8fde Add initial version of SimpleBasePlayer
This base class will simplify the implementation of custom
Player classes. The current version only supports
available commands and playWhenReady handling.

PiperOrigin-RevId: 467618021
2022-10-19 18:12:00 +00:00
huangdarwin
7075f78eb2 HDR: Rename ColorInfo#isHdr to isTransferHdr.
While HDR is most closely tied to the color transfer (ex.
COLOR_TRANSFER_SDR is the only one explicitly mentioning dynamic
range), technically color spaces may be associated with HDR as well,
like BT.2020 commonly being used for HDR rather than BT.709 for SDR.

Therefore, it's more specific to mention just that the transfer is HDR.

PiperOrigin-RevId: 466316960
2022-10-19 17:24:19 +00:00
huangdarwin
e444eaa5b7 HDR: Input ColorInfo to the FrameProcessor.
This allows the GlEffectsFrameProcessor to later handle HLG and PQ
differently, or limited and full color range differently.

No functional change intended in this CL.

PiperOrigin-RevId: 466070764
2022-10-19 17:16:56 +00:00
hmzh
3aa99d5efb Add a custom MIME type for MIDI
PiperOrigin-RevId: 466032455
2022-10-19 17:13:18 +00:00
andrewlewis
40a28d5aee Avoid encoder default color info when tone-mapping
The encoder color info [defaults](https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/libstagefright/foundation/ColorUtils.cpp;l=377;drc=891c19ccfa4953b5e5f7b87118e007b994d8074c) to a value that depends on the input resolution, but when tone-mapping is enabled we should always get BT.709 color space. Hard-code this constant for now to avoid behavior depending on the resolution. A future change should use the decoder output media format to populate the color info.

PiperOrigin-RevId: 465070378
2022-10-19 16:14:44 +00:00
Googler
245326a043 Clean up FrameProcessor TODOs.
PiperOrigin-RevId: 465044342
2022-10-19 16:03:47 +00:00
huangdarwin
1a22bcf1e5 HDR: Have @C.ColorTransfer check consider NO_VALUE as SDR.
Format.NO_VALUE is a placeholder value for an invalid @C.ColorTransfer, used
for example when the decoder doesn't support this transfer function.

When encountering this invalid value, interpret this as COLOR_TRANSFER_SDR.

Confirmed locally that an exception is thrown when transcoding on p4head, and no exception is thrown when transcoding with this CL.

PiperOrigin-RevId: 464135080
2022-10-19 15:38:43 +00:00
Googler
06d41c2775 Move FrameProcessor and related interfaces to common.
This will allow effects preview in ExoPlayer to use the
Effect and FrameProcessor interface (and the interfaces
they depend on) without depending on transformer or the
future effects module.

PiperOrigin-RevId: 464060047
2022-10-19 15:34:54 +00:00
huangdarwin
810f451ec6 Transformer: Improve misc javadocs and exception logs.
PiperOrigin-RevId: 463971447
2022-10-19 15:27:24 +00:00
huangdarwin
44c42fef2a HDR: Centralize getting Colorinfo from MediaFormat
* Sets KEY_HDR_STATIC_INFO from MediaFormat in the DefaultCodec.
* Adds checks in mediaparser to ensure color space, range, and transfer are valid
  values.

PiperOrigin-RevId: 463921325
2022-10-19 15:23:34 +00:00
bachinger
861196a63c Exclude Metadata from Format when bundling from TrackGroup
#minor-release

PiperOrigin-RevId: 463062454
2022-07-25 22:26:50 +01:00
ibaker
21cab6124d 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-07-25 22:19:11 +01:00
tonihei
1df79419d8 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
2022-07-21 13:12:48 +00:00
ibaker
080db2a09b 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
2022-07-21 12:59:04 +00:00
huangdarwin
f67c1a73f4 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
2022-07-21 12:55:36 +00:00
rohks
064bbbff41 Version bump to exoplayer:2.18.1 and media3:1.0.0-beta02
#minor-release

PiperOrigin-RevId: 461162552
(cherry picked from commit 6d27ff862b0e8bc99b43dcc59c1d99760f1b0946)
2022-07-15 10:37:41 +00:00
rohks
6d27ff862b Version bump to exoplayer:2.18.1 and media3:1.0.0-beta02
#minor-release

PiperOrigin-RevId: 461162552
2022-07-15 10:26:47 +00:00
Rohit Singh
60437397f4 Merge pull request #10185 from TiVo:p-custom-logger
PiperOrigin-RevId: 460689252
2022-07-13 18:11:52 +00:00
Rohit Singh
77a3b16d6b Merge pull request #10185 from TiVo:p-custom-logger
PiperOrigin-RevId: 460689252
(cherry picked from commit 60437397f4984b5a5c64490fe88aa210d6547ce6)
2022-07-13 18:11:52 +00:00
ibaker
1b1e0f890d Group COMMAND_SET_MEDIA_ITEM and COMMAND_CHANGE_MEDIA_ITEMS together
I don't think it's useful to keep these in numerical order, it makes
more sense to keep them grouped into a 'logical' ordering.

#minor-release

PiperOrigin-RevId: 460453464
2022-07-12 15:29:33 +00:00
hschlueter
413016f7ef HDR: Check whether EXT_YUV_target extension is supported.
This extension is needed for editing HDR input with OpenGL, as the
ExternalTextureProcessor samples raw YUV values from the
external texture for HDR and converts them to RGB itself rather than
relying on the OpenGL driver to do this automatically as for SDR.

PiperOrigin-RevId: 460424154
2022-07-12 15:23:06 +00:00
ibaker
4b684b59d3 Group COMMAND_SET_MEDIA_ITEM and COMMAND_CHANGE_MEDIA_ITEMS together
I don't think it's useful to keep these in numerical order, it makes
more sense to keep them grouped into a 'logical' ordering.

#minor-release

PiperOrigin-RevId: 460453464
(cherry picked from commit 1b1e0f890da4de6055491730595f72afdde0811a)
2022-07-12 14:06:27 +00:00
rohks
320dcadfec Add missing imports in Metadata
PiperOrigin-RevId: 459533055
2022-07-07 18:33:39 +00:00
huangdarwin
4230ea94e9 HDR: Remove ColorInfo.SDR constant
The SDR constant also specified a color space and range, in addition to
C.COLOR_TRANSFER_SDR. However, it turns out that SDR videos may use different color
space and range values, so following prior ExoPlayer conventions to have `null`
mean "generic SDR" is preferable here.

PiperOrigin-RevId: 459296746
2022-07-07 18:15:38 +00:00
Rohit Singh
9521807681 Merge pull request #10260 from sr1990:clearkey_parse_licenseurl
PiperOrigin-RevId: 459215225
2022-07-07 18:12:15 +00:00
huangdarwin
77d353b58b HDR: Throw error if attempting HDR editing under API 31.
HDR editing is not supported under API 31

PiperOrigin-RevId: 459211106
2022-07-07 18:08:47 +00:00
huangdarwin
bbbb009608 HDR: Remove unused EGL_GL_COLORSPACE_KHR attribute.
PiperOrigin-RevId: 459106221
2022-07-07 17:58:02 +00:00
hschlueter
474e2f2c77 Fallback to SDR if encoder doesn't support HDR (HLG only).
If the input is HDR (HLG), check encoder capabilities for HDR support
and request tone-mapping to SDR during decoder configuration otherwise.
Capabilities are only checked for API 31 and above, as HDR editing is
not supported before.

As the encoder capabilities check needs to happen before selecting the
encoder to use (as this may depend on the resolution output by the
effects chain), the EncoderWrapper checks all candidate encoders
for the MIME type for HDR capabilities and only requests fallback to
SDR if none of them support it.

When the actual encoder is selected, the wrapper checks that it matches
one of the encoders is checked capabilities for.

PiperOrigin-RevId: 458511599
2022-07-07 17:47:46 +00:00
huangdarwin
53db305612 HDR: Configure GL shaders and encoder.
Configure the GL shaders and encoder to take in HDR metadata.

This mostly just consists of passing the Format.colorInfo through
the VideoTranscodingSamplePipeline down to the encoder, rather than passing
the PQ-ness down to the GL step.

Due to b/237674316, this will remove HDR10+ support temporarily to introduce
support for HLG10.

Manually tested to confirm that HLG10 operations that don't affect color display
correctly after this CL with "HDR editing" in the demo checked, and continue to display incorrectly (as before this CL) without the option unchecked.

PiperOrigin-RevId: 458490810
2022-07-07 17:44:14 +00:00
ibaker
5c7ec13e85 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
2022-07-07 16:59:33 +00:00
rohks
6e9275c13d Add timestamp to Metadata
`MetadataRenderer` is updated to output `Metadata` with its presentation time, in microseconds.

PiperOrigin-RevId: 457444718
2022-07-07 16:42:28 +00:00
Rohit Singh
ef96641558 Merge pull request #10260 from sr1990:clearkey_parse_licenseurl
PiperOrigin-RevId: 459215225
(cherry picked from commit 9521807681840f530ed4af17c4ab5c68dedaa13e)
2022-07-07 18:12:15 +00:00
ibaker
d3b5f71f25 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 5c7ec13e85d32bdb464082069d462c740bc7cd55)
2022-06-28 12:15:54 +00:00
rohks
bf11a8a831 Add timestamp to CueGroup
`TextRenderer` is updated to output `CueGroup`, which contains the presentation time of the cues, in microseconds.

PiperOrigin-RevId: 456531399
2022-06-27 11:36:43 +01:00
christosts
4f5e99c543 Misc improvement in Util
#minor-release

PiperOrigin-RevId: 455380010
2022-06-16 17:48:22 +00:00
christosts
5051b47f4c Misc improvement in Util
#minor-release

PiperOrigin-RevId: 455380010
(cherry picked from commit 4f5e99c5432a4fadf64e242fb74d31bc614f7487)
2022-06-16 14:39:46 +00:00
bachinger
209d3085b7 Version bump to exoplayer:2.18.0 and media3:1.0.0-beta01
#minor-release

PiperOrigin-RevId: 455350486
2022-06-16 11:35:41 +00:00
olly
9267ba3f9e Don't export broadcast receivers that don't require it
Issue: google/ExoPlayer#10287
PiperOrigin-RevId: 455131138
2022-06-15 16:02:31 +00:00
olly
545cd1eb46 Cleanup: Remove unnecessary self-refs in Util
PiperOrigin-RevId: 455121899
2022-06-15 15:18:38 +00:00
Marc Baechinger
1ca382d138 Merge pull request #9915 from dburckh:avi
PiperOrigin-RevId: 455094147
2022-06-15 15:04:32 +00:00
bachinger
8b65c6a0aa Add lint base to make gradle lint run without errors
PiperOrigin-RevId: 454951844
2022-06-15 15:00:53 +00:00
olly
92c3535de7 Cleanup: Remove unnecessary self-refs in Util
PiperOrigin-RevId: 455121899
(cherry picked from commit 545cd1eb461e504ff64d8d72295230824b4a6603)
2022-06-15 14:08:00 +00:00