15023 Commits

Author SHA1 Message Date
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
bachinger
9b7674aba5 Add migration script
Note: This was already reviewed in <unknown commit>. This doesn't mean we cannot apply further changes though.
PiperOrigin-RevId: 460542835
(cherry picked from commit d59334c56be5c8cba2beb3d4e465edec65ad36c7)
2022-07-12 20:43:24 +00:00
bachinger
268de237a7 Don't set the tag in CastTimeline
Leaving the media item that has been passed in unchanged, ensures that the
media item in the timeline is equal to the media item that the user has
passed into the player. The value of the tag is the uid of the window,
meaning this is redundant information.

#minor-release

PiperOrigin-RevId: 460542246
(cherry picked from commit 9d87c0db78f899ff05e8a26a3e6b4a9667fa81d2)
2022-07-12 20:41:57 +00:00
Rohit Singh
344ac7bde0 Merge pull request #110 from ittiam-systems:rtp_vp8_test
PiperOrigin-RevId: 460513413
(cherry picked from commit c75b6a3a88e7e6ff2f5f25e334cfaae5567783ea)
2022-07-13 17:54:35 +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
bachinger
6abbb49738 Enable onMediaMetadataChanged in CastPlayer
Issue: androidx/media#25
PiperOrigin-RevId: 460476841
(cherry picked from commit d6659e92dfc3b5100bbd79f2d28f296a425a2ac1)
2022-07-12 16:04:45 +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
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
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
bachinger
05e42ebb07 Use the public MediaItem in the timeline of CastPlayer
The media item needs to be assigned to `Window.mediaItem` in `CastTimeline.setWindow`. For this the `MediaItem` needs to be available in the timeline.

When a `MediaItem` is passed to the `set/addMediaItems` method, we can't yet know the Cast `MediaQueueItem.itemId` that is generated on the device and arrives with an async update of the `RemoteMediaClient` state. Hence in the `CastTimelineTracker`, we need to store the `MediaItem` by Casts's `MediaItem.contentId`. When we then receive the updated queue, we look the media item up by the content ID to augment the `ItemData` that is available in the `CastTimeline`.

Issue: androidx/media#25
Issue: google/ExoPlayer#8212

#minor-release

PiperOrigin-RevId: 460325235
(cherry picked from commit 02e1484ebc14a97829c9f5836333412c01205f57)
2022-07-11 23:22:27 +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
christosts
36a99cb1d3 Listen to playWhenReady changes in LeanbackPlayerAdapter
#minor-release

Issue: google/ExoPlayer#10420
PiperOrigin-RevId: 460223064
(cherry picked from commit c43d9f5b5794e5019758ee7df68f79ed9f9bc4a7)
2022-07-11 15:49: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
rohks
43eb3d0fc8 Add tests for extracting MP4 with large bitrates
Also added the test to `MP4PlaybackTest`.

PiperOrigin-RevId: 459492188
(cherry picked from commit a1665841fc90e979af427f9da0b8398d56cc6632)
2022-07-07 13:04:29 +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
christosts
f9f6cb3458 Add missing Nullable annotation
PiperOrigin-RevId: 459485334
(cherry picked from commit 752e82df2e0b54a1935e329b5d7da6c23309a388)
2022-07-07 12:17:36 +00:00
tonihei
d39075a216 Don't block AudioTrack when waiting for previous release
We wait until a previous AudioTrack has been released before
creating a new one. This is currently done with a thread
block operation, which may cause ANRs in the extreme case
when someone attempts to release the player while this is
still blocked.

The problem can be avoided by just returning false from
DefaultAudioSink.handleBuffer to try again until the previous
AudioTrack is released.

