1439 Commits

Author SHA1 Message Date
christosts
ba1ecafb8f MediaControllerListenerTest: use local MediaController instances
Replace the instance-field MediaController with a local instance created
in each test.

PiperOrigin-RevId: 480039768
2022-10-17 15:43:28 +00:00
claincly
a426cb27c0 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-17 15:41:25 +00:00
christosts
36e12fbadb MediaControllerImplBase: clean imports
Remove static imports to constants and imports to intdefs, to make the
code more readable.

PiperOrigin-RevId: 479594144
2022-10-17 15:40:28 +00:00
huangdarwin
8548e3519e 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-17 15:38:30 +00:00
ibaker
91caf7a650 Document the allowed values of TsPayloadReader.Flags IntDef
PiperOrigin-RevId: 479569806
2022-10-17 15:37:28 +00:00
claincly
26be9ae885 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-17 15:36:29 +00:00
aquilescanta
0beccb6e14 Fix typo in MediaController javadoc
PiperOrigin-RevId: 479268879
2022-10-17 15:35:19 +00:00
tianyifeng
5bff862374 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-17 15:34:12 +00:00
christosts
bf948db669 Misc fix on DefaultMediaNotificationProviderTest
PiperOrigin-RevId: 479079184
2022-10-17 15:33:14 +00:00
tonihei
b70258e43d 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-17 15:32:22 +00:00
claincly
139a6e8d31 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-17 15:31:34 +00:00
yschimke
278853a2a1 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-17 15:29:26 +00:00
huangdarwin
253486d4af 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-17 15:28:24 +00:00
Googler
7783c6e4f7 Allow using different notification IDs for different media sessions
When a media service currently produces multiple media sessions, the notification of the second session overwrites the notification of the first one, because all sessions use the same notification ID. When we use different notification IDs for different sessions, multiple media notifications can be up at the same time, which means that they can both be controlled at the same time.

PiperOrigin-RevId: 478709069
2022-10-17 15:27:19 +00:00
huangdarwin
6e5a4c05b5 HDR: Add tests with HLG10 input.
PiperOrigin-RevId: 478019046
2022-10-17 15:25:17 +00:00
huangdarwin
de82a2be33 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-09-30 18:33:50 +00:00
huangdarwin
d5c272fde8 Tests: Statically import BitmapTestUtil methods.
Per go/java-practices/imports#static

No functional changes intended.

PiperOrigin-RevId: 477974779
2022-09-30 18:32:50 +00:00
huangdarwin
62b95a7190 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-09-30 18:31:56 +00:00
huangdarwin
1711d7f4c2 HDR: Add period to end of error message.
For tone mapping error messages.

PiperOrigin-RevId: 477447799
2022-09-30 18:30:07 +00:00
huangdarwin
aec4fe7387 HDR: Add tests for tone mapping.
Also, add checks for output file color.

PiperOrigin-RevId: 477439139
2022-09-30 18:27:18 +00:00
bachinger
9e310150a9 Remove unofficial link from test case
PiperOrigin-RevId: 477101201
2022-09-30 18:25:28 +00:00
samrobinson
7c055c9676 Clarify PlaybackParameters constructor range.
PiperOrigin-RevId: 476937845
2022-09-30 18:24:31 +00:00
samrobinson
3e4aa050da Fix badly formatted AudioProcessor javadoc.
PiperOrigin-RevId: 476909855
2022-09-30 18:23:33 +00:00
tonihei
d2887d5237 Remove test that just times out
One of the tests in MediaBrowserListenerTest caused the remote
browser service to crash and then just timed out. As this asserts
nothing useful besides checking that the timeout method is working,
we can remove the test.

Crashing the remote browser service had the side effect of letting
subsequent tests in the same class fail because the previous session
was never released and was still present in the static MediaSession
SESSION_ID_TO_SESSION_MAP instance, which prevented the creation
of new sessions with the same id. This is only an issue in test
runs because a real process would also lose its static variables
when it crashes.

PiperOrigin-RevId: 476905337
2022-09-30 18:22:32 +00:00
bachinger
acd9e581c4 Don't start the service in the foreground with a pause intent
`PlaybackStateCompat.toKeyCode(command)` was replaced by our
own implementation of `toKeyCode()`. The legacy implementation used PLAY and PAUSE, while the new implementation uses PLAY_PAUSE. This made `pause` a pending intent that attempt to start the service in the foreground, but `service.startForeground()` won't be called in `MediaNotificationManager.updateNotificationInternal` when paused.

