17739 Commits

Author SHA1 Message Date
tonihei
bc873536f3 Update docs and READMEs for media3 stable release
- The ExoPlayer docs will link to the media3 ones (for now, we can
   permanently redirect once no further stand-alone ExoPlayer release
   is published).
 - Contibuting issues and PRs should only happen on the media3 repo.
 - The media3 README is updated to remove any pre-release status
   information.

PiperOrigin-RevId: 516234594
2023-03-14 07:55:12 +00:00
tianyifeng
796412b4be Detect audio device change from API 23 with AudioCapabilitiesReceiver
* Add AudioDeviceCallbackApi23 class which extends the AudioDeviceCallback.
* Add registerAudioDeviceCallback and unregisterAudioDeviceCallback methods for Api23.
* Modify the logics of AudioCapabilitiesReceiver constructor, register and unregister methods.

PiperOrigin-RevId: 516183997
2023-03-14 07:54:31 +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
d1534680e9 Support splitting the ad playback state for live streams
This change does basically three things in preparation of a follow
up CL that will insert ad breaks into multi-period live windows.

- Make sure that only `AdPlaybackState`s of multi-period streams
  are passed to `ImaUtil.splitAdPlaybackStateForPeriods()` from
  the media source.
- Enhance the splitting algorithm in ImaUtil to support live windows.
  Roughly, this includes calculating the window start position in the
  UNIX epoch context, handling the end period with an unknown duration
  and taking the `adResumePosition` of an ad group into account that
  affects the ad group start positions (`adGroup.timeUs`).
- Append a placeholder postroll ad group to the ad playback state of
  each period in a live stream to allow immediate transition to an
  ad that's inserted by an ad event from the SDK.

PiperOrigin-RevId: 516167958
2023-03-14 07:52:58 +00:00
huangdarwin
f0d91b30d5 Effect: Implement TimestampWrapper.
To allow applying an effect only on a range of timestamps.

PiperOrigin-RevId: 515615662
2023-03-14 07:52:12 +00:00
samrobinson
a3e93f74cb Remove PCM encoding from ExportResult.
PCM encoding is a property of decoded audio, however Transformer does
not output decoded audio.

PiperOrigin-RevId: 515580886
2023-03-14 07:51:26 +00:00
kimvde
1865e38108 Add test for audio and video from different sources
PiperOrigin-RevId: 515379858
2023-03-14 07:50:18 +00:00
sheenachhabra
7031d2c6f4 Remove sample_h265.mp4 test file
The h265 encoding is getting covered in HDR test case (hdr10-720p.mp4) so having a separate asset is redundant here.

PiperOrigin-RevId: 515347662
2023-03-14 07:49:28 +00:00
sheenachhabra
1c9c384aaa Add support for writing MP4 location data using media muxer
PiperOrigin-RevId: 515297752
2023-03-14 07:48:20 +00:00
tofunmi
2c852ea7bb Replace bitmap overlay uri EditText with local file picker
PiperOrigin-RevId: 515283537
2023-03-14 07:47:10 +00:00
sheenachhabra
2f01f9c53b Add support for reading location data in MP4 extractor
The geodata is stored in the "udta" box as per MediaMuxer reference
https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/libstagefright/MPEG4Writer.cpp;drc=master;l=5588

PiperOrigin-RevId: 515095127
2023-03-14 07:46:28 +00:00
bachinger
c0a8b944a6 Use the ad group time as content position while playing an ad
The value returned by `player.getContentPosition()` is calculated
in the timeline based on the position of the first period in the
window. In a single period live stream this position is advanced
when the live window advances on timeline refresh.

This calculation has produced slightly varying values below 1000
us which are likely caused by us/ms truncations for public API
values that we use in the IMASSAIMediaSource.

However, `AdGroup.timeUs` is the (recorded) content position at the
moment when the first ad of the an ad group has been inserted. While
playing an ad, we can always use this value instead of
`getContentPosition()` to not require recalculation.

#minor-release

