1057 Commits

Author SHA1 Message Date
tonihei
1ac72de551 Add media type to MediaMetadata
This helps to denote what type of content or folder the metadata
describes.

PiperOrigin-RevId: 492123690
2022-12-12 11:19:53 +00:00
tonihei
6c467590d0 Rename SimpleBasePlayer.PlaylistItem to MediaItemData
This better matches the terminology we use elsewhere in the Player
interface, where items inside the playlist are referred to as
"media item" and only the entire list is called "playlist".

PiperOrigin-RevId: 491882849
2022-12-12 10:49:43 +00:00
tonihei
4cf877b814 Add configuration to support OPUS offload
To support OPUS offload, we need to provide a few configuration values
that are currently not set due to the lack of devices supporting
OPUS offload.

PiperOrigin-RevId: 491613716
2022-11-29 19:42:25 +00:00
ibaker
ed8c196e2e Clean up javadoc on Metadata.Entry.populateMediaMetadata
Remove self-links, and remove section that is documenting internal
ordering behaviour of
[`SimpleBasePlayer.getCombinedMediaMetadata`](bb270c62cf/library/common/src/main/java/com/google/android/exoplayer2/SimpleBasePlayer.java (L1770))
rather than anything specifically about this method.

#minor-release

PiperOrigin-RevId: 490923719
2022-11-29 18:56:01 +00:00
huangdarwin
07d1970f35 HDR: Add COLOR_TRANSFER_LINEAR in C.java.
This is more clear than using Format.NO_VALUE, when we do actually intend for an
output value.

Also, fix @see formatting by using summary fragments instead, and add an error
output for OETF and EOTF transfer functions.

PiperOrigin-RevId: 490910229
2022-11-29 18:52:13 +00:00
Lev
101b712267 Cleanup 2022-11-26 03:04:35 +03:00
Lev
5e3b817b81 Cleanup 2022-11-26 02:56:58 +03:00
Lev
184761f79e
Merge branch 'dev-v2' into subrip_utf_16 2022-11-26 02:44:17 +03:00
Lev
90e9807ab2 Fixes after review 2022-11-26 02:37:26 +03:00
bachinger
f262e9132b Exclude tracks from PlayerInfo if not changed
This change includes a change in the `IMediaController.aidl` file and needs
to provide backwards compatibility for when a client connects that is of an older or
newer version of the current service implementation.

This CL proposes to create a new AIDL method `onPlayerInfoChangedWithExtensions`
that is easier to extend in the future because it does use an `Bundle` rather than
primitives. A `Bundle` can be changed in a backward/forwards compatible way
in case we need further changes.

The compatibility handling is provided in `MediaSessionStub` and `MediaControllerStub`. The approach is not based on specific AIDL/Binder features but implemented fully in application code.

Issue: androidx/media#102
#minor-release
PiperOrigin-RevId: 490483068
2022-11-24 14:55:15 +00:00
samrobinson
412c98e230 Return output immediately if available from AudioProcessingPipeline.
If there is output data available (outputBuffer.hasRemaining()), then
there is no need to move other data between the underlying processors.
It will not change the buffer being returned by that call to getOutput.

If there is no output data readily available, it's necessary to go to
the AudioProcessors and pass buffers between them, as this may produce
data for output.

PiperOrigin-RevId: 490482653
2022-11-24 14:51:18 +00:00
samrobinson
c1e292374d Fix SpeedChangingAudioProcessor handling of EMPTY_BUFFER.
PiperOrigin-RevId: 490265564
2022-11-24 14:38:59 +00:00
michaelkatz
788f74740b Fixed Exoplayer imports for SimpleBasePlayerTest
PiperOrigin-RevId: 490181547
2022-11-22 09:59:16 +00:00
michaelkatz
1551bea398 Fixed missing imports for Metadata and AdPlaybackState for Exoplayer
PiperOrigin-RevId: 490012573
2022-11-22 09:55:26 +00:00
michaelkatz
ca190c084b Version bump to exoplayer:2.18.2 and media3:1.0.0-beta03
#minor-release

PiperOrigin-RevId: 489959918
2022-11-21 16:04:00 +00:00
claincly
47d63504c2 Destroy eglSurface in FrameProcessor
Previously, FrameProcessor never had the usecase in which the output surface
is replaced, while previewing introduced this usecase.

When switching output surfaces, we need to destroy the EGL Surface linked to the
surface that is being swapped out, because an EGL surface is linked to the EGL
display (which is not destroyed even when releasing FrameProcessor).

A GL exception will be thrown in the following scenario if we don't destroy the
EGL surface:

1. Creates a Surface, the surface is identified by address 0x11
2. Sets Surface(0x11) on FrameProcessor. Eventually an EGL surface is created
  to wrap Surface(0x11)
3. Release FrameProcess, this releases the EGL context
4. Instantiate a new FrameProcessor, sets Surface(0x11) as the output
5. When FrameProcessor creates an EGL surface to wrap Surface(0x11), GL throws
  an exception, becasue Surface(0x11) has previouly been connected to an EGL
  surface.

PiperOrigin-RevId: 489590072
2022-11-21 15:58:13 +00:00
tonihei
b81cd08271 Add remaining state and getters to SimpleBasePlayer
This adds the full Builders and State representation needed to
implement all Player getter methods and listener invocations.

