343 Commits

Author SHA1 Message Date
bachinger
0a2a20d4fb Skip played live ad media periods
This change makes sure that live ad periods that are played are
skip when attempted to be added to the queue. To make this work
the existing filter logic had to be take into account the content
resume offset that live periods use.

PiperOrigin-RevId: 518068138
2023-03-21 14:20:43 +00:00
tofunmi
de3678e461 Remove glUtil.clearOutputFrame from GLObjectsProvider.
d288891c77 added clearing depth buffers to GLUtil, so there is no need to have allow apps to have a custom clearOutputFrame.
Also removes default implementations in GLObjectsProvider know that these methods have been implemented.

PiperOrigin-RevId: 517156304
2023-03-21 14:13:59 +00:00
tofunmi
d288891c77 Clear depth buffers in glUtil.clearOutputFrame.
[GL documentation for glClear](https://registry.khronos.org/OpenGL-Refpages/gl4/html/glClear.xhtml) says "If a buffer is not present, then a glClear directed at that buffer has no effect." so it's okay to clear the depth buffer even if there isn't one set.

Also manually tested to have no impact when contrast effect and dizzy crop effect form transformer demo was added to image/video input.

PiperOrigin-RevId: 516879598
2023-03-16 15:32:45 +00:00
tonihei
137b40b76f Bump version numbers to Media3 1.0.0 and ExoPlayer 2.18.5
#minor-release

PiperOrigin-RevId: 516514583
2023-03-14 15:56:30 +00:00
tofunmi
82c9479dd2 Update GlObjectsProvider to cover creating surface.
PiperOrigin-RevId: 516300480
2023-03-14 07:56:05 +00:00
christosts
7cf758f837 Log Format.colorInfo
Log Format.colorInfo in EventLogger and the demo app's debug text.

#minor-release

PiperOrigin-RevId: 516172936
2023-03-14 07:53:43 +00:00
bachinger
2dee3bf46c Ignore live SSAI postroll placeholders in MediaPeriodQueue
This change makes sure that the `AdPlaybackState` of any period can
contain an empty postroll placeholder.

The placeholder postroll should be represented in the `MediaPeriodId`
of a content period as `nextAdGroupIndex`, but should be ignored when
building the list of `MediaPeriodInfo` in the `MediaPeriodQueue`. This
is required to allow to add an ad group to ad playback state of the
content period that is currently being played, instantly insert an ad
period into the media period queue and immediately transition playback
to the new period.

This change makes sure and tests that

- a live server side inserted postroll placeholder can be inserted to
  a `AdPlaybackState` in well-defined and tested way (helper method)
- a postroll placeholder is NOT ignored when
  `AdPlaybackState.getAdGroupIndexAfterPositionUs` is called (this
   is required when evaluating the `nextAdGroupIndex`).
- a postroll placeholder is ignored when
  `AdPlaybackState.getAdGroupIndexForPositionUs` is called (this is
  required to not attempt to play the ad and is analogous to ignore the
  post roll placeholder in a single period timeline).
- `MediaPeriod.getFollowingMediaPeriodInfo()` does not include a
  `MediaPeriodInfo` for the placeholder postroll when building the
   queue.

PiperOrigin-RevId: 515079136
2023-03-14 07:44:55 +00:00
tofunmi
e478d81b52 Update effect to take in and use a GlObjectsProvider
PiperOrigin-RevId: 514744747
2023-03-14 07:33:25 +00:00
huangdarwin
fe7f3d51df GL: Reduce visibility of GlProgram.loadAsset.
This is only used within the same class, so can be private.

PiperOrigin-RevId: 514665000
2023-03-07 11:57:41 +00:00
tofunmi
7303caffb5 Create GlObjectsProvider
To create this file TextureInfo has been moved to common and renamed to GLTextureInfo.

We'll look to expand the interface in future to cover more of the methods around GL object maintenance in future as required.

PiperOrigin-RevId: 514445397
2023-03-07 11:56:08 +00:00
huangdarwin
729066fbd6 GL: Delete frame buffers after use.
Before, we used to never call glDeleteFramebuffers, which could
in theory lead to leaks in the number of frame buffers
available and make releasing the GL context more expensive.

PiperOrigin-RevId: 514387847
2023-03-07 11:52:01 +00:00
sheenachhabra
a81a5f2699 Create orientation matrix byte array using util method
PiperOrigin-RevId: 514375835
2023-03-07 11:51:13 +00:00
ibaker
cb7d565fd4 Add missing @param tags
Dackka generates a warning if a method has at least one `@param` tag,
but not all of them are documented.

#minor-release

PiperOrigin-RevId: 513873453
2023-03-07 11:49:24 +00:00
ibaker
5d23a92923 Ensure ForwardingPlayer users do listener registration correctly
The `@CallSuper` annotation should help catch cases where subclasses are
calling `delegate.addListener` instead of `super.addListener` but it
will also (unintentionally) prevent subclasses from either completely
no-opping the listener registration, or implementing it themselves in a
very custom way. I think that's probably OK, since these cases are
probably unusual, and they should be able to suppress the warning/error.

Issue: androidx/media#258

#minor-release

PiperOrigin-RevId: 513848402
2023-03-07 11:47:49 +00:00
tonihei
cd753bd7b8 Bump version numbers to Media3 1.0.0-rc02 and ExoPlayer 2.18.4
#minor-release

PiperOrigin-RevId: 513488487
2023-03-02 13:25:15 +00:00
ibaker
c07cf3dc41 Remove @see tags with <a> tags
These are not supported by Dackka

#minor-release

PiperOrigin-RevId: 513176533
2023-03-01 17:25:48 +00:00
christosts
42fae152d0 Minor change in ForwardingPlayer javadoc
#minor-release

PiperOrigin-RevId: 512897269
2023-03-01 17:23:40 +00:00
tonihei
93e117928c Do not specify export flags for protected system broadcasts.
Protected system broadcasts should not specify the export flag.
Marking them as NOT_EXPORTED breaks sticky broadcasts in some
cases.

Issue: google/ExoPlayer#10970

#minor-release

PiperOrigin-RevId: 512020154
2023-02-27 18:39:07 +00:00
huangdarwin
465301da7c MediaFormatUtil: Reduce Color API 29 restriction to API 24.
Implement getMediaFormatInteger, a helper method simulating mediaformat.getInteger(name, defaultValue).

This reduces the API 29 restriction from MediaFormatUtil.getColorInfo to API 24, in
particular removing the method-based restriction to a constant-based restriction,
so that we can reduce usage of the API 29 class.

This also allows us to slightly simplify prior use-cases where we'd check
containsKey and getInteger to have a default value.

PiperOrigin-RevId: 511184301
2023-02-27 18:18:53 +00:00
kimvde
d0dc4817c6 Rename transformation to export in DebugViewProvider
PiperOrigin-RevId: 511173451
2023-02-27 18:16:54 +00:00
huangdarwin
ece49e3515 Effects: Update javadoc to link to method.
PiperOrigin-RevId: 510077348
2023-02-17 11:44:05 +00:00
huangdarwin
cf768329e6 Effect: Rename FrameProcessor
Rename FrameProcessor to VideoFrameProcessor, and GlEffectsFrameProcessor to
DefaultVideoFrameProcessor.

Most changes are semi-mechanical, semi-manual find-replace, preserving case:
* "FrameProc" -> "VideoFrameProc" (ex. FrameProcessor -> VideoFrameProcessor, and
   FrameProcessingException -> VideoFrameProcessingException)
* "GlEffectsVideoFrameProc" -> "DefaultVideoFrameProc"

PiperOrigin-RevId: 509887384
2023-02-17 11:41:06 +00:00
andrewlewis
41a03dd8a6 Fix some minor nits
PiperOrigin-RevId: 509879029
2023-02-17 11:40:13 +00:00
tofunmi
7e33bdfc94 Change FrameProcessor.create() inputTrackType parameter to a boolean
PiperOrigin-RevId: 509808913
2023-02-15 18:17:52 +00:00
christosts
20eae0e041 Version bump for ExoPlayer 2.18.3 & media3-1.0.0-rc01
#minor-release

PiperOrigin-RevId: 509501665
2023-02-14 13:49:22 +00:00
claincly
3aca3ad170 Use ColorInfo.Builder in transformer and common.
Because the ColorInfo constructor is deprecated.

PiperOrigin-RevId: 509468663
2023-02-14 10:28:33 +00:00
claincly
749c10ad1e Add error codes to reflect failures in using effects.
PiperOrigin-RevId: 509461955
2023-02-14 09:54:32 +00:00
tofunmi
574424f626 Update frame & texture processors to handle SDR image input
GLEffectsFrameProcessor, MatrixShaderProgram and FinalMatrixShaderProgramWrapper are currently setup to handle the input frames coming from an external input (i.e. a video decoder). Image input is loaded into Bitmap objects at the start of the pipeline, so they are not produced externally. The changes provide a way for the frame processing pipeline to handle this "internal" (i.e. non-external) input.

PiperOrigin-RevId: 508645244
2023-02-10 14:32:07 +00:00
tonihei
6066ce43f6 Document spatialization behavior constants.
PiperOrigin-RevId: 508602059
2023-02-10 10:08:46 +00:00
huangdarwin
ca4d2be1fa Effect: Rename TextureProcessor to ShaderProgram.
Also, replace instances of "texture processor" to "shader program", with capitalization retained.

PiperOrigin-RevId: 507515655
2023-02-08 14:04:09 +00:00
tofunmi
4e3c6c6167 Update sample pipelines and frame processors to handle image input.
PiperOrigin-RevId: 506965394
2023-02-08 13:58:50 +00:00
tofunmi
f67569d2dd Update FrameProcessor.create() to accept an input track type.
Based on [this conversation thread](https://chat.google.com/room/AAAA--f88ao/76Rem_cRCK8), I've opted to update the existing FrameProcessor.create() rather than deprecate it, as it is unlikely to be in use by apps outside google3.

PiperOrigin-RevId: 506920930
2023-02-08 13:57:02 +00:00
claincly
4a1cf3d839 Support flushing in FrameProcessor
Flushing resets all the texture processors within the `FrameProcessor`. This
includes:

- At the back, the FinalMatrixTextureProcessorWrapper, and its MatrixTextureProcessor
- At the front, the ExternalTextureManager
- All the texture processors in between
- All the ChainingGlTextureProcessorListeners in between texture processors
- All the internal states in the aforementioned components

The flush process follows the order, from `GlEffectsFrameProcessor.flush()`

1. Flush the `FrameProcessingTaskExecutor`, so that after it returns, all tasks queued before calling `flush()` completes
2. Post to `FrameProcessingTaskExecutor`, to flush the `FinalMatrixTextureProcessorWrapper`
3. Flushing the `FinalMatrixTextureProcessorWrapper` will propagate flushing through, via the `ChainingGlTextureProcessorListener`

Startblock:
   has LGTM from christosts
   and then
   add reviewer andrewlewis
PiperOrigin-RevId: 506296469
2023-02-02 15:33:05 +00:00
christosts
c6569a36fb Merge pull request #10793 from fraunhoferfokus:dash-thumbnail-support
PiperOrigin-RevId: 506261584
2023-02-02 15:30:08 +00:00
samrobinson
5e44af0ad9 Generalise UnhandledAudioFormatException for non-input use cases.
PiperOrigin-RevId: 505084963
2023-02-01 10:24:59 +00:00
huangdarwin
b251b8db09 Effect: Clarify FrameProcessingException javadocs.
This is confusing, since the effect is used not only when applying an effect, but also when preparing an effect (ex. in a texture processor's constructor), so we should also mention that case.

PiperOrigin-RevId: 504843598
2023-02-01 10:15:39 +00:00
ibaker
280889bc4a Explicitly document most Player.Listener methods in terms of getters
This makes it implicitly clear that if the value of a getter changes due
to a change in command availability then the listener will be invoked,
without needing to explicitly document every command on every listener
method.

#minor-release

PiperOrigin-RevId: 503178383
2023-01-23 12:30:18 +00:00
tonihei
f15b752543 Extend command GET_CURRENT_MEDIA_ITEM to more methods.
We currently only document it for the getCurrentMediaItem(), but
the command was always meant to cover all information about the
current media item and the position therein.

To correctly hide information for controllers, we need to filter
the Timeline when bundling the PlayerInfo class if only this
command is available.

PiperOrigin-RevId: 503098124
2023-01-23 12:25:48 +00:00
tonihei
69cfba7c53 Correctly filter PlayerInfo by available getter commands.
When bundling PlayerInfo, we need to remove information if the
controller is not allowed to access it. This was only partially
done at the moment.

PiperOrigin-RevId: 502852798
2023-01-23 12:22:33 +00:00
tonihei
c90ca7ba5f Make availableCommands known when bundling PlayerInfo
When bundling PlayerInfo, we remove data when the controller is not
allowed to access this data via getters. We also remove data for
performance reasons. In the toBundle() method, it's currently hard to
make the connection between allowed commands and filtering, because
the values are checked at a different place. This can be made more
readable by forwarding the applicable Commands directly.

The only functional fix is to filter the Timeline when sending the
first PlayerInfo after a connecting a controller if the command to
get the Timeline is not available. This also allows us to remove a
path to filter MediaItems from Timelines as it isn't used.

PiperOrigin-RevId: 502607391
2023-01-18 12:02:09 +00:00
sheenachhabra
d9185235e9 Align muxer code with media3 coding conventions.
This CL includes following changes:
1. Remove GCA related terms/links from java docs and comments.
2. Make class final where ever possible.
3. Append /* package */ for default classes.
4. Change java docs to recommended format.
5. Replace term "packet" with "sample" to avoid confusion.
6. Correct TODO format.
7. Delete MediaFormatUtil.java from muxer module and add its methods into MediaFormatUtil.java in common module.

Note: The java doc on various boxes has the limited description which was already present. In future I am planning to add proper small description for each box (from MP4 spec).

Not included in this CL:
1. Order of element correction as it will show lot of changes and might create confusion with other minor changes.
2. Correction in test cases (Only some renaming).

PiperOrigin-RevId: 502414139
2023-01-17 02:13:33 +00:00
kimvde
15ba0c5fa6 Add the possility to shift frame timestamps in SampleConsumer
This is needed for constrained multi-asset to shift the timestamps of
the media items that are not the first in the sequence.

PiperOrigin-RevId: 502409923
2023-01-17 02:12:48 +00:00
huangdarwin
0f45570302 HDR: Use human-readable values for ColorInfo.toString().
This should make debugging much easier as values will be more human-readable.
Before this CL, one needed to reference MediaFormatUtil to check the
colorSpace/colorTransfer/colorRange values and make sure values were as
expected.

PiperOrigin-RevId: 502367147
2023-01-17 02:09:35 +00:00
samrobinson
1eeccb6c69 Move SonicAudioProcessor to media3.common module.
PiperOrigin-RevId: 501881646
2023-01-17 02:04:57 +00:00
samrobinson
3c4b4729da Make ToInt16AudioProcessor available in common.audio.
PiperOrigin-RevId: 501575932
2023-01-17 01:56:56 +00:00
samrobinson
d2c5a1bfb9 Move BaseAudioProcessor abstract class to common.
This is a prerequisite step to making the `ResamplingAudioProcessor` public.

PiperOrigin-RevId: 501545561
2023-01-17 01:55:29 +00:00
tofunmi
a9135e2eff Move BitmapLoader to common.
The migration strategy is to deprecate `androidx.media3.session.BitmapLoader` and copy the file into common since BitmapLoader is a public interface that apps could be relying on.

PiperOrigin-RevId: 501266521
2023-01-17 01:50:18 +00:00
kimvde
2331142930 Indicate that some FrameProcessor methods can be called on any thread
The FrameProcessor is created on the GL thread, but:
- setInputFrameInfo() is currently called from the playback thread.
- release() is currently called from the transformer internal thread.

PiperOrigin-RevId: 501035719
2023-01-17 01:44:22 +00:00
rohks
578f2de48f Initialise fields used for bundling as String directly
Initialising the fields as Integer and then getting a String on compute time is slow. Instead we directly initialise these fields as String. Improves the time taken in bundling PlayerInfo further to less than 200ms from ~300ms.

Also modified a test to improve productive coverage.

PiperOrigin-RevId: 500003935
2023-01-10 18:33:20 +00:00
rohks
790e27d929 Optimise bundling for Timeline.Window and Timeline.Period
Improves the time taken to construct playerInfo from its bundle from ~400 ms to ~300 ms.

Also made `Timeline.Window.toBundle(boolean excludeMediaItem)` public as it was required to assert a condition in tests.

PiperOrigin-RevId: 499512353
2023-01-04 21:57:23 +00:00