17739 Commits

Author SHA1 Message Date
kimvde
4094aef9a5 Rename inputFormat to firstInputFormat in multiple places
With multi-asset, the sample pipelines can process more than one
MediaItem. The renaming makes it clear that the format passed to the
SamplePipeline constructors is the one corresponding to the first
MediaItem. Indeed, the first format is the one used to configure the
SamplePipelines.

PiperOrigin-RevId: 506879260
2023-02-08 13:48:59 +00:00
samrobinson
ed5af63227 Turn off ExoPlayer metrics reporting when used by Transformer.
This avoids affecting ExoPlayer metrics with non-typical usage.

PiperOrigin-RevId: 506878231
2023-02-08 13:48:06 +00:00
tofunmi
bffa6a9653 Update duration & frame rate javadoc in EditedMediaItem
PiperOrigin-RevId: 506874799
2023-02-08 13:47:10 +00:00
kimvde
b5bb6e7619 Add MediaItem change listener
PiperOrigin-RevId: 506868341
2023-02-08 13:46:17 +00:00
kimvde
77ae41354e Use CompositeAssetLoader in Transformer
PiperOrigin-RevId: 506863538
2023-02-08 13:45:22 +00:00
huangdarwin
f2cfb14be4 HDR: Fix debug surface by setting correct output color.
Set the correct output color on the debug SurfaceViewWrapper, so that SDR contents
can have an output transfer of either GAMMA_2_2 (Gamma 2.2) or SDR (SMPTE 170M).

This fixes an issue where in-app tone-mapping would output gamma 2.2, and the
SDR value incorrectly hardcoded here would lead to an error in the OpenGL, which
does not support SMPTE 170M.

PiperOrigin-RevId: 506684602
2023-02-08 13:44:31 +00:00
tofunmi
47b59f98e1 Add ImageAssetLoader and ImageConfiguration.
PiperOrigin-RevId: 506619637
2023-02-08 13:43:40 +00:00
christosts
f983d912e5 Fix release note entry 2023-02-02 16:49:56 +00:00
christosts
9bf18dbb4e Session: advertise legacy FLAG_HANDLES_QUEUE_COMMANDS
This change includes 3 things:
- when the legacy media session is created, FLAG_HANDLES_QUEUE_COMMANDS
  is advertised if the player has the COMMAND_CHANGE_MEDIA_ITEMS
  available.
- when the player changes its available commands, a new
  PlaybackStateCompat is sent to the remote media controller to
  advertise the updated PlyabackStateCompat actions.
- when the player changes its available commands, the legacy media
  session flags are sent accoridingly: FLAG_HANDLES_QUEUE_COMMANDS is
  set only if the COMMAND_CHANGE_MEDIA_ITEMS is available.

#minor-release

PiperOrigin-RevId: 506605905
(cherry picked from commit ebe7ece1eb7e2106bc9fff02db2666410d3e0aa8)
2023-02-02 16:47:10 +00:00
bachinger
065418cc28 Publish ConcatenatingMediaSource2
Can be used to combine multiple media items into a single timeline window.

Issue: androidx/media#247
Issue: google/ExoPlayer#4868
PiperOrigin-RevId: 506283307
(cherry picked from commit fcd3af6431cfcd79a3ee3cc4fee38e8db3c0554e)
2023-02-02 16:47:09 +00:00
christosts
d49bd456b6 Merge pull request #10793 from fraunhoferfokus:dash-thumbnail-support
PiperOrigin-RevId: 506261584
(cherry picked from commit c6569a36fbce6fc3ece55c9a904508bd4a4c45da)
2023-02-02 16:47:09 +00:00
christosts
ebe7ece1eb Session: advertise legacy FLAG_HANDLES_QUEUE_COMMANDS
This change includes 3 things:
- when the legacy media session is created, FLAG_HANDLES_QUEUE_COMMANDS
  is advertised if the player has the COMMAND_CHANGE_MEDIA_ITEMS
  available.
- when the player changes its available commands, a new
  PlaybackStateCompat is sent to the remote media controller to
  advertise the updated PlyabackStateCompat actions.
- when the player changes its available commands, the legacy media
  session flags are sent accoridingly: FLAG_HANDLES_QUEUE_COMMANDS is
  set only if the COMMAND_CHANGE_MEDIA_ITEMS is available.

