Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from androidx/media main branch #12

Merged
merged 6,136 commits into from
Oct 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
6136 commits
Select commit Hold shift + click to select a range
b95b534
Fix inverted colors in call to Color.rgb
kim-vde Aug 19, 2024
cd0a7e1
Document why playback tests are in the performance package
kim-vde Aug 19, 2024
ba00798
Make NalUnitTargetBuffer public
tonihei Aug 19, 2024
63b45b7
Build IAMF libraries with `gradle` and `ndk-build`.
kristinatrajkovski Aug 19, 2024
677f8ad
Fix edge case: no frame between trim position and the next sync sample
claincly Aug 19, 2024
ab366e2
Fix licensing link from `http` to `https` in IAMF related files.
kristinatrajkovski Aug 19, 2024
4a6c5c7
Cache ChunkIndex once load is done
colinkho Aug 19, 2024
f9f3e67
Include initialization chunk wording in getChunkIndex method
colinkho Aug 19, 2024
9b69690
Move some tests from CompositionPlaybackTest out of performance
kim-vde Aug 20, 2024
266f168
Remove VideoSink.isFrameDropAllowedOnInput
kim-vde Aug 20, 2024
0b5443c
Make Extractor/Mp4 Atom Parsing code reusable by external custom mp4 …
colinkho Aug 9, 2024
6ba9c9f
Rename AtomParsers to BoxParsers
colinkho Aug 15, 2024
3a95b24
Rename BoxParsers tag from AtomParsers to BoxParsers
colinkho Aug 15, 2024
2dd6794
More atom -> box updates in public API surface
icbaker Aug 16, 2024
77f3ef9
Add @UnstableApi annotation
icbaker Aug 16, 2024
2e49e91
Rename to singular BoxParser for consistency with other types like Co…
icbaker Aug 20, 2024
1cc1bf0
Added onLoadStarted callback to Loader's callback
colinkho Aug 1, 2024
33d9b78
Fix javadoc of onLoadStarted & remove error information as fields
colinkho Aug 7, 2024
af5df6e
Add retryCount parameter to make it clear onLoadStarted is called for…
icbaker Aug 20, 2024
b04b270
Use `SubtitleExtractor` from `MediaParserChunkExtractor`
icbaker Aug 20, 2024
643ec73
Merge pull request #1607 from colinkho:atom
copybara-github Aug 20, 2024
bb3948a
Implement interleaving of editable video tracks
SheenaChhabra Aug 20, 2024
41430aa
Fix annotation position and clarify javadoc
icbaker Aug 20, 2024
24f3856
Merge pull request #1580 from colinkho:main
copybara-github Aug 20, 2024
f52ca07
Add option to enable index-based seeking in `AmrExtractor`
rohitjoins Aug 20, 2024
4b7c510
Move moov box generation to Boxes.java
SheenaChhabra Aug 20, 2024
6af92b0
Differ AudioManager retrieval to whenever AudioFocusManagement is req…
colinkho Aug 13, 2024
0a0444b
Use Suppliers.memoize for lazy instantiation of AudioManager
colinkho Aug 14, 2024
a6f5d3d
Format with google-java-format
icbaker Aug 15, 2024
9c25845
Restore a couple of blank lines
icbaker Aug 20, 2024
bed1dad
Add release note
icbaker Aug 20, 2024
5304f22
Merge pull request #1624 from colinkho:comain
copybara-github Aug 20, 2024
51622b6
Add BufferingVideoSink
kim-vde Aug 21, 2024
1bb48b1
Merge pull request #1616 from colinkho:chmain
copybara-github Aug 21, 2024
875953f
Add Mp4Extractor test for interleaved editable video tracks file
SheenaChhabra Aug 21, 2024
351593a
Allow playback regardless buffered duration when loading fails
tianyif Aug 21, 2024
059ad62
Add timeout to CountDownLatch awaits
kim-vde Aug 21, 2024
410b26f
Detect SampleStream error after PreloadMediaPeriod has prepared
tianyif Aug 21, 2024
6b56f12
AtomParser: Update initialization data to CodecPrivate format for Vp9
a-googler Aug 22, 2024
4ba9f59
Improve logic to wait for a seek in CompositionPlayerSeekTest
kim-vde Aug 22, 2024
6f0cb53
Add util method BaseRenderer.getStreamOffsetUs
tonihei Aug 22, 2024
6e0e2d0
Add QueuingGlShaderProgram for effects that run outside GL context
ychaparov Aug 22, 2024
1994ccd
Update release notes for 1.4.1 bug fix release
tianyif Aug 22, 2024
0060ff2
Automated Code Change
kluever Aug 22, 2024
829cad6
Bump media3 version to 1.4.1
tianyif Aug 22, 2024
ee93a98
Add ByteBufferGlEffect for easier non-GPU video effects
ychaparov Aug 22, 2024
2b03148
Allow looping sequences in CompositionPlayer
claincly Aug 23, 2024
52aeffb
Remove TODO for empty samples in muxer
SheenaChhabra Aug 26, 2024
563eb96
Make ByteBufferConcurrentEffect asynchronous
ychaparov Aug 27, 2024
c4930c4
Default to OpenGL 3.0 context in DVFP
ychaparov Aug 27, 2024
a4d0735
Fix player hanging when seeking at MediaItem transition
kim-vde Aug 27, 2024
36d6100
Reorder the assetions in tests
claincly Aug 27, 2024
d067624
Add AnalyticsListener.onRendererReadyChanged
tonihei Aug 27, 2024
ebd60ac
Rename LAST_FRAME_DURATION_BEHAVIOR to LAST_SAMPLE_DURATION_BEHAVIOR
SheenaChhabra Aug 27, 2024
84f4c7b
Create and assert against dump files in ParameterizedAudioExportTest.
Samrobbo Aug 27, 2024
9c5ea4f
Assert silent bytes are 0 in AudioGraphInputTest
Samrobbo Aug 28, 2024
f0463bf
Set pixel aspect ratio from output media format if set
dsparano May 13, 2024
7473156
Fix output pixel aspect ratio and add test for it
dsparano Aug 28, 2024
0ac26c4
Format with google-java-format
microkatz Aug 28, 2024
c2e8105
Fix flakiness in ExoPlayerTest
tianyif Aug 28, 2024
070e821
Report swallowed exceptions in ExternalTextureManager
kim-vde Aug 28, 2024
5c2dc7e
Add ByteBufferGlEffect.Image for easier format conversion
ychaparov Aug 28, 2024
8367e42
Import correct nullable annotation
kim-vde Aug 28, 2024
e8664db
Report initial discontinuity for DASH periods that require preroll
tonihei Aug 29, 2024
d6f08a6
Add VTT voice spans to cues
MiSikora Aug 23, 2024
108a5ca
Remove language span marker interface
MiSikora Aug 23, 2024
ce52fc7
Remove VTT voice span classes
MiSikora Aug 27, 2024
24bbe6d
Rename VTT voice span speakerName to name
MiSikora Aug 27, 2024
cd47e2a
Remove redundant test
MiSikora Aug 28, 2024
a4aa975
Reformat and tweak javadoc
icbaker Aug 29, 2024
4d9ad5a
Add release note
icbaker Aug 29, 2024
3587afc
Move CompositionPlayerSeekTest out of performance directory
kim-vde Aug 29, 2024
05cbbff
Add a space in the `ParserException` message
icbaker Aug 29, 2024
02fa4b0
Remove obsolete semicolon
JaroslavHerber Aug 29, 2024
4ee34cc
Refactor HttpMediaDrmCallback's executePost into a shared utility met…
colinkho Aug 27, 2024
a509033
Correct grammar and format javadoc on DrmUtil.executePost
colinkho Aug 27, 2024
41a56da
Code formatting
tonihei Aug 29, 2024
e301616
Merge pull request #1667 from JaroslavHerber:patch-1
copybara-github Aug 29, 2024
37561c8
Fix and refactor logic to remove all frames in ExternalTextureManager
kim-vde Aug 29, 2024
68f5546
Merge pull request #1659 from colinkho:drm-util
copybara-github Aug 29, 2024
c78ac6e
Remove intdef value list from javadoc
icbaker Aug 29, 2024
39ed9cf
Merge pull request #1652 from MiSikora:ms/vtt-speaker
copybara-github Aug 29, 2024
388d1f1
Clean up comments in Boxes.java
SheenaChhabra Aug 29, 2024
dc9854c
Add GlRect helper class
ychaparov Aug 30, 2024
613c7a6
Change adjustLastSampleDuration() to getLastSampleDurationVu()
SheenaChhabra Aug 30, 2024
791483f
Remove TrackMetadataProvider interface
SheenaChhabra Aug 30, 2024
f165473
Added release note for change
microkatz Aug 28, 2024
4e858f7
Add support for setting last sample duration in Mp4Muxer
SheenaChhabra Aug 30, 2024
5eba716
Add a composition export dump test with a shorter second sequence.
Samrobbo Aug 30, 2024
854566d
Merge pull request #1371 from v-novaltd:dsparano-exo207
copybara-github Aug 30, 2024
551cbad
Gracefully handle unexpected non-MP3 trailing data
icbaker Sep 2, 2024
b0213c8
Update release notes to contain IAMF support.
kristinatrajkovski Sep 2, 2024
b3b4c80
Release the analyzer mode placeholder surface
ychaparov Sep 2, 2024
748e4e5
Fix hanging ExoPlayerPlaybackSeekTest
kim-vde Sep 2, 2024
f0fa764
Add support for setting video duration in InAppMuxer
SheenaChhabra Sep 2, 2024
060356e
Temporarily disable multi-sequence audio playback test
claincly Sep 2, 2024
0843444
Fix order of elements in FrameworkMuxer.java
SheenaChhabra Sep 2, 2024
207684c
Prototype frame extraction based on analyzer mode
ychaparov Sep 2, 2024
1d92768
Ensure force silence SampleConsumerWrapper has the right track type.
Samrobbo Sep 2, 2024
4562c78
Update `minSdk` values in `UtilTest`
icbaker Sep 2, 2024
ebb550a
Fix `WrongConstant` lint failure for `IamfDecoder#OUTPUT_PCM_ENCODING`
ivanbuper Sep 2, 2024
95f69b6
Use InAppMuxer in tests for API < 25
SheenaChhabra Sep 3, 2024
af2f9cb
Increase ExoplayerEffectPlaybackSeekTest time out
kim-vde Sep 3, 2024
af61c03
Move ExoPlayerEffectPlaybackSeekTest out of performance directory
kim-vde Sep 3, 2024
e16b4ff
Update release notes for Media3 1.5.0-alpha01 release
ivanbuper Sep 3, 2024
9562c97
Bump Media3 version to 1.5.0-alpha01
ivanbuper Sep 3, 2024
1c61fba
Downscale bitmaps during decoding in Transformer
ychaparov Sep 3, 2024
a7788e0
Rename last sample duration behaviour enums
SheenaChhabra Sep 3, 2024
6e1bab0
Add `Mp4PlaybackTest` for sample with edit list (edts box)
rohitjoins Sep 3, 2024
e27c7d5
Use simpler timestamps in tests for readability
SheenaChhabra Sep 4, 2024
0933f56
Move MCR `CryptoException` handling to top-level `render()` method
icbaker Sep 4, 2024
c851464
Add a note on not using PlayerControlView as a standalone component
oceanjules Sep 4, 2024
87bd9ba
Make `PlayerView` Compose workaround opt-in
icbaker Sep 4, 2024
a00c446
Do not clear the timeline after the Cast receiver disconnects
AquilesCanta Sep 4, 2024
6822818
Fix `Format.toLogString` handling of new `Format.labels` field
icbaker Sep 4, 2024
a1d2310
Fix stuck player after seek
kim-vde Sep 5, 2024
4ea58a1
Populate DeviceInfo in CastPlayer using MediaRouter2 info
AquilesCanta Sep 5, 2024
a1357be
Add Kotlin dependencies to missing_aar_type_workaround.gradle
ivanbuper Sep 6, 2024
327b1c8
Move `getCodecProfileAndLevel` to `CodecSpecificDataUtil`
SheenaChhabra Sep 6, 2024
a53ea62
Stop rejecting frames later in ExternalTextureManager
kim-vde Sep 10, 2024
8bfa7e2
Make StreamVolumeManager take streamType in constructor
oceanjules Sep 10, 2024
35dc10a
Fix a bug to read last 3 bytes in AnnexBUtils
SheenaChhabra Sep 10, 2024
4be5b74
Read NAL unit data as 4 byte integer
SheenaChhabra Sep 10, 2024
8271a5f
Rename CompositingVideoSinkProvider and PreviewAudioPipeline
kim-vde Sep 11, 2024
bb3d055
Do not drop negative timestamp video buffers during transmuxing
rohitjoins Sep 11, 2024
d9a6784
Refine sample presentation time validation for negative PTS workaround
rohitjoins Sep 11, 2024
f133e8d
Fix preroll sample handling for non-keyframe media start positions
rohitjoins Sep 11, 2024
17e0fd2
Fixed removal of user info for URLs that contain encoded @ characters
Lavamancer Feb 28, 2024
61343cd
Format with google-java-format
microkatz Sep 12, 2024
661f3de
Added note in release notes
microkatz Sep 12, 2024
ce98b7d
Rename SequencePlayerRenderersWrapper
kim-vde Sep 12, 2024
3caebbf
Fix erroneous use of "cpu_features" in AV1 JNI exports.
a-googler Sep 12, 2024
e88d6fe
Fix truncation error acumulation for Sonic's resampling algorithm
ivanbuper Sep 12, 2024
bc8d823
Block secondary audio processing until primary format is configured
claincly Sep 12, 2024
ff65601
Update the unisoc blocklist
a-googler Sep 13, 2024
023fd32
Merge pull request #1138 from Lavamancer:bugfix/rtsp_message_util_enc…
copybara-github Sep 13, 2024
72ae454
Use buffered duration from start position to control preload progress
tianyif Sep 13, 2024
6c92402
Re-enable audio tests
claincly Sep 13, 2024
011659b
Add profile and level for H263 codec.
a-googler Sep 16, 2024
e938d27
Fix typo in release notes
microkatz Sep 16, 2024
72f26d7
Added a forwarding class for Renderer to support composing custom beh…
colinkho Sep 6, 2024
72e39c9
Denote ForwardingRenderer as subject to change
colinkho Sep 6, 2024
62aef96
Format code using google java format
colinkho Sep 6, 2024
8ca1233
Format with google-java-format
rohitjoins Sep 16, 2024
3c6f1f1
Add copyright text and move test to correct package
rohitjoins Sep 16, 2024
9975175
Forward default methods
rohitjoins Sep 16, 2024
11aea9b
Add RELEASENOTES
rohitjoins Sep 16, 2024
c8aa122
Change from internal review
rohitjoins Sep 16, 2024
a879bc2
Rewrite sequence duration matching on MediaSource level
claincly Sep 16, 2024
0ce6d96
Merge pull request #1703 from colinkho:fwd-renderer
copybara-github Sep 16, 2024
47d45a8
Change the default value of lastSampleDurationBehavior
SheenaChhabra Sep 16, 2024
49af922
Added public-facing calls to set whether to show [fullScreenButton] o…
helomri Aug 24, 2024
4a4b3a3
- Rephrased/Expanded javadocs for fullscreen methods
helomri Sep 4, 2024
c42f53f
Edited condition to exit updateIsFullscreen quickly
helomri Sep 10, 2024
370a4c0
Deleted redundant check
helomri Sep 10, 2024
5536b73
Format with google-java-format
oceanjules Sep 10, 2024
9b75523
Add and format RELEASENOTES
oceanjules Sep 10, 2024
25bb8e4
Make setFullscreenButtonState UnstableApi
oceanjules Sep 10, 2024
6632e64
Merge pull request #1653 from theskyblockman:main
copybara-github Sep 16, 2024
0ea229d
Remove limit of 2 sequences in CompositionPlayer
kim-vde Sep 17, 2024
873d485
Rollback of https://github.com/androidx/media/commit/e88d6fe459738399…
ivanbuper Sep 17, 2024
9bc89ae
Ensure track indices are only added when samples are committed
rohitjoins Sep 17, 2024
e1c4ecf
Add suitable output checker tests relevant for API 35+ in ExoPlayerTest
a-googler Sep 17, 2024
acb8e71
Set `hasMuxedTimestampZero` to `true` only when its muxed
SheenaChhabra Sep 17, 2024
087e758
Add suitable output checker tests relevant for API 35+ in media3-ui
a-googler Sep 17, 2024
dc66c91
Update some APIs to Use real types in ShadowNotificationManager
hoisie Sep 17, 2024
3facfbf
Assert `baseDataSourceFactory` non-null in `DefaultDataSource.Factory`
icbaker Sep 18, 2024
69da269
Fix logic that detects the last media item in Sequence
claincly Sep 18, 2024
f0fb386
Add workaround for Galaxy Tab S7 FE device PerformancePoint issue
microkatz Sep 18, 2024
fd3d8e1
Add RATE_UNSET option to encoder performance setting
claincly Sep 18, 2024
2951a25
Apply all video Composition effects to single sequence exports
kim-vde Sep 18, 2024
3e8ecbf
Remove `@DoNotInline` annotations
icbaker Sep 18, 2024
caf70e5
Fix outdated Transformer Javadoc
kim-vde Sep 18, 2024
0b86f89
Guard `DrmSession.requiresSecureDecoder` calls with state checks
icbaker Sep 18, 2024
8799bf4
Format `Format.frameRate` to two decimal places before dumping
rohitjoins Sep 18, 2024
ecb0024
Improve frame rate calculation by using media duration from `mdhd` box
rohitjoins Sep 18, 2024
980f24d
Avoid ImageReader frame drops in EffectPlaybackPixelTest
kim-vde Sep 19, 2024
76e3fc0
Update activity_main.xml
MGaetan89 Sep 19, 2024
75c7ee7
Add EditedMediaItemSequence.Builder.
Samrobbo Sep 19, 2024
3c5e764
Fix CapturingMuxer writing of final PCM audio sample to dump file.
Samrobbo Sep 19, 2024
6bda0da
Fix sending custom commands with a media browser
marcbaechinger Sep 19, 2024
6d6724d
Merge pull request #1740 from MGaetan89:fix_shortform_demo_input_type
copybara-github Sep 19, 2024
e887614
Move release note from `1.5.0-alpha01` to 'unreleased'
icbaker Sep 20, 2024
5e3dcea
Ramp up volume after AudioTrack flush to avoid pop sound
tonihei Sep 20, 2024
be4d31b
Prevent ExoPlayer dropping frames in EffectPlaybackPixelTest
kim-vde Sep 23, 2024
17e1d37
Fix GL filtering algorithm used when experimental fix is disabled
ychaparov Sep 23, 2024
3d3ec85
Setup basic testing for Sonic and assert expected sample count drift
ivanbuper Sep 23, 2024
ba1cdba
Preload first period of next window
marcbaechinger Sep 23, 2024
b4436c5
Migrate Media3 EditedMediaItemSequence usages to the Builder.
Samrobbo Sep 23, 2024
869a91b
Remove `DemoUtil.ALLOW_CRONET_FOR_NETWORKING`
icbaker Sep 23, 2024
b884d7e
Handle IllegalArgumentException when setting broadcast receiver
marcbaechinger Sep 23, 2024
31a5409
Add method to MediaSourceEventListener.EventDispatcher to submit even…
colinkho Sep 17, 2024
508a1d8
Add release note
tianyif Sep 23, 2024
b303498
Fix the typo in javadoc
tianyif Sep 19, 2024
424ecad
Merge pull request #1736 from colinkho:msource_list
copybara-github Sep 24, 2024
c19d910
Fix EffectPlaybackPixelTest
kim-vde Sep 24, 2024
d8dc513
Apply video composition effects in preview
kim-vde Sep 24, 2024
43765b7
Add platform token to Media3 SessionToken
tonihei Sep 24, 2024
076eea2
Adding API and internal export support for audio gaps in sequences.
Samrobbo Sep 24, 2024
8b7c8ff
Misc cleanup for session token
tonihei Sep 24, 2024
fc07ce0
Add safer gap based checks to Transformer API boundary points.
Samrobbo Sep 24, 2024
f83d2b1
Stop calling setDurationUs when image duration already set
kim-vde Sep 25, 2024
eaec7a4
Set MediaItem's image duration for image export
kim-vde Sep 25, 2024
5ab72a3
Use constants in dump file names for playback test.
Samrobbo Sep 25, 2024
fa04386
Enable multi sequence audio preview test.
Samrobbo Sep 25, 2024
2dc3236
Remove usages of deprecated DefaultDecoderFactory constructor
kim-vde Sep 25, 2024
3ec9c99
Document that the MediaItem's image duration should be set for images
kim-vde Sep 25, 2024
5879426
Check surface validity before configuring it on a codec
tonihei Sep 25, 2024
0ea63e3
Disable video only on the sequence that has items that disable video
claincly Sep 25, 2024
686c3fe
Add media item command buttons for Media3 controllers
marcbaechinger Sep 25, 2024
b8ec6b8
Add interoperability for media item commands
marcbaechinger Sep 25, 2024
2520dd1
Fix EMSG typo in `HlsChunkSource` and `ChunkSampleStream`
icbaker Sep 25, 2024
020ce77
Reduce rounding error and stts table entries.
a-googler Sep 26, 2024
65962dc
Add `Builder.setMaxCommandsForMediaItems` for browser and controller
marcbaechinger Sep 26, 2024
50c879e
Remove stale comment
claincly Sep 26, 2024
f4eef88
Ensure Media3 play calls get FGS exemption
tonihei Sep 26, 2024
b6192f7
Add AudioEncoderSettings to Transformer
SheenaChhabra Sep 26, 2024
09a5ef5
Assign the `C.TRACK_TYPE_METADATA` type to icy or vnd.dvb.ait tracks
microkatz Sep 26, 2024
5e57734
Update the comment of WRITE_TO_DEVICE enum
SheenaChhabra Sep 26, 2024
45c400c
Clarify compositionPlayer audio test naming.
Samrobbo Sep 26, 2024
2dde824
Fix the flakiness in `DefaultPreloadManagerTest`
tianyif Sep 26, 2024
138a8d6
Get updated buffered position when calling shouldStartPlayback
tonihei Sep 26, 2024
23e02cc
Upgrade Guava to 33.3.1
tonihei Sep 27, 2024
b9aed0a
Have AndroidTestUtil.canEncode mirror VideoSampleExporter
ychaparov Sep 27, 2024
e0e9f5b
Increase the maxImage on ImageReader, hoping less flaky tests
claincly Sep 27, 2024
c6434a8
Add @CanIgnoreReturnValue to MediaSession.BuilderBase
marcbaechinger Sep 27, 2024
287f353
Move tests relying on unreleased robolectric changes
marcbaechinger Sep 27, 2024
4481b35
Add workaround for codecs not propagating EOS signal.
tonihei Sep 27, 2024
b0b54ca
Calculate min timestamp across tracks in the Boxes.moov method
SheenaChhabra Sep 27, 2024
7b08bed
Do not force EOS when decoder has produced all frames
ychaparov Sep 30, 2024
b5680e8
Make `OverlayEffect` take a List
claincly Oct 4, 2024
47021c8
Account for missing preroll when converting adPodIndex to adGroupIndex
tonihei Oct 4, 2024
af6ad43
Disable the language/role flag preferences when selecting "none"
tonihei Oct 4, 2024
f7af589
Allow signed TTML region origins
tonihei Oct 4, 2024
af922fb
Fix truncation error accumulation on Sonic's time stretching algorithm
ivanbuper Oct 7, 2024
8d0b82d
PlaybackVideoGraphWrapper: rename VideoSinkImpl to InputVideoSink
kim-vde Oct 7, 2024
7b0f836
Add LoadingInfo as a parameter to continueLoading on MediaPeriodHolder
colinkho Aug 22, 2024
bf88128
Formatting and additional call for preloading period
tonihei Sep 27, 2024
7c9fede
Add DefaultVideoSink and implement straightforward methods
kim-vde Oct 8, 2024
bd192c1
Restrict CommandButton.iconUri to content Uris
tonihei Oct 8, 2024
52f08d4
Add motion photo support to Transformer
kim-vde Oct 8, 2024
62864d5
Merge pull request #1651 from colinkho:mp-cl
copybara-github Oct 8, 2024
5f935ef
DefaultVideoSink: implement initialize() and isInitialized()
kim-vde Oct 8, 2024
abfeea5
Ensure consistent `ExtractorOutput` usage in `WebvttExtractor`
icbaker Oct 8, 2024
fd48dd9
Add PlaybackLooperProvider and make it injectable for ExoPlayer
tianyif Oct 8, 2024
8f82a15
Return early when `audioManager` is `null`
rohitjoins Oct 8, 2024
72ab282
Ignore `channelCount` and `sampleRate` values read from `iamf` box
rohitjoins Oct 8, 2024
546d7da
Fix `Fmp4Extractor.init` to use text transcoding `ExtractorOutput`
icbaker Oct 8, 2024
c4ff07e
Don't advertise commands that are not available
marcbaechinger Oct 8, 2024
e234076
DefaultVideoSink: implement set/clearOutputSurfaceInfo
kim-vde Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move some tests from CompositionPlaybackTest out of performance
directory