PiperOrigin-RevId: 515093177
2023-03-14 07:45:41 +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
Googler
6f25c74a95 [Media3][Test] Add save location to test utils for bitmap utils
Test plan: run tests on ImageX with saving

PiperOrigin-RevId: 515068443
2023-03-14 07:43:56 +00:00
kimvde
6d623bfad7 Split TransformerEndToEndTest
Split test/ TransformerEndToEndTest into SingleMediaItemEndToEndTest and
SingleSequenceEndToEndTest to reduce the file size and split the tests
by category.

PiperOrigin-RevId: 515039502
2023-03-14 07:42:55 +00:00
kimvde
bf60302cf2 Make sure errors thrown in the PlayerListener are not swallowed
PiperOrigin-RevId: 515037497
2023-03-14 07:42:10 +00:00
ibaker
0477d0d338 Restrict the visibility of some DefaultDrmSession methods
These are only used from within the package, so demote them from public
to package-private.

PiperOrigin-RevId: 515029018
2023-03-14 07:40:29 +00:00
tofunmi
68578be372 Update createStaticBitmapOverlay to take in context.
By making this method accept context, we can use DefaultDataSource.Factory in the DatasourceBitmapLoader to support a wider range on URI schemes in Bitmap Overlays. (and implement a local file picker for images for custom bitmap overlays in the demo transformer app)

PiperOrigin-RevId: 515013460
2023-03-14 07:39:43 +00:00
huangdarwin
b3023ffe9a Effect: Remove todo to consider using Gamma 2.2 everywhere.
Per testing, using gamma 2.2 everywhere resulted in undesirable color
shifting.

PiperOrigin-RevId: 515008279
2023-03-14 07:38:59 +00:00
kimvde
d152175e27 Remove VideoSamplePipeline unused param
PiperOrigin-RevId: 515002313
2023-03-14 07:38:10 +00:00
samrobinson
320d9a7ed2 Verify the audio properties being used within Transformer.
Add TransformerAudioEndToEndTest to emulated tests.

PiperOrigin-RevId: 514991434
2023-03-14 07:37:26 +00:00
tianyifeng
e052b63514 Handle dead object error during writing buffer to AudioTrack
PiperOrigin-RevId: 514989776
2023-03-14 07:36:43 +00:00
kimvde
67d15ec575 Fix threading issueis in SequenceAssetLoaderListener
Callbacks onTrackCount and onTrackAdded can be called simultaneously
from different threads.

Before this fix, it was possible for the MuxerWrapper and
FallbackListener track count to never be set, or to be set
with incorrect values.

PiperOrigin-RevId: 514779719
2023-03-14 07:35:25 +00:00
tonihei
62c0352416 Use current position code when checking if AudioTrack has pending data
We currently rely on the raw playback head position to check if any
data is pending in the AudioTrack (e.g. to know if the renderer is
still ready). We can use the value returned from getCurrentPositionUs
instead to align the "isReady" logic with the playback position logic.

This has the side effect that getPlaybackHeadPosition position is called
less often when the position is obtained via getTimestamp.

PiperOrigin-RevId: 514747613
2023-03-14 07:34:14 +00:00
tofunmi
e478d81b52 Update effect to take in and use a GlObjectsProvider
PiperOrigin-RevId: 514744747
2023-03-14 07:33:25 +00:00
tonihei
20669fca27 Document that custom commands can only be sent if they are defined
Custom commands from controller to session are blocked if they are
not listed in the available session command list. This isn't well
documented in the Javadoc currently.

#minor-release

PiperOrigin-RevId: 514733568
2023-03-14 07:32:36 +00:00
tonihei
788132b9dc Make DefaultDashChunkSource more robust against empty segment timelines
Segment timelines are technically allowed to be empty, but not all places
add the necessary checks.

