9413 Commits

Author SHA1 Message Date
huangdarwin
c698ec51a2 Effect: Remove unnecessary "this" qualifier
`transformationMatrix` is not ambiguous, as there's no other local
transformationMatrix variable nearby.

PiperOrigin-RevId: 482184602
2022-10-20 03:19:31 +00:00
bachinger
28c4be2f6b Map lib-effect from androidx to exoplayer2
PiperOrigin-RevId: 482179761
2022-10-20 03:15:38 +00:00
Marc Baechinger
405455b06c Merge pull request #183 from jasper-apps:bugfix/make-download-notification-appear-immediately
PiperOrigin-RevId: 482165983
2022-10-20 03:11:46 +00:00
ibaker
7d5f1a24be Remove ForwardingPlayer special case from PlayerControlView.setPlayer
This was originally added in 4fd7d777b6, but it hasn't done anything
since 98ee159df1 (when the instanceof ExoPlayer check was removed).

PiperOrigin-RevId: 482161662
2022-10-20 03:08:12 +00:00
tonihei
76ce0cc69f Ensure onMediaItemTransition is sent for repeats of the same item
Currently, repeating the same item (via seekNext/Previous) implicitly
results in a seek to the default position of the current item, which
looks exactly the same as a direct seek. As a result, we don't send
onMediaItemTransition as we would for every other seekNext/Previous
call.

This can be fixed by explicitly marking the repeat case in the internal
BasePlayer/ExoPlayerImpl methods, so that the callback can be triggered.

Issue: google/ExoPlayer#10667
PiperOrigin-RevId: 481951788
2022-10-20 03:00:58 +00:00
huangdarwin
a404fde4fa GL: Move loadAsset to GlProgram, where it's used.
(Also, make some public methods private)

PiperOrigin-RevId: 481912071
2022-10-20 02:56:52 +00:00
kimvde
bd9181e6ba Remove deprecated setOutputMimeType
This is to prepare Muxer to become public

PiperOrigin-RevId: 481893842
2022-10-20 02:53:21 +00:00
samrobinson
b6bd35860c Fix parameter comment block.
#cleanup

PiperOrigin-RevId: 481882181
2022-10-20 02:49:37 +00:00
ibaker
a5583c04bb Remove more references to overriding layouts from Player(Control)View
In exoplayer2 this affects StyledPlayer(Control)View

#minor-release

PiperOrigin-RevId: 481878940
2022-10-20 02:46:02 +00:00
kimvde
b4d7f066dd Add DefaultMuxer forwarding to FrameworkMuxer
- The naming DefaultMuxer is more consistent with the rest of
Transformer codebase (e.g. DefaultEncoderFactory).
- By hiding the implementation details of DefaultMuxer, the transition
to in-app Muxer will be seamless for apps using DefaultMuxer.
- The current plan is that DefaultMuxer will become the in-app muxer.

PiperOrigin-RevId: 481838790
2022-10-20 02:42:22 +00:00
bachinger
fd315dadeb Add copybara annotated import statement for special cases
PiperOrigin-RevId: 481605567
2022-10-20 02:31:42 +00:00
Googler
6cdaf2c031 Fix display settings window UI bug for foldable devices.
PiperOrigin-RevId: 481215581
2022-10-20 02:27:32 +00:00
ibaker
871a5e685e Fix the position of IntDef annotations on fields in the UI module
PiperOrigin-RevId: 481150758
2022-10-20 02:23:26 +00:00
ibaker
248ee469ad Mark effectively-final PlayerControlView fields as actually final
This means the null checker can be more sure that these fields don't
get reassigned between a null-check and a usage.

PiperOrigin-RevId: 481142004
2022-10-20 02:16:24 +00:00
claincly
12f7174e1f Use static import for Assertions in MCVR
PiperOrigin-RevId: 481122795
2022-10-20 02:12:49 +00:00
Marc Baechinger
9861f88f3d Merge pull request #10578 from thucngv:release-v2
PiperOrigin-RevId: 481115402
2022-10-20 02:08:44 +00:00
tonihei
6070d9110a Ensure sessions without MediaPeriodId are ended after seek to new item
We already have logic to end all session except the current one if the
current one doesn't have a MediaPeriodId yet. This is assuming that this
only happens after a seek on the app side where the player doesn't have
detailled knowledge about the MediaPeriodIds yet.