PiperOrigin-RevId: 665202382
kim-vde authored and copybara-github committed Aug 20, 2024
commit 9b69690856c5c7458daf7bddf287f02efc0d38fb
Original file line number Diff line number Diff line change
@@ -14,63 +14,30 @@
* limitations under the License.
*/

package androidx.media3.transformer.mh.performance;
package androidx.media3.transformer;

import static androidx.media3.test.utils.BitmapPixelTestUtil.MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE;
import static androidx.media3.test.utils.BitmapPixelTestUtil.createArgb8888BitmapFromRgba8888Image;
import static androidx.media3.test.utils.BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888;
import static androidx.media3.test.utils.BitmapPixelTestUtil.readBitmap;
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET;
import static androidx.media3.transformer.AndroidTestUtil.PNG_ASSET;
import static androidx.media3.transformer.mh.performance.PlaybackTestUtil.createTimestampOverlay;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.PixelFormat;
import android.media.Image;
import android.media.ImageReader;
import android.view.SurfaceView;
import androidx.media3.common.Effect;
import androidx.media3.common.MediaItem;
import androidx.media3.common.util.ConditionVariable;
import androidx.media3.common.util.Size;
import androidx.media3.common.util.Util;
import androidx.media3.effect.GlEffect;
import androidx.media3.transformer.Composition;
import androidx.media3.transformer.CompositionPlayer;
import androidx.media3.transformer.EditedMediaItem;
import androidx.media3.transformer.EditedMediaItemSequence;
import androidx.media3.transformer.Effects;
import androidx.media3.transformer.InputTimestampRecordingShaderProgram;
import androidx.media3.transformer.PlayerTestListener;
import androidx.media3.transformer.SurfaceTestActivity;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;