Issue: google/ExoPlayer#11014
PiperOrigin-RevId: 514722205
2023-03-07 15:52:07 +00:00
samrobinson
f07e6b63ea Fix AudioMixer javadoc.
PiperOrigin-RevId: 514699994
2023-03-07 15:50:33 +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
samrobinson
3264cb8271 Pass Metadata to Muxer when adding a track.
PiperOrigin-RevId: 514575400
2023-03-07 11:56:53 +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
kimvde
5115df1147 Rename CompositeAssetLoader to SequenceAssetLoader
This clarifies that a SequenceAssetLoader loads data corresponding to an
EditedMediaItemSequence.

PiperOrigin-RevId: 514442681
2023-03-07 11:55:22 +00:00
tofunmi
fe38901028 ImageAssetLoaderTest minor fixes
PiperOrigin-RevId: 514436359
2023-03-07 11:54:36 +00:00
tofunmi
f4b88cd8a2 Add ImageAssetLoader tests.
PiperOrigin-RevId: 514431184
2023-03-07 11:53:36 +00:00
kimvde
0f8b67b875 Make onOutputFormat nullable
- This is to make sure we know about all the tracks before initializing
the SamplePipelines. This allows to set the muxer and the fallback
listener track count before the SamplePipelines are built.
- As a result, the test files had to be updated because the order in
which the tracks are written has changed.
- The ImageAssetLoader also had to be updated to call onOutputFormat
repeatedly until it returns a non-null SampleConsumer.
- Also fix the trackCount sent to the muxer and fallback listener. The
correct track count can be computed now that we know about all the
tracks before building the SamplePipelines.

PiperOrigin-RevId: 514426123
2023-03-07 11:52:52 +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
9c82923094 Update templates to more clearly signpost between exoplayer2 and media3
Issue: google/ExoPlayer#11031

#minor-release

PiperOrigin-RevId: 514366016
2023-03-07 11:50:24 +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
c0459e6ae1 Exclude test_session_{common,current} from API and Javadoc tests
We don't publish documentation for these, nor maven artifacts for them -
they only exist as source code on GitHub.

PiperOrigin-RevId: 513863141
2023-03-07 11:48:38 +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
tofunmi
efaf4e3f33 Remove effect/SimpleBitmapLoader & replace with DataSourceBitmapLoader
PiperOrigin-RevId: 513824487
2023-03-07 11:46:58 +00:00
kimvde
71fb4f9a5c Make sure that tracks are transcoded/transmuxed consistently
All audio tracks should either all be transcoded or all be transmuxed.
Same for video tracks.

To achieve this, simplify the behaviour of transmuxAudio/Video.

PiperOrigin-RevId: 513809287
2023-03-07 11:46:07 +00:00
samrobinson
07ba24ab1a Provide TransformerInternal with the AssetLoader output format.
TI can use this Format as part of creating the SamplePipelines.

PiperOrigin-RevId: 513777622
2023-03-07 11:45:16 +00:00
sheenachhabra
f23d6c1dc1 Fix nit issues in muxer end to end tests
Renamed MuxerEndToEndTest.java to Mp4MuxerEndToEndTest.java to align it with class under test.
Removed muxed prefix from dump file name because Mp4 implicitely means muxed only.

PiperOrigin-RevId: 513574681
2023-03-07 11:44:26 +00:00
tonihei
eb9e9eb841 Merge branch 'release' 2023-03-03 10:44:46 +00:00
tonihei
1ef427f640
Merge pull request #261 from androidx/release-1.0.0-rc02
1.0.0-rc02
2023-03-03 10:02:19 +00:00
tonihei
af30f00ee6 Add missing RELEASENOTES line
PiperOrigin-RevId: 513556883
(cherry picked from commit e2cb32f34ce016877fa7d2f4acc38511e7c261c0)
2023-03-02 17:58:04 +00:00
tonihei
7958737655 Fix lint-baseline.xml for latest UI translations
#minor-release

PiperOrigin-RevId: 513533248
(cherry picked from commit 8498e4b4445ae88665c6cdbc4e47e8e6ca7b7303)
2023-03-02 17:58:04 +00:00
tonihei
e2cb32f34c Add missing RELEASENOTES line
PiperOrigin-RevId: 513556883
2023-03-02 17:22:01 +00:00