14665 Commits

Author SHA1 Message Date
samrobinson
6e8e648ae3 Add 8 new videos, representing lower resolutions.
Downsampled from 3840x2160 resolution videos using ffmpeg:

`ffmpeg -i <inputFilename> -filter:v scale=<width>:<height> -c:a copy <outputFilename>`

PiperOrigin-RevId: 463454628
(cherry picked from commit 5f1ee86eb4655459ed0a8a706aeb44b8eeb9a46a)
2022-07-26 23:33:10 +00:00
samrobinson
127ad8c1ad Add H265 as a parameter to SsimMapperTest.
PiperOrigin-RevId: 463452893
(cherry picked from commit e1b6ed325244d906ac1aadd83517ac58dbc1e80d)
2022-07-26 23:24:03 +00:00
leonwind
65e040afb7 Rename ContrastProcessorPixelTest and make contexts final
PiperOrigin-RevId: 463450395
(cherry picked from commit 03ff5246e79b51e08b22b353138852813bd0dbd9)
2022-07-26 23:10:33 +00:00
samrobinson
de5bd046fd Add an SsimMapperTest, which binary searches for 95% ssim.
This is possible because SSIM increases monotonically with bitrate.

PiperOrigin-RevId: 463434373
(cherry picked from commit 63cddc901028434a9a565a0a8c605b46f223e724)
2022-07-26 21:56:33 +00:00
huangdarwin
abe4b23967 Rename findEncoderWithClosestFormatSupport.
Just a misc nit, since I found the name a bit confusing, and figured
findEncoderWithClosestSupportedFormat might be more descriptive.

PiperOrigin-RevId: 463433646
(cherry picked from commit 324fc5d7e88d9e4fdb1ecc7e70106d641f8236ec)
2022-07-26 21:53:18 +00:00
Googler
d8a47769b0 Allow FrameProcessor.Factory to be set on Transformer.Builder.
Extract a FrameProcessor.Factory interface from GlEffectsFrameProcessor
and allow it to  be customized using a setter on Transformer.Builder.

PiperOrigin-RevId: 463433438
(cherry picked from commit ecbe9a502cf62c92005a2ff045ab17988ea2838f)
2022-07-26 21:52:30 +00:00
hmzh
976efb3e9c Add seeking to arbitrary time points
PiperOrigin-RevId: 463328405
(cherry picked from commit 3c2b54b5e36faf6f0eb359b35724f8d087739104)
2022-07-26 14:12:07 +00:00
christosts
2218527ad3 ExtractorAsserts: add comments on method arguments
PiperOrigin-RevId: 463320634
(cherry picked from commit dc65aaef8e721894fbbfb7da4e8c8a11a36f303f)
2022-07-26 13:23:36 +00:00
Googler
95b0b9ccba DownloadService: Attempt to clarify the static map
PiperOrigin-RevId: 463315188
(cherry picked from commit 02eb6e96c58f104b9683f7f79fd47a7af6046406)
2022-07-26 12:49:34 +00:00
Googler
3483131a88 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 b994f8bfa06c82fbfe96044b986cd7b8d243acdd)
2022-07-25 23:39:59 +00:00
Googler
5ebc3dbe3b Only recreate output EGLSurface when Surface changed.
PiperOrigin-RevId: 463193768
(cherry picked from commit 4ac177c3379d673335d64df7f47890e04bfbfd7a)
2022-07-25 22:38:28 +00:00
olly
023bea5f99 DASH: Parse and use EventStream.presentationTimeOffset
Issue: google/ExoPlayer#10460
#minor-release
PiperOrigin-RevId: 463163839
(cherry picked from commit 628818211394d3783bec4398c8c9b9dbf335c486)
2022-07-25 21:28:20 +01:00
Oliver Woodman
867c997542 Merge pull request #119 from ittiam-systems:rtp_h263_test_and_fix
PiperOrigin-RevId: 463146426
(cherry picked from commit 92fc065bcdc230747fb1769132023ebbe9147af5)
2022-07-25 22:30:28 +01:00
bachinger
ca8b653232 Exclude Metadata from Format when bundling from TrackGroup
#minor-release

