15023 Commits

Author SHA1 Message Date
tonihei
f0e49e8c2c Ignore stale events in StreamEventCallbackV29.
Despite unregistering the callback and clearing pending Handler
messages, the callback may still receive pending calls if they
are already triggered by the AudioTrack. Instead of asserting
that the track is correct, we should gracefully ignore stale
events.

PiperOrigin-RevId: 463851393
(cherry picked from commit 3650c2970aebab16a1ced17f849631cea452085b)
2022-07-28 16:08:21 +00:00
claincly
9953b288c1 Fix VP8 reader fragment packet size
Merging c37a767fdf

PiperOrigin-RevId: 463826373
(cherry picked from commit 4d5d592c351c75acef5779dfd2f1c7da560eeda7)
2022-07-28 13:50:54 +00:00
christosts
d03163f172 Support ApplicationVersion = 1 for HDR10+
MediaCodecRenderer allows passing HDR10+ out-of-bound metadata
with ApplicationVersion = 1.

PiperOrigin-RevId: 463822315
(cherry picked from commit 81d1dafec60b1bacb28b61cda9ca74de1410ec0d)
2022-07-28 13:24:08 +00:00
Marc Baechinger
c262276686 Merge pull request #126 from stoyicker:cap_concurrent_remove_tasks
PiperOrigin-RevId: 463792127
(cherry picked from commit 3b5a53f1a618f698d476742ff7c88b45cb366d59)
2022-10-19 15:04:14 +00:00
Googler
44de468f63 Generalize frame processing error codes.
TransformationException error codes were previously tied to OpenGL
but other FrameProcessor implementations are possible. So this CL
renames the error codes.
Also, remove GL_INIT_FAILED error code, as FrameProcessor
implemenations may initialize resources on a background thread
after the factory method returns, so it's not obvious how to
distinguish between initialization failures and processing failures.

PiperOrigin-RevId: 463704902
(cherry picked from commit bac323d346c1d3118a0b904caf9926ecb96b912d)
2022-07-27 23:21:31 +00:00
Googler
5c7dcf42a0 Add Effect marker interface.
This allows non-GL effects to be passed to custom FrameProcessor
implementations.

PiperOrigin-RevId: 463696384
(cherry picked from commit 66dde42989dbc8fedeee59897a05644d86240cf6)
2022-07-27 22:40:20 +00:00
Googler
3fa0ce7faf Remove redundant interface from FinalMatrixTPWrapper.
PiperOrigin-RevId: 463646211
(cherry picked from commit 77f41d6fd4640e392fd04372d417050c3dc011da)
2022-07-27 19:08:58 +00:00
Googler
e674df7f12 Make FrameInfo and SurfaceInfo public.
Both are used in the public FrameProcessor interface, so they
should be public too.

PiperOrigin-RevId: 463454859
(cherry picked from commit 40e96d1534d34312611d8c603b1b7c92e3250938)
2022-07-26 23:34:30 +00:00
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
Rohit Kumar Singh
ab4d37f499
Merge pull request #10443 from google/dev-v2-r2.18.1
r2.18.1
2022-07-22 09:31:03 +00: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
rohks
1a650f2a86 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.

#minor-release

PiperOrigin-RevId: 462361982
(cherry picked from commit c6e69a35a86007762ad0b5e90759b994361d05a1)
2022-07-21 13:54:35 +00: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
rohks
d24163ccea Update JavaDoc for 2.18.1
#minor-release

PiperOrigin-RevId: 461177918
(cherry picked from commit 7a10dd1580c3c960d746fcb575aad2b47b5a87ce)
2022-07-15 12:25:38 +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
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
b82be0472a 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

#minor-release

PiperOrigin-RevId: 460721541
(cherry picked from commit 6be0d6ea25a850b816b23105aa900683d30dfe8d)
2022-07-13 15:27:55 +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
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