#minor-release

PiperOrigin-RevId: 506605905
2023-02-02 15:38:04 +00:00
claincly
a817bd42e2 Fix end of stream handling for previewing.
Before this CL, the `renderedLastFrame` flag is not set if the last frame is released immediately (force render), or when it's dropped.

PiperOrigin-RevId: 506358626
2023-02-02 15:37:01 +00:00
claincly
0f4fcc1110 Report flushing completed after all pending frames are decoded.
With the current ExtTexMgr,

it can happen that

- `x` frames are registered, but haven't arrived yet
- flush
  - need to drop `x` frames when they arrive on SurfaceTexture
  - status is reset to 0 pending, 0 available, drop `x` when frames arrive
- register one frame
  - status is set to 1 pending, 0 available, drop `x` when frames arrive
- flush
  - now the number of frame to drop is reset to `pending - available = 1`
  - but it should be `x+1`

This CL solves the issue by reporting (by running the afterFlushTask) flush completes only after all the pending frames before calling flush are accounted for.

PiperOrigin-RevId: 506310671
2023-02-02 15:36:02 +00:00
samrobinson
656a1d9475 Clarify case where HDR encoder and muxer have no shared mime type.
The prior version (with the call to createEncodingException) could
never occur as select...SupportedMimeType already checks for HDR
editing support. This change ensures we throw before creating an
encoder, gives a better error code and allows future simplifications
around createForCodec (see child CL).

PiperOrigin-RevId: 506308290
2023-02-02 15:35:00 +00:00
kimvde
1c912e5c50 Pass a Composition to Transformer callbacks
PiperOrigin-RevId: 506304101
2023-02-02 15:34:03 +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
tofunmi
eb6c1a5254 Add sRGB eotf to overlay fragment shader.
The eotf is needed so that overlay (image) colors are correctly interpreted and mixed the linear video colors.

Also replaces the 100winners.png with "homemade" image file.

Added GlEffectsFrameProcessor test to justify that the color looks correct at the end of frame processing.

PiperOrigin-RevId: 506290309
2023-02-02 15:32:08 +00:00
bachinger
fcd3af6431 Publish ConcatenatingMediaSource2
Can be used to combine multiple media items into a single timeline window.

Issue: androidx/media#247
Issue: google/ExoPlayer#4868
PiperOrigin-RevId: 506283307
2023-02-02 15:31:12 +00:00
christosts
c6569a36fb Merge pull request #10793 from fraunhoferfokus:dash-thumbnail-support
PiperOrigin-RevId: 506261584
2023-02-02 15:30:08 +00:00
ibaker
791c05b57a Fix (another) LeanbackPlayerAdapter param name mismatch
I missed this when fixing `positionInMs` for Dackka in aae6941981