PiperOrigin-RevId: 463062454
(cherry picked from commit 861196a63cbabc76b35ff6b5dbf5e1e4a61508c8)
2022-07-25 13:29:44 +01:00
hschlueter
b9f6df79cb 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 46ab06b816d93c2a034c182552fa4483a6d82cba)
2022-07-22 23:18:55 +01:00
ibaker
57dbf22bfd 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 21cab6124de7b65f1af016cfc260555fa0b6e738)
2022-07-21 16:24:07 +01:00
olly
8f30563192 Expand setOutputSurface workaround to more FireOS devices
Issue: google/ExoPlayer#10454
PiperOrigin-RevId: 462375294
(cherry picked from commit e5a1e00b369b4d5ae7ac2c4c6a584b503098aa02)
2022-07-21 15:03:54 +01:00
huangdarwin
83bebd3339 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 1ecf1eb7bfdd469fe855edf6126b2822b52ff07f)
2022-07-21 00:24:41 +00:00
olly
8a848db2fb Add ContrastProcessor for contrast adjustments.
PiperOrigin-RevId: 462232813
(cherry picked from commit 7ef41c73218ec70ee9a5c372369d308273fddd8b)
2022-07-20 21:38:10 +00:00
ibaker
9c016b5d17 Add @code tags to DefaultDataSource javadoc
#minor-release

PiperOrigin-RevId: 461902089
(cherry picked from commit e65050a846e1143af9a933d1fec7bed5fac90d5d)
2022-07-19 16:29:20 +00:00
tonihei
1033fa2ba9 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 1df79419d8a9120d7e36432a1984dd790ba082b6)
2022-07-19 16:04:45 +00:00
bachinger
cc5b0e1867 Remove okhttp related proguard rules
Issue: androidx/media#10310
#minor-release
PiperOrigin-RevId: 461889651
(cherry picked from commit 759de7d6120b5cfd4f5198122c1217ab05c0aade)
2022-07-19 15:32:38 +00:00
samrobinson
d63f167dae Don't include case statement if it falls through to default.
PiperOrigin-RevId: 461888238
(cherry picked from commit 42f2e1440b91529fccc104908d662eff5552b743)
2022-07-19 15:25:58 +00:00
huangdarwin
865311d569 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 5533ad1713bd0dc64a6fba485dbbfeb35e177523)
2022-07-19 13:00:02 +00:00
ibaker
59fc51ea4c 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 080db2a09b9ebc31fb346e0beb0ea7440df795a5)
2022-07-19 11:05:40 +00:00
huangdarwin
76093e25db 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 f67c1a73f443f411771676b761ceb03e7a0d48e4)
2022-07-18 14:21:17 +00:00
huangdarwin
7d14750948 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 fd046bd2f63888f8a47c37a426c10212a56be6e0)
2022-07-18 11:20:31 +00:00
bachinger
26b062bf91 Use the current overrides of the player as preset
Issue: google/ExoPlayer#10429
PiperOrigin-RevId: 461577039
(cherry picked from commit f828130caf16cf4b144c7f9196b786dea13aaca6)
2022-07-18 10:36:01 +00:00
andrewlewis
0e15689175 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 0db07c6791620d06db9f524bf0f47e90df635756)
2022-07-18 10:09:35 +00:00
andrewlewis
ce3cdf8577 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 405be80fe5aed5cbc315a128010e6e6ecd7c2c73)
2022-07-18 08:51:54 +00:00
olly
99a2077f73 Add TODOs for registerReceiver calls without flag
PiperOrigin-RevId: 461165173
(cherry picked from commit 5a163765377ab2f43d40fc19fe7a4c50d7d2369d)
2022-07-15 10:34:53 +00:00
samrobinson
95c84e55bc 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 d4653c335e2bafa79cc590101bf32481e04b1bcd)
2022-07-14 12:27:05 +00:00
hschlueter
79e75cc672 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 db78a87fdcb095fa6520f3c1bd8b5b419d33de50)
2022-07-13 17:20:33 +00:00
tonihei
2d640e4953 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 1e8d163107283bbcd459aa787685fa4e1ab18531)
2022-07-13 13:24:04 +00:00
samrobinson
bb56c0129d 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 6ec18c8a208842eeb178f97e0680770b2e2a8b29)
2022-07-13 12:48:02 +00:00
samrobinson
66d86d6050 Clarify format is supported by encoder.
#cleanup
#minor-release