PiperOrigin-RevId: 489503319
2022-11-21 15:52:36 +00:00
kimvde
289a0e089e Make sure the AudioProcessors do not receive AP.EMPTY_BUFFER
PiperOrigin-RevId: 489174645
2022-11-21 14:46:26 +00:00
kimvde
b23559456e Fix audio slow motion flattening
PiperOrigin-RevId: 488981968
2022-11-21 14:38:53 +00:00
kimvde
ea7e8cff3a Refactor transformation completion
PiperOrigin-RevId: 488929446
2022-11-21 14:27:00 +00:00
tonihei
8438daca1f Rename getVideoSurfaceSize to getSurfaceSize
This better matches the callback name (onSurfaceSizeChanged) and
probably cause less confusion with getVideoSize.

PiperOrigin-RevId: 488669786
2022-11-16 12:32:35 +00:00
christosts
1b24e6fd14 Set valid channel masks for 8 and 12 channels on all Android versions
Util.getAudioTrackChannelConfig() maps a channel count to a
channel mask that is passed to AudioTrack. The method expected that
playback of 8-channel audio is possible from Android 5.1 and playback of
12-channel audio is only possible from Android 12L. However, there is no
restriction on the upper number of channels that can be passed to the
AudioTrack. google/ExoPlayer#10701 is an example where the audio decoder
outputs 12 channels on an Android 10.

This change removes the restrictions for 8 and 12 channels. Note, we still
do not support playback of arbitrary number of channels as it would require
further changes to DefaultAudioSink.

#minor-release

Issue: google/ExoPlayer#10701
PiperOrigin-RevId: 488659831
2022-11-16 12:28:48 +00:00
tonihei
3e5103a3e5 Mark iterationFinished when triggering release event.
When we currently trigger the iteration finished event during the
release, we don't mark the event as triggered. This means that
someone can trigger another release from within the callback,
which then tries to resend the event.

Issue: google/ExoPlayer#10758

#minor-release

PiperOrigin-RevId: 488645089
2022-11-16 12:25:08 +00:00
samrobinson
52f3ee81d4 Handle buffers in DefaultAudioSink with AudioProcessingPipeline.
PiperOrigin-RevId: 488412695
2022-11-16 12:10:21 +00:00
huangdarwin
095c52e7ba GL: Rename getEglSurface to createEglSurface.
Per documentation, eglCreateWindowSurface creates a new EGL window surface.

getEglSurface suggests instead that a pre-existing surface is returned.

https://registry.khronos.org/EGL/sdk/docs/man/html/eglCreateWindowSurface.xhtml

PiperOrigin-RevId: 488377423
2022-11-14 18:08:57 +00:00
Googler
39d28304af Add 'Player.getVideoSurfaceSize' that returns the size of the surface
on which the video is rendered.

Design Doc: go/aaos-mu-media-dd

PiperOrigin-RevId: 485884772
2022-11-08 14:09:54 +00:00
Lev
5609efd0e0 Added UTF-16 (LE) and UTF-16 (BE) support for subrip subtitles. 2022-11-05 10:40:01 +03:00
rohks
55b82ff8ae Disable failing tests of FlacExtractorSeekTest
PiperOrigin-RevId: 485061783
2022-11-01 16:19:10 +00:00
samrobinson
c9585d0154 Add AudioProcessor.AudioFormat equals method.
PiperOrigin-RevId: 483983486
2022-10-31 16:18:55 +00:00
samrobinson
ad52b68c73 Move DefaultAudioSink.AudioProcessorChain to AudioProcessorChain
Split inner interface into separate file, which will go in common
module. The old interface will be deprecated and extends the new.

#cleanup

PiperOrigin-RevId: 483732226
2022-10-31 16:07:28 +00:00
samrobinson
dda17db261 Move AudioProcessor to common.
PiperOrigin-RevId: 483699606
2022-10-31 16:03:50 +00:00
claincly
f5ad4e098d Add GL utility methods to get 4x4 identity and set identity
PiperOrigin-RevId: 483671580
2022-10-31 16:00:16 +00:00
Googler
bec504f1ac Add tofunmi to copy.bara.sky
PiperOrigin-RevId: 483386971
2022-10-31 15:45:40 +00:00
bachinger
a8e6894ad6 Add DAI specific methods to AdPlaybackState
PiperOrigin-RevId: 482755468
2022-10-24 10:59:21 +00:00
Googler
897722071e Corrected ordering of javadoc params
PiperOrigin-RevId: 482231370
2022-10-24 10:39:27 +00:00
huangdarwin
9e1adee4cb HDR: Support RGBA_1010102 in GlUtil as a parameter.
Make it easier to support use of RGBA_101012 rather than RGBA_8888 for EGL
contexts, displays, and surfaces.

This tangentially supports adding HDR tests, by slightly simplifying the color
selection logic we'd have to add in HDR tests.

PiperOrigin-RevId: 482219428
2022-10-24 10:35:28 +00:00
bachinger
28c4be2f6b Map lib-effect from androidx to exoplayer2
PiperOrigin-RevId: 482179761
2022-10-20 03:15:38 +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
bachinger
fd315dadeb Add copybara annotated import statement for special cases
PiperOrigin-RevId: 481605567
2022-10-20 02:31:42 +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
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
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
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
samrobinson
8589397ffe Clarify PlaybackParameters constructor range.
PiperOrigin-RevId: 476937845
2022-10-20 00:04:48 +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
bachinger
072f376b48 Add withAvailableAd for server side inserted ad groups
#minor-release

PiperOrigin-RevId: 472714732
2022-10-19 21:33:13 +00:00