2138 Commits

Author SHA1 Message Date
tofunmi
3a6ee77daf skip transformer tests if no internet connection
The failure reason (no network) will be logged in the test output, but the test will not be marked as failing, rather skipped.

PiperOrigin-RevId: 518262203
2023-03-21 14:06:11 +00:00
michaelkatz
ea3a85f89f Add RequiresApi annotations to some unittest methods
PiperOrigin-RevId: 518258380
2023-03-21 14:24:10 +00:00
huangdarwin
cbaf0f8232 Effect: Early return and rename variable (+ nits).
Reduce nesting by using an early return. Also, rename
`outputSizeOrRotationChanged` to `outputChanged`, because this also applies to when the output surface changes.

Also, update local variable initialization, add some javadoc, and remove unneeded
local variable

PiperOrigin-RevId: 518241708
2023-03-21 14:22:46 +00:00
sheenachhabra
87cd90eb15 Fix TODO in Boxes.java
The fix is as per MP4 spec ISO/IEC 14496-12

PiperOrigin-RevId: 518240043
2023-03-21 14:22:08 +00:00
bachinger
0bae410f7d Use final reference to content timeline inside handler message
The content timeline field may be updated when the live timeline
is refreshed in the looper event preceding the runnable that is
posted to the player thread. Hence a new timeline may contain a
new period uid that is not present in the ad playback state map.

Using a final reference makes sure period and ad playback state
match when asserted.

PiperOrigin-RevId: 518228165
2023-03-21 14:21:21 +00:00
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
huangdarwin
fca9197e1c HDR: Only check for HDR encoders on API 33+.
FEATURE_HdrEditing is only available on and above API 33, so it doesn't make
sense to check for support under API 33.

PiperOrigin-RevId: 518036855
2023-03-21 14:20:01 +00:00
sheenachhabra
669008f437 Use FakeExtractorOutput in Mp4MuxerMetadataTest
The FakeExtractorOutput dumps data in more readable format
so using that where ever possible.

The MdtaMetadataEntry which contains key and value dumped only "key".
Added fix to dump "value" as well.

PiperOrigin-RevId: 517968996
2023-03-21 14:19:12 +00:00
bachinger
b13b272695 Use correct period duration in fake live timeline
PiperOrigin-RevId: 517953981
2023-03-21 14:18:30 +00:00
sheenachhabra
ccdbd3b0a3 Add tkhd, mvhd and mdhd box test cases
PiperOrigin-RevId: 517933485
2023-03-21 14:17:47 +00:00
kimvde
aed5d62602 Remove TODOs
PiperOrigin-RevId: 517444208
2023-03-21 14:17:04 +00:00
kimvde
d41d025803 Add support for looping sequences in SequenceAssetLoader
PiperOrigin-RevId: 517418886
2023-03-21 14:16:19 +00:00
huangdarwin
e54c7a7c79 Test: Trim 4k60 test file to 300ms.
This was trimmed using the Transformer Demo, from ~4 seconds to 300ms

Otherwise, this test file will be quite large, and folks who clone the repo will
have to clone this content as well. Trimming the file also allows the test to
take less time, while still testing the core purpose of the file, to confirm that 4k extraction/decode/GL/encode/muxing works.

PiperOrigin-RevId: 517408463
2023-03-21 14:15:35 +00:00
samrobinson
78373991b8 Fix nits in FloatAudioMixingAlgorithmTest.
* Reorder methods.
* Arrange, act, assert split.

PiperOrigin-RevId: 517158351
2023-03-21 14:14:47 +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
tianyifeng
6109a0eb62 Intercept audio capabilities change in DefaultAudioSink
PiperOrigin-RevId: 517144710
2023-03-21 14:13:07 +00:00
tianyifeng
841c5477d1 Add release method to Renderer and AudioSink
* Add `release` method to Renderer and AudioSink interfaces.
* Call the `release` method for renderers when the ExoPlayer is going to be released.