This time I manually verified that all the `@Override` methods have
parameter names that match [the docs](https://developer.android.com/reference/androidx/leanback/media/PlayerAdapter).

#minor-release

PiperOrigin-RevId: 506017063
(cherry picked from commit d1a27bf2a81709bc7b03ad130bc9abd4d8b27164)
2023-02-02 13:22:39 +00:00
bachinger
5528baaad9 Do not assume a valid queue in 3rd party sessions
This change fixes an issue that can be reproduced when
a controller `onConnect` creates a `QueueTimeline` out
of the state of a legacy session and then `prepare` is called.

`activeQueueItemId`, `metadata` and the `queue` of the legacy
session are used when a `QueueTimeline` is created. The change
adds unit tests to cover the different combinatoric cases these
properties being set or unset.

PiperOrigin-RevId: 505731288
(cherry picked from commit 4a9cf7d069b1b35be807886d59d87c396b19876c)
2023-02-02 13:22:38 +00:00
bachinger
bfc4ed4dd4 Inline method in PlayerService that is used from on call site only
#cleanup
#minor-release

PiperOrigin-RevId: 505146915
(cherry picked from commit d7ef1ab5bd5a4508c0913011f5990bb03a57585a)
2023-02-02 13:22:38 +00:00
tonihei
631ff809f5 Fix timestamp comparison for seeks in fMP4
When seeking in fMP4, we try to extract as little samples as possible
by only starting at the preceding sync frame. This comparison should
use <= to allow sync frames at exactly the seek position.

Issue: google/ExoPlayer#10941

PiperOrigin-RevId: 505098172
(cherry picked from commit 00436a04a4f0fec8ee9154fc1568ca4013ca5c7d)
2023-02-02 13:22:33 +00:00
bachinger
bcdedb719d Double tap detection for Bluetooth media button events only
Issue: androidx/media#233
#minor-release
PiperOrigin-RevId: 505078751
(cherry picked from commit 5c82d6bc18429842160bb64a851bb1ab5c89ec39)
2023-02-02 13:18:30 +00:00
michaelkatz
c37442b24d Match MergingMediaPeriod track selection by period index in id
MergingMediaPeriod creates its track groups with ids concatenating position in its periods array and the underlying child track group id. The ids can be used in selectTracks for matching to periods list.

Issue: google/ExoPlayer#10930
PiperOrigin-RevId: 505074653
(cherry picked from commit 542a1ef03f361b29ec731a7334b2922cb54ef4c9)
2023-02-02 13:18:30 +00:00
tonihei
5e6f79ae63 Tweak UI behavior when commands are missing.
For most missing commands, we already disable the corresponding
controls. This change extends this to more UI elements that are
disabled in case the corresponding action is unavailable.

#minor-release

PiperOrigin-RevId: 505057751
(cherry picked from commit b3e7696ba7d66a2d3c477858194a20789f4d75c7)
2023-02-02 13:18:29 +00:00
Balachandar KM
3c09cbd8d4
Handle SQLiteException when trying to accessing DatabaseProvider#getReadableDatabase() 2023-02-02 10:54:06 +00:00
bachinger
eb8fffba15 Publish ConcatenatingMediaSource2
Can be used to combine multiple media items into a single timeline window.

Issue: androidx/media#247
Issue: google/ExoPlayer#4868
PiperOrigin-RevId: 506283307
2023-02-01 15:36:40 +00:00
christosts
107e0c6e42 Merge pull request #10793 from fraunhoferfokus:dash-thumbnail-support
PiperOrigin-RevId: 506261584
2023-02-01 15:32:27 +00:00
claincly
6ce23f6eee Render PQ to DebugSurface in transformer.
For HLG input in transformer, FinalWrapper is configured to only output HLG to
encoder. But since DebugPreview is configured to take PQ for HDR content, the
color will not look correct.

This CL allows overriding the MatrixTP output transfer function, so
that FinalWrapper can output

- HLG to encoder
- PQ to debug preview

PiperOrigin-RevId: 506022840
2023-02-01 15:28:10 +00:00
huangdarwin
b57d5dd3fa Effect: Allow SingleFrameGlTextureProcessor to throw errors.
Implementations outside media3 should be able to throw FrameProcessingException if they come across an error during configure().

PiperOrigin-RevId: 506020149
2023-02-01 15:23:55 +00:00
ibaker
736f090cce Fix (another) LeanbackPlayerAdapter param name mismatch
I missed this when fixing `positionInMs` for Dackka in d2a3d8f6fa

This time I manually verified that all the `@Override` methods have
parameter names that match [the docs](https://developer.android.com/reference/androidx/leanback/media/PlayerAdapter).

#minor-release

PiperOrigin-RevId: 506017063
2023-02-01 15:19:45 +00:00
claincly
f0b7dfc71d Don't release a frame when not force rendering when paused.
And rename method `releaseOutputFrame` to `releaseProcessedFrameInternal` for consistency.

Removed misplaced comment.

PiperOrigin-RevId: 506005744
2023-02-01 15:15:38 +00:00
kimvde
c67cfbf8ce Undeprecate startTransformation(MediaItem, String)
This overload is helpful to apps transcoding a MediaItem without edits.

PiperOrigin-RevId: 505987852
2023-02-01 15:11:33 +00:00
kimvde
8caf836053 Make Composition fields public
Transformer callbacks will take a Composition instead of a MediaItem.
Apps should be able to see what this Composition contains.

PiperOrigin-RevId: 505976561
2023-02-01 15:07:31 +00:00
claincly
baf8ee570c Make sure the first frame is force rendered.
PiperOrigin-RevId: 505960752
2023-02-01 15:03:23 +00:00
huangdarwin
e7ac678ba4 HDR: Add device checks and mh for GL tone mapping PixelTests.
Add checks to GL tone-mapping pixel tests, to ensure the device's decoder, API
version, and OpenGL implementation support GL tone-mapping before attempting it.

These tests should be run on mobile harness, to detect per-device failures, and
so are moved to transforemr/mh. Per b/263395272, these tests should ultimately
be in an effect/mh directory.

PiperOrigin-RevId: 505749974
2023-02-01 14:59:13 +00:00
andrewlewis
506aa2c999 Instantiate SurfaceView on main thread
On some devices/builds it seems that the `SurfaceView` constructor tries to create a handler. Move instantiation to the main thread when getting the debug surface view so that handler creation succeeds.

PiperOrigin-RevId: 505745387
2023-02-01 14:55:01 +00:00
samrobinson
d7cc12c0da Add check for isIdentity in ChannelMappingMatrix.
Make clearer the intermediate matrix property names.

PiperOrigin-RevId: 505732563
2023-02-01 14:50:46 +00:00
samrobinson
4f61c73df9 Add ChannelMixingMatrix property unit tests.
PiperOrigin-RevId: 505720834
2023-02-01 14:46:24 +00:00
kimvde
e7bc263c4d Pass an EditedMediaItem to AssetLoader.Factory
PiperOrigin-RevId: 505671326
2023-02-01 14:42:11 +00:00
kimvde
47b32594ee Add error message if track is added during transformation
PiperOrigin-RevId: 505670386
2023-02-01 14:38:00 +00:00
kimvde
4a66ad5dd1 Remove ParcelFileDescriptor output from Transformer
ParcelFileDescriptor is quite specific and removing it allows to have
less overloads of startTransformation.

A follow-up CL will undeprecate the overload that takes a MediaItem.

PiperOrigin-RevId: 505670321
2023-02-01 14:33:43 +00:00
tonihei
4a942adbc6 Force AudioTrack-based speed changes when offload is enabled
AudioProcessor-based speed changes are not supported with
offload, so we should use the AudioTrack-based speed changes
by default if the user requests a speed change.

This moves the decision of which speed change path is used
into the Configuration, so that it can change for each
AudioTrack in a playlist.

PiperOrigin-RevId: 505621911
2023-02-01 14:29:31 +00:00
huangdarwin
fef3e804a0 Transformer: Make it clear that getExpectedColorInfo is input.
Otherwise, it's not clear if it's the expected output.

Renaming-only change. No functional change intended.

PiperOrigin-RevId: 505103740
2023-02-01 14:25:17 +00:00
tonihei
ac3017b580 Fix timestamp comparison for seeks in fMP4
When seeking in fMP4, we try to extract as little samples as possible
by only starting at the preceding sync frame. This comparison should
use <= to allow sync frames at exactly the seek position.

Issue: google/ExoPlayer#10941

#minor-release

PiperOrigin-RevId: 505098172
2023-02-01 14:20:57 +00:00
tonihei
6444562a2b Simplify playback parameter state tracking in DefaultAudioSink
This makes it easier to reason about some parts of the code and
will eventually allow to easily switch between AudioProcessor-
based on AudioSink-based speed adjustment.

The current state saves the applicable playback parameters
in separate variables depending on which speed adjustment
path is used. Moreover, the AudioProcessor-based logic keeps
a chain of pending parameter changes and we derive the last
applicable one everytime we need the current parameters.

After this change, this is simplified by
 - keeping a common value for playback parameters independent
   of the actual path we use for adjustment.
 - keeping the final ("current") parameters directly, instead
   of deriving it from a chain of yet to be applied parameters.

PiperOrigin-RevId: 505097294
2023-02-01 14:16:44 +00:00
samrobinson
f924fcb8b4 Generalise UnhandledAudioFormatException for non-input use cases.
PiperOrigin-RevId: 505084963
2023-02-01 14:12:25 +00:00
michaelkatz
ee055ef004 Match MergingMediaPeriod track selection by period index in id
MergingMediaPeriod creates its track groups with ids concatenating position in its periods array and the underlying child track group id. The ids can be used in selectTracks for matching to periods list.

Issue: google/ExoPlayer#10930
PiperOrigin-RevId: 505074653
2023-02-01 14:08:04 +00:00