Currently this logic isn't triggered if the window we are coming from
doesn't have its MediaPeriodId either as we run into another check that
keeps sessions around until we have a valid windowSequenceNumber.

Swapping both conditions fixes this case without breaking any of the
other known transition scenarios.

Issue: androidx/media#180
PiperOrigin-RevId: 480866465
2022-10-20 02:05:07 +00:00
kimvde
8962f5a3f4 Remove supportsSampleMimeType from Muxer.Factory
- This method is redundant with getSupportedSampleMimeTypes().
- This is to prepare the Muxer class to become public.

PiperOrigin-RevId: 480840902
2022-10-20 01:54:12 +00:00
ibaker
6052212c15 Add Cea608DecoderTest
When debugging and fixing Issue: google/ExoPlayer#10666 I wanted to write a regression
test, but needed to add a test first... This is just a small bit of
coverage to start with. It checks the field/channel filtering works
correctly, but doesn't check any styling info. It also doesn't test
'pop on' subtitles (i.e. when the subtitle isn't shown until a 'end of
subtitle' signal is received).

PiperOrigin-RevId: 480644568
2022-10-20 01:50:25 +00:00
kak
c8eef6c052 Delete deprecated DefaultAudioSink constructors.
#inlineme

PiperOrigin-RevId: 480189473
2022-10-20 01:31:45 +00:00
tonihei
af19e0ea89 Treat NO_VALUE as zero when adding up total required bitrate
We currently use the literal -1 (=NO_VALUE) when adding up the
total. Tracks without known bitrate can be ignored in the
calculation, but we should use an explicit value of 0.

#minor-release

Issue: google/ExoPlayer#10664
PiperOrigin-RevId: 480048126
2022-10-20 01:28:16 +00:00
michaelkatz
a366590a04 Adjust track selection with Dolby Vision if display does not support
If the sample type is Dolby Vision and the display does not support Dolby Vision, then the capabilities DecoderSupport flag is set to DECODER_SUPPORT_FALLBACK_MIMETYPE. This denotes that the renderer will use a decoder for a fallback mimetype if possible. This alters track selection as tracks with DecoderSupport DECODER_SUPPORT_PRIMARY are preferred.

UnitTests included
-DefaultTrackSelector test that checks track selection reordering with DECODER_SUPPORT_FALLBACK_MIMETYPE
-MediaCodecVideoRenderer test that checks setting of DecoderSupport flag based on Display's Dolby Vision support

Issue: google/ExoPlayer#8944
PiperOrigin-RevId: 480040876
2022-10-20 01:24:48 +00:00
claincly
2188685c46 Remove late frame dropping in FrameProcessor
Currently, a frame is dropped if it's requested release time is in the past.
This mode was added to support previewing. However, in normal ExoPlayer
playback, slightly late frames (<30ms late) are also rendered. On MediaCodec
side, this means calling `releaseOutputBuffer` with a release time in the
past.

PiperOrigin-RevId: 479615291
2022-10-20 01:21:11 +00:00
huangdarwin
faa796d736 HDR: Disable tone mapping on unsupported pixel build ID.
Also, update tests to allow AnyOf error codes, and no longer check exception messages, which caused quite a bit of churn.

PiperOrigin-RevId: 479570861
2022-10-20 01:13:42 +00:00
ibaker
7c68b8d450 Document the allowed values of TsPayloadReader.Flags IntDef
PiperOrigin-RevId: 479569806
2022-10-20 01:10:09 +00:00
claincly
ccab9fba03 Add a FrameProcessor flag to drop the processed frame
This mode is supported by using `C.TIME_UNSET` (which is a negative value). The
new logic decouples the value of `C.TIME_UNSET` and the frame dropping
behaviour.

PiperOrigin-RevId: 479368880
2022-10-20 01:06:37 +00:00
tianyifeng
4c73241058 Provide access to original media timestamps in AudioSink.
* Add `setOutputStreamOffsetUs(long)` method in `AudioSink`.
* Add private methods `setOutputStreamOffsetUs(long)` method in `MediaCodecRenderer` and `DecoderAudioRenderer`.
* Add protected method `onOutputStreamOffsetUs(long)` method in `MediaCodecRenderer`, in which:
  * `MediaCodecRenderer` itself will be no-op for this method.
  * `MediaCodecAudioRenderer` will propagate this value to its `audioSink`.
* Add logics in `DecoderAudioRenderer` to calculate `outputStreamOffsetUs`.

PiperOrigin-RevId: 479265429
2022-10-20 01:02:59 +00:00
tonihei
0889589947 Fix RequestMetadata JavaDoc link to point to the right MediaController.
The JavaDoc of RequestMetadata should point to the media3 controller,
not the platform one.

PiperOrigin-RevId: 479047924
2022-10-20 00:59:26 +00:00
claincly
ff8dd0b4b9 Add FrameProcessor functionality to release a frame immediately
Currently `FrameProcessor.releaseOutputFrame()` method supports

Release at a specific system time
Drops the frame
This API is not that convenient to use when the caller wants to release a frame, now, regardless of the release time. A use case is to release (present) a frame when no frame is shown for a while, and it's thus better to just release the frame, now.

Currently if MCVR wants a frame to be rendered now, MCVR calls release frame with a set offset like 10us: `releaseOutputFrame(System.nanoTime() + 10_000)`. The 10us offset is to prevent the frame processor dropping the frame, due to thread hopping delays.

To make the API better usable, consider adding a mode for releasing the frame now, like (bold marks the new mode)

- Use C.TIME_UNSET to drop
- **Use -1 to release the frame immediately, or**
- Use an actual release time.

PiperOrigin-RevId: 479044215
2022-10-20 00:55:50 +00:00
yschimke
0208b1bfd0 Add suppression reason for unsuitable audio route.
A follow up to stopping speaker playback with a Player decorator from
https://github.com/androidx/media/issues/15.

It looks like we will need to change to using playback suppression to avoid
errors like https://github.com/androidx/media/issues/167, when we don't start
a foreground service.

We may not have this implemented by 1.0, but would like it in the API and it seems to be appropriate.

PiperOrigin-RevId: 478835686
2022-10-20 00:48:43 +00:00
huangdarwin
36e41059ea HDR: Check isToneMappingApplied in HDR editing test.
Assert that tone mapping is applied when an HDR edit cannot be HDR, but is successfully tone mapped. Meanwhile, assert that fallback, which is applied after codec configuration (which throws the "Tone-mapping requested but not supported by the decoder" error) is not applied when that error is called.

PiperOrigin-RevId: 478762951
2022-10-20 00:45:11 +00:00
huangdarwin
b9a3aa5ca1 HDR: Add tests with HLG10 input.
PiperOrigin-RevId: 478019046
2022-10-20 00:38:08 +00:00
huangdarwin
7286155fc3 Effect: Update javadoc to remove "final effect" references
"Final" was likely added to reference the FinalMatrixTextureProcessorWrapper,
which is a package-private class. However, I think more clear to express that
this is the input size, which then has all effects applied, to get the output
size.

PiperOrigin-RevId: 477975358
2022-10-20 00:34:36 +00:00
huangdarwin
9786802527 Test: Rename to avoid redundant substrings.
Rename test files to avoid substrings that can be implied by the directory name,
like "Transformation" and "Test"

No functional changes. Renaming-only.

PiperOrigin-RevId: 477724724
2022-10-20 00:27:26 +00:00
huangdarwin
05ce639ea0 HDR: Add period to end of error message.
For tone mapping error messages.

PiperOrigin-RevId: 477447799
2022-10-20 00:20:19 +00:00
huangdarwin
507a1be61d HDR: Add tests for tone mapping.
Also, add checks for output file color.

PiperOrigin-RevId: 477439139
2022-10-20 00:16:37 +00:00
samrobinson
8589397ffe Clarify PlaybackParameters constructor range.
PiperOrigin-RevId: 476937845
2022-10-20 00:04:48 +00:00
samrobinson
9b1909e563 Fix badly formatted AudioProcessor javadoc.
PiperOrigin-RevId: 476909855
2022-10-20 00:01:01 +00:00
tonihei
ccb820dd2f Add setPreferredAudioDevice method to ExoPlayer
This allows to access the associated functionality of AudioTrack and
fills a feature gap to MediaPlayer, which has a similar method.

Issue: androidx/media#135
PiperOrigin-RevId: 476398964
2022-10-19 23:53:40 +00:00
leonwind
f745c6ee0e Store LUT bitmap as texture with processor creation.
* Before this CL, the texture was stored during the construction of the LUT processor. This failed since if one creates a list of GlEffects on the application thread, the texture will get stored in the application thread during the effect creation and not on the GL thread, which executes the FrameProcessors.
* This is an issue since the executing thread then can't index from the texture stored on a different thread.

PiperOrigin-RevId: 476388021
2022-10-19 23:46:22 +00:00
Marc Baechinger
8623f1f016 Merge pull request #123 from stoyicker:wrapping_media_source
PiperOrigin-RevId: 476376463
2022-10-19 23:42:52 +00:00
michaelkatz
94a88e93d9 Try alternative decoder for Dolby Vision if display does not support
If the sample type is dolby vision and the following conditions match
a)There is a supported alternative codec mimetype
b)Display does not support Dolby Vision
Then getDecoderInfos will return the alternative types.