PiperOrigin-RevId: 460688226
(cherry picked from commit e0b46ece4e10cd0a9400669f8b30c3555205085d)
2022-07-13 12:16:59 +00:00
claincly
c691f461da Fix two typos in RtpVp8Reader and test
PiperOrigin-RevId: 460662425
(cherry picked from commit 918550060f461c35d90854a4d75b2713b1d95aaf)
2022-07-13 09:27:06 +00:00
claincly
82bc3b19e6 Fix a mis-match in encoder priority.
PiperOrigin-RevId: 460500666
(cherry picked from commit fa55078641a15af90113be71a72526748663e3dc)
2022-07-12 17:43:55 +00:00
rohks
7a81668863 Ignore reserved bit in parsing NAL unit type
`HevcConfig.parse` misreads reserved bit to determine NAL unit type. This is currently meant to be always set to 0, but could be given some kind of meaning in a future revision.

Issue: google/ExoPlayer#10366
PiperOrigin-RevId: 460487613
(cherry picked from commit 0f665fbeb8fca52853ab5dd0a8030484e50402dd)
2022-07-12 16:53:03 +00:00
tonihei
63a0dd8bdd Add method to check if tunneling is enabled.
Issue: google/ExoPlayer#2518
PiperOrigin-RevId: 460482615
(cherry picked from commit ab1fff404c38241cd7e0ac9c201f0fb152bf723f)
2022-07-12 16:31:38 +00:00
tonihei
5729db9d6a Fix DefaultAudioSinkTest flakiness.
Some calls to handleBuffer return false while a previous
flush is still handled in the background.

Fix this by either asserting the method returns true if
we don't expect any delay, or calling it repeatedly until
it returns true (within a timeout).

PiperOrigin-RevId: 460474419
(cherry picked from commit 4289708323442f088258c67695b74eefa9a5fb83)
2022-07-12 15:54:18 +00:00
claincly
88658df3f6 Verified encoding performance, removing TODO.
PiperOrigin-RevId: 460459378
(cherry picked from commit 4068833541e8be4e94f60bf88d62b0f6a829f9f0)
2022-07-12 14:41:02 +00:00
hschlueter
06ecfb9123 Set ColorInfo in decoder configuration format.
Pass the color info and HDR static metadata when configuring the decoder
using MediaFormatUtil.maybeSetColorInfo.

PiperOrigin-RevId: 460424985
(cherry picked from commit 46cd92ac1d80b2e651aa0ac2403e6d52d9c1d767)
2022-07-12 11:09:46 +00:00
hschlueter
b34aad7033 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
(cherry picked from commit 413016f7efea9dbb1194558374d9b9a8777a0d8c)
2022-07-12 11:04:05 +00:00
hschlueter
a4604c722c Merge MatrixTransformationProcessor and ExternalTextureProcessor.
This saves an intermediate texture copy step for use-cases
where matrix transformations are the first or only effects
in the chain.

PiperOrigin-RevId: 460239403
(cherry picked from commit 0615922cb64a649a4b01eb6410680f6f754e2005)
2022-07-11 17:04:11 +00:00
claincly
c910750074 Apply priority/operating rate settings for video encoding.
- Added setter to disable this feature.
- Added accompanying tests.
- Plan to run tests on the same set of settings on H265.

PiperOrigin-RevId: 460238673
(cherry picked from commit 6e126000993f5bbb9d1f2fd73df141158e8c7785)
2022-07-11 17:01:33 +00:00
rohks
bbb5cfb323 Add missing imports in Metadata
PiperOrigin-RevId: 459533055
(cherry picked from commit 320dcadfec6b9c7681b32255917f23ed0f62008c)
2022-07-07 16:36:59 +00:00
samrobinson
3648ead231 Move Encoder quality API to VideoEncoderSettings.
Some other minor nits and adjustments to the API logic.

PiperOrigin-RevId: 459490431
(cherry picked from commit a36967c19bd9fee09b7df534befad7cae1d5453b)
2022-07-07 12:54:02 +00:00
huangdarwin
c8b0e5e89b 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
(cherry picked from commit 4230ea94e956bacc1bb3b6737686a845bc077dd9)
2022-07-06 18:11:11 +00:00
huangdarwin
e3fb3bf5de HDR: Throw error if attempting HDR editing under API 31.
HDR editing is not supported under API 31

PiperOrigin-RevId: 459211106
(cherry picked from commit 77d353b58be1e23de9eea505c6b0e7a46d4e4d0b)
2022-07-06 10:25:30 +00:00