Reproduction steps to force the issue:
1. Add Thread.sleep(10000); to the AudioTrack release thread.
2. Add this to the demo app:
    private int positionMs = 0;

    Handler handler = new Handler();
    handler.post(new Runnable() {
      @Override
      public void run() {
        player.seekTo(positionMs++);
        if (positionMs == 10) {
          player.release();
        } else {
          handler.postDelayed(this, 1000);
        }
      }
3. Observe Player release timeout exception.

These steps can't be easily captured in a unit test as we can't
artifically delay the AudioTrack release from the test.

Issue: google/ExoPlayer#10057
PiperOrigin-RevId: 459468912
(cherry picked from commit a80dd60449a029ad5246a98717bbe3bf0fc38be7)
2022-07-07 10:22:56 +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
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
tonihei
036a48dcf9 Exclude HEVC 10bit profile on Pixel 1.
This profile is declared as supported although it isn't.

Issue: google/ExoPlayer#10345
Issue: google/ExoPlayer#3537

#minor-release

PiperOrigin-RevId: 459205512
(cherry picked from commit bf88f28539de7740dd542345ff8b70626f58ed45)
2022-07-06 09:46:27 +00:00
bachinger
c2ddf27715 Use mediaId as contentId if available
This is to be consistent with what cast `QueueMediaItem` is doing. If a contentId is
not available the contentUrl is used as the ID.

#minor-release

PiperOrigin-RevId: 459133323
(cherry picked from commit 84c801a723f56c9c0fcdf10ab8bbab35bfd9f333)
2022-07-05 23:21:59 +00:00
Rohit Singh
8051fe53f9 Merge pull request #96 from fengdai:release
PiperOrigin-RevId: 458883441
(cherry picked from commit 486c35045ddcf7a87b9df4d3674d6ee2de79aab7)
2022-07-07 17:51:10 +00:00
huangdarwin
065c12caf4 HDR: Remove unused EGL_GL_COLORSPACE_KHR attribute.
PiperOrigin-RevId: 459106221
(cherry picked from commit bbbb009608c9b2fa951d664f4e2478c2cac61459)
2022-07-05 18:47:29 +00:00
samrobinson
6b5148e434 Implement device based encoder bitrate mapping.
This feature is disabled by default for now.

PiperOrigin-RevId: 458932471
(cherry picked from commit d5b02e75847eb5f062b544a52491dfe5df46a5fe)
2022-07-04 17:32:27 +00:00
hschlueter
67439206f1 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
(cherry picked from commit 474e2f2c77cad4759645ec3320f756757c0882db)
2022-07-01 18:34:02 +00:00
huangdarwin
39047b5676 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
(cherry picked from commit 53db305612a84466b6712cc355dbf918424a968d)
2022-07-01 16:57:43 +00:00
claincly
b440b556e2 Fix error in frame rate handling.
The old getString() will throw because FRAME_RATE can only be float or int.

PiperOrigin-RevId: 458481251
(cherry picked from commit 2b6f62b2a124e3a635ddcba7d9f256c52b564d89)
2022-07-01 16:05:39 +00:00
tonihei
84280c8530 Only consider enabled tracks in ProgressiveMediaPeriod.bufferedPosition
ProgressiveMediaPeriod loads all available tracks into SampleStreams
(because it needs to read the data anyway and it allows easy activation
of tracks without reloading). However, the SampleStreams for disabled
tracks are not read and no one if waiting for them.

The buffered position is used for user-visible state (e.g. in the UI)
and to check how much data is already buffered to decide when to stop
buffering (using LoadControl). Both values benefit from only
using the actually enabled tracks to better reflect what is available
for playback at the moment.

Issue:Issue: google/ExoPlayer#10361
PiperOrigin-RevId: 458475038
(cherry picked from commit 577e19168d981a92c18eff7f7a045c925d80ca8d)
2022-07-01 15:28:39 +00:00
claincly
e3f1787c3a Find only REGULAR_CODECS in EncoderUtil.
We used "ALL_COOECS" previously, and it is not necessary because "ALL_CODECS"
additionally the codecs that support tunneling/secure decoding, which there
is no use case in Transformer.

PiperOrigin-RevId: 458470278
(cherry picked from commit 8f89eba59c151f301d00d4fed200fd8f9359c9e2)
2022-07-01 14:58:47 +00:00
claincly
f1d4a4caab Round the frame rate in MediaFormat
Although MediaCodec claims supporting float frame rate, encoder init failed on
API21 Nexus 5. Since it's just a performance hint to the codec, it's OK to
generalize it to other API versions.

PiperOrigin-RevId: 458434650
(cherry picked from commit 821ab267026beee4f37e71220d930776b6ac266f)
2022-07-01 11:06:12 +00:00
hmzh
d03fb39469 Fix MIDI command timestamp calculations and synthesization duration.
- Improve variable naming to include time units for clarity
- Fix existing timestamp calculations to respect time units as well as track tempo (default values for now)
- Ensure the synthesizer produces PCM for the correct amount of time (including gaps between commands).

PiperOrigin-RevId: 458428243
(cherry picked from commit bce59b1ac20725f34362caeebfd337d565790f32)
2022-07-01 10:18:50 +00:00
rohks
3d79536f80 Fix MP4 parser issue in reading bitrates from esds boxes.
As per MP4 spec, bitrates in esds boxes can be a 32 bit number which doesn't fits in Java int type, so now reading it as a long value. Our class for holding media format, only allows bitrates value to be an int as we don't expect the bitrates to be greater than or equal to 2^31. So we're limiting the values for bitrates to Integer.MAX_VALUE.

#minor-release

PiperOrigin-RevId: 458423162
(cherry picked from commit 9e10286b5ea624b8a7533e5fc452b19476589764)
2022-07-01 09:52:45 +00:00
rohks
3709e90e34 Fix MP4 parser issue in reading length of URL array from esds boxes.
As per MP4 spec, the length of URL array is a 8 bit number.

#minor-release

PiperOrigin-RevId: 458421436
(cherry picked from commit 5095ff160bec2fdad21a51351373a03073236ffd)
2022-07-01 09:39:11 +00:00
hschlueter
25ece32dda Move DebugViewProvider out of Transformer class.
The GlEffectsFrameProcessor that will be part of the effects module
uses the DebugViewProvider. So it does not make sense for it
to be an inner interface of Transformer.

PiperOrigin-RevId: 458014932
(cherry picked from commit f41e6796ce39469f9fc3a844ec88725ab56d3356)
2022-06-29 17:56:53 +00:00
hschlueter
3d6bed1668 FrameProcessor: Replace SurfaceInfo.Provider with setter.
The FinalMatrixTransformationProcessorWrapper ensures that the
surface is only replaced when it is not being rendered to and vice
versa.

PiperOrigin-RevId: 458007639
(cherry picked from commit e5527a8addff1e35380d3383dea237c70198a63a)
2022-06-29 17:27:05 +00:00
ibaker
315bf6b898 Ensure TalkBack announces the selected playback speed in the UI menu
Issue: google/ExoPlayer#10298
#minor-release
PiperOrigin-RevId: 457991028
(cherry picked from commit bf86b603a30211ec2b48a78223683f758e6d5f83)
2022-06-29 16:10:11 +00:00
rohks
583c12f843 Make MetadataRenderer configurable to output metadata early.
PiperOrigin-RevId: 457974611
(cherry picked from commit 14f75c162f85ac083c8b19b74790b4a6f921c68f)
2022-06-29 14:47:12 +00:00
hschlueter
47cc8aaf92 Fix outputHeight pass-through condition.
The outputHeight in the TransformationRequest is the height of
the frame as it would be displayed (i.e., after applying any
rotation specified in the format). So pass-through should only
be used if the requested outputHeight matches the input
format's height after applying the rotation.

PiperOrigin-RevId: 457934867
(cherry picked from commit c74cf1f1aaa917bad3479779dff80aeeac866493)
2022-06-29 10:28:54 +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
ibaker
f3a350d651 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 292f6de6305fa7fbbd2b80223e7860aa1f69118a)
2022-06-28 12:15:03 +00:00
hschlueter
c812c80a2f Allow changing input pixelWidthHeightRatio for GlEffectsFrameProcessor.
pixelWidthHeightRatio is now passed to setInputFrameInfo instead of
the factory.

PiperOrigin-RevId: 457696703
(cherry picked from commit bfa663d2b13340297354ef32ea7679775cb2d4eb)
2022-06-28 11:22:45 +00:00
ibaker
29a2292e99 Fix typo in the media3 1.0.0-alpha02 / ExoPlayer 2.17.0 release notes
PiperOrigin-RevId: 457680579
(cherry picked from commit 40350bcd471fbfe684a0c1e60bd463c852dae212)
2022-06-28 09:33:29 +00:00
ibaker
98f5bdb676 Fix release notes related to track selection renames and deletions
Issue: google/ExoPlayer#10363
PiperOrigin-RevId: 457679928
(cherry picked from commit 194043ae4ea2f8e982a5aef2eca90c9cf01018e3)
2022-06-28 09:30:11 +00:00
rohks
76310ad40c Add timestamp to Metadata
`MetadataRenderer` is updated to output `Metadata` with its presentation time, in microseconds.

PiperOrigin-RevId: 457444718
(cherry picked from commit 6e9275c13d7c6e0fc8b6568662929c186395a33a)
2022-06-27 11:31:10 +00:00