18607 Commits

Author SHA1 Message Date
kimvde
c109e396ed Add test for audio and video from different sources
PiperOrigin-RevId: 515379858
2023-03-14 08:51:52 +00:00
sheenachhabra
5acb1b310b 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 08:47:49 +00:00
sheenachhabra
f69160079c Add support for writing MP4 location data using media muxer
PiperOrigin-RevId: 515297752
2023-03-14 08:43:33 +00:00
tofunmi
9be419e679 Replace bitmap overlay uri EditText with local file picker
PiperOrigin-RevId: 515283537
2023-03-14 08:39:31 +00:00
sheenachhabra
84c1d851ef 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 08:35:33 +00:00
bachinger
24125f7349 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 08:31:16 +00:00
bachinger
37aab2b7e9 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 08:27:16 +00:00
Googler
6514d8066d [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 08:23:17 +00:00
kimvde
3a11c638a5 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 08:19:19 +00:00
kimvde
2d97d3a571 Make sure errors thrown in the PlayerListener are not swallowed
PiperOrigin-RevId: 515037497
2023-03-14 08:15:19 +00:00
Cedric T
3909db2a4e Add DTSUHDSpecificBox (udts) support to parseAudioSampleEntry(). 2023-03-14 16:12:45 +08:00
ibaker
bfad60e661 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 08:07:26 +00:00
tofunmi
42aaba1f17 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 08:03:23 +00:00
huangdarwin
82a3fd5dc0 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:59:24 +00:00
sheenachhabra
7b8c562d7b Remove setLocation() method from Muxer interface
PiperOrigin-RevId: 516314175
2023-03-14 07:56:52 +00:00
tofunmi
82c9479dd2 Update GlObjectsProvider to cover creating surface.
PiperOrigin-RevId: 516300480
2023-03-14 07:56:05 +00:00
kimvde
4b97913e2e Remove VideoSamplePipeline unused param
PiperOrigin-RevId: 515002313
2023-03-14 07:55:26 +00:00
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
samrobinson
73e4348411 Verify the audio properties being used within Transformer.
Add TransformerAudioEndToEndTest to emulated tests.

PiperOrigin-RevId: 514991434
2023-03-14 07:51:18 +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
tianyifeng
bb9ac21434 Handle dead object error during writing buffer to AudioTrack
PiperOrigin-RevId: 514989776
2023-03-14 07:47:23 +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
87d1c3e624 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:43:16 +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
tonihei
fe710871aa 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:39:10 +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
tofunmi
82ab327e02 Update effect to take in and use a GlObjectsProvider
PiperOrigin-RevId: 514744747
2023-03-14 07:34:53 +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