PiperOrigin-RevId: 517135677
2023-03-21 14:12:21 +00:00
Rohit Singh
0e3f407e0e Merge pull request #11064 from haixia-meta:release-v2
PiperOrigin-RevId: 517128752
2023-03-16 15:37:02 +00:00
samrobinson
9e66998ea4 Add test cases for mixing to mono.
PiperOrigin-RevId: 517127021
2023-03-16 15:36:09 +00:00
rohks
8a5fcf82d3 Add support to fetch ColorInfo from hvcc box in AtomParsers
#minor-release

PiperOrigin-RevId: 517086016
2023-03-16 15:34:28 +00:00
Rohit Singh
49d85d625c Merge pull request #11061 from cedricxperi:dts-udts-support
PiperOrigin-RevId: 517067549
2023-03-16 15:33:38 +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
huangdarwin
a6479c3d10 Test: Move 4k60 test file to local from remote.
This test file used to be remote, which led to various errors in loading the file or timing out during the muxer or overall transformer.

export4k60 test timing on Pixel 7:

|Condition                 |elapsedTimeMs|AS Test "Duration" (s)|
|--------------------------|-------------|----------------------|
|local file (this CL)      |4253         |14                    |
|Remote file, googleguest  |5510         |17                    |
|Remote file, 4G           |11423        |25                    |

PiperOrigin-RevId: 516815462
2023-03-16 15:31:56 +00:00
sheenachhabra
edfef0a879 Add test for Mp4Muxer robustness
With the Mp4Muxer, while writing a large file if the something unexpected happens and muxer is not closed properly then it still outputs a valid MP4 file with partial data.

PiperOrigin-RevId: 516572804
2023-03-16 15:31:03 +00:00
michaelkatz
ea6241cc04 Extrapolate playback position during audio offload sleep
While playback thread is 'asleep' during audio offload playback, the playbackInfo.positionUs is not being constantly updated. During this time, the returned value from getCurrentPosition should return an estimate based on the most recent value and playback speed.

PiperOrigin-RevId: 516550509
2023-03-16 15:30:12 +00:00
kimvde
1ad68ffb17 Add a way in the SampleConsumer to indicate that it couldn't consume
- To support looping EditedMediaItemSequences, we need a way to tell the
AssetLoader that a sample couldn't be consumed and that it should retry
later. This is necessary in case we don't know yet whether the looping
sequence should load more samples because the other sequences haven't
made sufficient progress yet.
- The decision on whether to consume a sample is based on its timestamp
so it needs to be available.

PiperOrigin-RevId: 516546026
2023-03-16 15:29:26 +00:00
huangdarwin
9beddc2cc4 Effect: Update InternalTextureManager to use double timestamps.
Instead of using a long frameDurationUs with Math.floor, use a double
frameDurationUs with Math.round,

Before, playing an image with 30 fps over 1 second would result in the final
timestamp not being aligned to the expected 1 second timestamp. Over long
periods of time, this can lead to significant timestamp drift. Additionally,
for TimestampWrapper and constrained multi-asset, where TimestampWrapper
begins the 2nd effect on the 2nd asset's startTimeUs, this floor() behavior
can lead to the first few frames of the 2nd asset using the first asset's
effects, due to timestamps being mismatched.

PiperOrigin-RevId: 516529240
2023-03-14 15:57:32 +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
sheenachhabra
40dfe9f07d Add muxer end to end test for av1 video format
PiperOrigin-RevId: 516499906
2023-03-14 15:55:44 +00:00
samrobinson
eabf952048 Move RepeatedTranscodeTest to mh/analysis.
This test is not run on emulator, triage or postsubmit, and does not
provide value to the library in it's current state. It could be
deleted, however it still may have use for analysis of exported files
on MH.

PiperOrigin-RevId: 516491160
2023-03-14 15:54:56 +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
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
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