PiperOrigin-RevId: 476895752
2022-09-30 18:21:15 +00:00
huangdarwin
16dca1828c HDR: Update gamma comments to linear.
Comment-only change.

PiperOrigin-RevId: 476873286
2022-09-30 18:20:18 +00:00
bachinger
74124f48ea Call callback future listeners on app handler
Calling maybeUpdateLegacyErrorState potentially creates a new legacy playback
state which involves calling player methods. This change makes sure that the call
sites of `maybeUpdateLegacyErrorState` are called on the app thread as enforced by
the library.

PiperOrigin-RevId: 476406282
2022-09-30 18:19:17 +00:00
tonihei
a069ebda47 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-09-30 18:18:17 +00:00
leonwind
44b9aec0b9 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-09-30 18:16:33 +00:00
Marc Baechinger
cac8c4f6e9 Merge pull request #123 from stoyicker:wrapping_media_source
PiperOrigin-RevId: 476376463
2022-09-30 18:15:30 +00:00
leonwind
7eb0ce623b Remove TODOs for merging RGB and MatrixTransformation processors.
PiperOrigin-RevId: 476362571
2022-09-30 18:12:29 +00:00
michaelkatz
ed79f4696f 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-09-30 18:11:25 +00:00
huangdarwin
87fd51a39b HDR: Assert output C.ColorTransfer for tests.
To confirm that tone mapping did or did not happen.

PiperOrigin-RevId: 476354606
2022-09-30 18:10:25 +00:00
leonwind
dc9fa4f463 Add HSL Adjustments to the effects module.
PiperOrigin-RevId: 476144167
2022-09-30 18:09:26 +00:00
leonwind
3433758c3b 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-09-30 18:08:30 +00:00
ibaker
715c948004 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-09-30 18:07:17 +00:00
samrobinson
9ec4e1340a Add file size to TransformationResult at the end of a Transformation.
Tested:
  * Manually using both path and file descriptor.
PiperOrigin-RevId: 475860978
2022-09-30 18:05:19 +00:00
leonwind
f00e43cf81 Use golden bitmaps in contrast pixel tests.
PiperOrigin-RevId: 475805421
2022-09-30 18:04:10 +00:00
rohks
c96e010d35 Fix instrumentation tests not working via Gradle
PiperOrigin-RevId: 475560401
2022-09-30 18:03:11 +00:00
leonwind
75141f3016 Fix outdated command in bitmap/README.md.
* The command changed after creating a custom effects module.

PiperOrigin-RevId: 474777823
2022-09-30 18:02:08 +00:00
yschimke
06230f19c7 Fix tracing under offload.
Currently doSomeWork is never closed and so tracing is deceiving.

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

PiperOrigin-RevId: 474755816
2022-09-30 18:00:55 +00:00
leonwind
f55a5146e0 Add LUT functionalities to transformer.
* Adds SDR 3D LUT functionalities with OpenGL 2.0 support.

PiperOrigin-RevId: 474561060
2022-09-30 17:59:58 +00:00
leonwind
ab6562e052 Fix testId and match it to the test name.
PiperOrigin-RevId: 474363545
2022-09-30 17:59:00 +00:00
samrobinson
314b312af1 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-09-30 17:58:04 +00:00
samrobinson
bca9c9b280 Clarify the replaceOutputBuffer parameter because count is unclear.
PiperOrigin-RevId: 474279220
2022-09-30 17:57:07 +00:00
leonwind
60ea64734b Change ContrastProcessor java doc for consistency.
PiperOrigin-RevId: 474002026
2022-09-30 17:55:20 +00:00
samrobinson
8ce42f0670 Add MssimCalculatorTest to verify SSIM calculations.
As part of this change, MssimCalculator is moved from androidTest/ to main/

PiperOrigin-RevId: 473771344
2022-09-30 17:54:22 +00:00
leonwind
7a460fa3bd Add java docs for ContrastProcessor constructor.
* Add docs for the public constructor for consistency with all the
other frame processors.

PiperOrigin-RevId: 473726586
2022-09-30 17:53:26 +00:00
leonwind
10cb5f17e0 Add rgb matrices to java docs for public constructors.
PiperOrigin-RevId: 473699927
2022-09-30 17:52:28 +00:00
claincly
7f42e19f09 Split decoding out of the test
This method is useful for other tests also.

PiperOrigin-RevId: 473574282
2022-09-30 17:51:31 +00:00