Issue: google/ExoPlayer#9794
PiperOrigin-RevId: 476356223
2022-10-19 23:24:32 +00:00
huangdarwin
df58107eae HDR: Assert output C.ColorTransfer for tests.
To confirm that tone mapping did or did not happen.

PiperOrigin-RevId: 476354606
2022-10-19 23:20:59 +00:00
leonwind
afd829e5db Add OETF and EOTF ES2 fragment shaders for non-HDR frames.
* Transform the intermediate color space to linear SDR by applying the SMPTE 170M EOTF and OETF.
* Use linear colors for the color filter pixel tests and update all golden bitmaps.

PiperOrigin-RevId: 476124592
2022-10-19 23:13:26 +00:00
ibaker
331d4d626f Work around a bug in the Android 13 ClearKey implementation
The ClearKey CDM will attach an 'invalid' URL in `KeyRequest` objects,
when the documentation states this should be an empty string if a
default URL is not known.

#minor-release

PiperOrigin-RevId: 476113513
2022-10-19 23:09:50 +00:00
samrobinson
08bb01b218 Add file size to TransformationResult at the end of a Transformation.
Tested:
  * Manually using both path and file descriptor.
PiperOrigin-RevId: 475860978
2022-10-19 23:02:18 +00:00
rohks
6015f052ba Fix instrumentation tests not working via Gradle
PiperOrigin-RevId: 475560401
2022-10-19 22:54:45 +00:00
yschimke
005b73c82a Fix tracing under offload.
Currently doSomeWork is never closed and so tracing is deceiving.

See https://screenshot.googleplex.com/eZDzn5APpBNnhe5

PiperOrigin-RevId: 474755816
2022-10-19 22:47:18 +00:00
samrobinson
6dd2a6dac6 Add support for skipping windows in MssimCalculator.
By skipping every other row and column, SSIM calculation time reduces by 10-30%.

PiperOrigin-RevId: 474286702
2022-10-19 22:35:54 +00:00
samrobinson
3e0ad6d804 Clarify the replaceOutputBuffer parameter because count is unclear.
PiperOrigin-RevId: 474279220
2022-10-19 22:32:03 +00:00