/** Playback tests for {@link CompositionPlayer} */
// These tests are in the performance package even though they are not performance tests so that
// they are not run on all devices. This is because they use ImageReader, which has a tendency to
// drop frames.
@RunWith(AndroidJUnit4.class)
public class CompositionPlaybackTest {

private static final String TEST_DIRECTORY = "test-generated-goldens/ExoPlayerPlaybackTest";
private static final long TEST_TIMEOUT_MS = 10_000;

private static final MediaItem VIDEO_MEDIA_ITEM = MediaItem.fromUri(MP4_ASSET.uri);
private static final long VIDEO_DURATION_US = MP4_ASSET.videoDurationUs;
private static final ImmutableList<Long> VIDEO_TIMESTAMPS_US = MP4_ASSET.videoTimestampsUs;
@@ -81,99 +48,20 @@ public class CompositionPlaybackTest {
private static final ImmutableList<Long> IMAGE_TIMESTAMPS_US =
ImmutableList.of(0L, 33_333L, 66_667L, 100_000L, 133_333L, 166_667L);

@Rule public final TestName testName = new TestName();

@Rule
public ActivityScenarioRule<SurfaceTestActivity> rule =
new ActivityScenarioRule<>(SurfaceTestActivity.class);

private final Context context = getInstrumentation().getContext().getApplicationContext();
private final PlayerTestListener playerTestListener = new PlayerTestListener(TEST_TIMEOUT_MS);

private @MonotonicNonNull CompositionPlayer player;
private @MonotonicNonNull ImageReader outputImageReader;

private String testId;
private SurfaceView surfaceView;

@Before
public void setUp() {
rule.getScenario().onActivity(activity -> surfaceView = activity.getSurfaceView());
testId = testName.getMethodName();
}

@After
public void tearDown() {
rule.getScenario().close();
getInstrumentation()
.runOnMainSync(
() -> {
if (player != null) {
player.release();
}
if (outputImageReader != null) {
outputImageReader.close();
}
});
}

@Test
public void compositionPlayerPreviewTest_ensuresFirstFrameRenderedCorrectly() throws Exception {
AtomicReference<Bitmap> renderedFirstFrameBitmap = new AtomicReference<>();
ConditionVariable hasRenderedFirstFrameCondition = new ConditionVariable();
outputImageReader =
ImageReader.newInstance(
MP4_ASSET.videoFormat.width,
MP4_ASSET.videoFormat.height,
PixelFormat.RGBA_8888,
/* maxImages= */ 1);

getInstrumentation()
.runOnMainSync(
() -> {
player = new CompositionPlayer.Builder(context).build();
outputImageReader.setOnImageAvailableListener(
imageReader -> {
try (Image image = imageReader.acquireLatestImage()) {
renderedFirstFrameBitmap.set(createArgb8888BitmapFromRgba8888Image(image));
}
hasRenderedFirstFrameCondition.open();
},
Util.createHandlerForCurrentOrMainLooper());

player.setVideoSurface(
outputImageReader.getSurface(),
new Size(MP4_ASSET.videoFormat.width, MP4_ASSET.videoFormat.height));
player.setComposition(
new Composition.Builder(
new EditedMediaItemSequence(
new EditedMediaItem.Builder(MediaItem.fromUri(MP4_ASSET.uri))
.setEffects(
new Effects(
/* audioProcessors= */ ImmutableList.of(),
/* videoEffects= */ ImmutableList.of(
createTimestampOverlay())))
.setDurationUs(1_024_000L)
.build()))
.build());
player.prepare();
});

if (!hasRenderedFirstFrameCondition.block(TEST_TIMEOUT_MS)) {
throw new TimeoutException(
Util.formatInvariant("First frame not rendered in %d ms.", TEST_TIMEOUT_MS));
}

assertWithMessage("First frame is not rendered.")
.that(renderedFirstFrameBitmap.get())
.isNotNull();
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(
/* expected= */ readBitmap(TEST_DIRECTORY + "/first_frame.png"),
/* actual= */ renderedFirstFrameBitmap.get(),
testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
// TODO: b/315800590 - Verify onFirstFrameRendered is invoked only once.
}

@Test
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
/*
* Copyright 2024 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package androidx.media3.transformer.mh.performance;

import static androidx.media3.test.utils.BitmapPixelTestUtil.MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE;
import static androidx.media3.test.utils.BitmapPixelTestUtil.createArgb8888BitmapFromRgba8888Image;
import static androidx.media3.test.utils.BitmapPixelTestUtil.getBitmapAveragePixelAbsoluteDifferenceArgb8888;
import static androidx.media3.test.utils.BitmapPixelTestUtil.readBitmap;
import static androidx.media3.transformer.AndroidTestUtil.MP4_ASSET;
import static androidx.media3.transformer.mh.performance.PlaybackTestUtil.createTimestampOverlay;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.PixelFormat;
import android.media.Image;
import android.media.ImageReader;
import android.view.SurfaceView;
import androidx.media3.common.MediaItem;
import androidx.media3.common.util.ConditionVariable;
import androidx.media3.common.util.Size;
import androidx.media3.common.util.Util;
import androidx.media3.transformer.Composition;
import androidx.media3.transformer.CompositionPlayer;
import androidx.media3.transformer.EditedMediaItem;
import androidx.media3.transformer.EditedMediaItemSequence;
import androidx.media3.transformer.Effects;
import androidx.media3.transformer.SurfaceTestActivity;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.collect.ImmutableList;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;

/** Pixel tests for {@link CompositionPlayer} */
// These tests are in the performance package even though they are not performance tests so that
// they are not run on all devices. This is because they use ImageReader, which has a tendency to
// drop frames.
@RunWith(AndroidJUnit4.class)
public class CompositionPlayerPixelTest {

private static final String TEST_DIRECTORY = "test-generated-goldens/ExoPlayerPlaybackTest";
private static final long TEST_TIMEOUT_MS = 10_000;

@Rule public final TestName testName = new TestName();

@Rule
public ActivityScenarioRule<SurfaceTestActivity> rule =
new ActivityScenarioRule<>(SurfaceTestActivity.class);

private final Context context = getInstrumentation().getContext().getApplicationContext();

private @MonotonicNonNull CompositionPlayer player;
private @MonotonicNonNull ImageReader outputImageReader;

private String testId;
private SurfaceView surfaceView;

@Before
public void setUp() {
rule.getScenario().onActivity(activity -> surfaceView = activity.getSurfaceView());
testId = testName.getMethodName();
}

@After
public void tearDown() {
rule.getScenario().close();
getInstrumentation()
.runOnMainSync(
() -> {
if (player != null) {
player.release();
}
if (outputImageReader != null) {
outputImageReader.close();
}
});
}

@Test
public void compositionPlayerPreviewTest_ensuresFirstFrameRenderedCorrectly() throws Exception {
AtomicReference<Bitmap> renderedFirstFrameBitmap = new AtomicReference<>();
ConditionVariable hasRenderedFirstFrameCondition = new ConditionVariable();
outputImageReader =
ImageReader.newInstance(
MP4_ASSET.videoFormat.width,
MP4_ASSET.videoFormat.height,
PixelFormat.RGBA_8888,
/* maxImages= */ 1);

getInstrumentation()
.runOnMainSync(
() -> {
player = new CompositionPlayer.Builder(context).build();
outputImageReader.setOnImageAvailableListener(
imageReader -> {
try (Image image = imageReader.acquireLatestImage()) {
renderedFirstFrameBitmap.set(createArgb8888BitmapFromRgba8888Image(image));
}
hasRenderedFirstFrameCondition.open();
},
Util.createHandlerForCurrentOrMainLooper());

player.setVideoSurface(
outputImageReader.getSurface(),
new Size(MP4_ASSET.videoFormat.width, MP4_ASSET.videoFormat.height));
player.setComposition(
new Composition.Builder(
new EditedMediaItemSequence(
new EditedMediaItem.Builder(MediaItem.fromUri(MP4_ASSET.uri))
.setEffects(
new Effects(
/* audioProcessors= */ ImmutableList.of(),
/* videoEffects= */ ImmutableList.of(
createTimestampOverlay())))
.setDurationUs(1_024_000L)
.build()))
.build());
player.prepare();
});

if (!hasRenderedFirstFrameCondition.block(TEST_TIMEOUT_MS)) {
throw new TimeoutException(
Util.formatInvariant("First frame not rendered in %d ms.", TEST_TIMEOUT_MS));
}

assertWithMessage("First frame is not rendered.")
.that(renderedFirstFrameBitmap.get())
.isNotNull();
float averagePixelAbsoluteDifference =
getBitmapAveragePixelAbsoluteDifferenceArgb8888(
/* expected= */ readBitmap(TEST_DIRECTORY + "/first_frame.png"),
/* actual= */ renderedFirstFrameBitmap.get(),
testId);
assertThat(averagePixelAbsoluteDifference).isAtMost(MAXIMUM_AVERAGE_PIXEL_ABSOLUTE_DIFFERENCE);
// TODO: b/315800590 - Verify onFirstFrameRendered is invoked only once.
}
}
Original file line number Diff line number Diff line change
@@ -70,12 +70,12 @@
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

/** Test for {@link ExoPlayer#setVideoEffects}. */
/** Pixel tests for {@link ExoPlayer#setVideoEffects}. */
// These tests are in the performance package even though they are not performance tests so that
// they are not run on all devices. This is because they use ImageReader, which has a tendency to
// drop frames.
@RunWith(Enclosed.class)
public class EffectPlaybackTest {
public class EffectPlaybackPixelTest {

private static final String TEST_DIRECTORY = "test-generated-goldens/ExoPlayerPlaybackTest";
private static final long TEST_TIMEOUT_MS = 10_000;