19970 Commits

Author SHA1 Message Date
sheenachhabra
cb7ea09af1 Add regression test of skipping empty track when writing MP4
The implementation of fragmented MP4 caused a regression where muxer
started writing empty tracks even for non fragmented MP4.

PiperOrigin-RevId: 603091348
2024-01-31 10:31:52 -08:00
huangdarwin
cebe6d8ba5 HDR: Don't assume that swapping between BT709 and BT601 needs tone-map.
VideoFrameProcessor treats BT601 and BT709 as roughly equivalent now, so we
shouldn't be making checks that assume BT709 <-> requires tone-mapping.

Also, the color transfer is a better determinant for tone-mapping than color range, so use just the transfer to determine if tone-mapping is required.

PiperOrigin-RevId: 603083100
2024-01-31 10:07:45 -08:00
huangdarwin
1163660918 Test: Save test bitmaps in a separate loop from assertions.
This means all bitmaps will save even if an assertion fails somewhere in the test
method

PiperOrigin-RevId: 603067528
2024-01-31 09:12:56 -08:00
sheenachhabra
61603f90f3 Refactor track retrieval into a separate method
This will be be required when we add more method which
required video track.

PiperOrigin-RevId: 603024260
2024-01-31 06:00:58 -08:00
samrobinson
65c354029a Add TODO around using improved buffer assignment logic.
PiperOrigin-RevId: 603019987
2024-01-31 05:36:09 -08:00
Copybara-Service
dfcc2cb41d Merge pull request #1015 from kamaroyl:feat/PsshVersion1
PiperOrigin-RevId: 603016920
2024-01-31 05:17:33 -08:00
sheenachhabra
5147eb1a65 Add audio/video sample mime type in ExportResult
PiperOrigin-RevId: 603013441
2024-01-31 05:00:12 -08:00
Copybara-Service
45bd5c6f0a Merge pull request #1031 from garethfenn:hlschunkseek
PiperOrigin-RevId: 603008793
2024-01-31 04:33:44 -08:00
sheenachhabra
fd2ea22e47 Allow AV1 output mime type in FrameworkMuxer
The `MediaMuxer` (FrameworkMuxer) supports AV1 mime type from API 34.
For this to work track `Format/MediaFormat` must have `CSD`
data.

Change also include providing AV1 option in demo app.

Transmuxing of an AV1 mime type input will not work because
`Extractor` does not extract AV1 CSD data.

Verified changes manually via demo app.

PiperOrigin-RevId: 603002380
2024-01-31 04:02:21 -08:00
tonihei
b768ac791a Add e2e test for seeking to beginning of chunk 2024-01-31 11:53:55 +00:00
tonihei
c28c853541 Further adjustments to PR #1015
- Added back parsing of scheme data for version 1 as it's technically
  allowed by the spec.
- Made constructor of PsshAtom private to only publish the data class
  and not the constructor.
- Formatting and Javadoc adjustments
- Additional tests
2024-01-31 11:49:44 +00:00
sheenachhabra
c6cb6c4922 Move FileUtil.java into test_utils module
FileUtil.java can be extended to add more methods for validating
output file. This will be used in Transformer's robolectric tests and
instrumentation tests hence need to move to a common module.

PiperOrigin-RevId: 602789503
2024-01-30 11:33:10 -08:00
huangdarwin
3e59c113d7 Transformer: Allow single-sequence mixing HDR and SDR input.
Previously, input assets had to be all SDR or all HDR.

After this CL, if tone-mapping is requested, HDR and SDR may mix in any order. If tone-mapping is not requested, SDR may precede HDR, but not vice versa, until SDR to HDR tone-mapping is implemented

Some changes to accomplish this include:
1. Inputting the decoded format's color to VideoFrameProcessor.registerInputStream
for each stream.
2. Calculating the estimated decoded format's color for each stream, by estimating
it based on MediaCodec tone-mapping.

PiperOrigin-RevId: 602747837
2024-01-30 09:20:41 -08:00
samrobinson
7c8a31e2b1 Remove redundant boilerplate in AudioGraphTest & AudioGraphInputTest.
* getPcmFormat Util method already sets the mime type as AUDIO_RAW.
* static final AudioFormat consts improve test case readability.

PiperOrigin-RevId: 602740007
2024-01-30 08:53:10 -08:00
Gareth Fenn
173dbc87a2 Seek at a chunk level when seeking to chunk start positions
This avoids issues that can arise due to the slight discrepancies between
chunk start times (obtained from the manifest of segment index) and
the timestamps of the samples contained within those chunks.
2024-01-30 09:24:08 +00:00
sheenachhabra
03d35e3f43 Reset transformer state after resume finishes
PiperOrigin-RevId: 602467396
2024-01-29 12:32:42 -08:00
kamaroyl
b898dbacad Update Pssh Atom Util to expose internal data class, parse v1 PSSH atoms 2024-01-29 13:34:29 +00:00
claincly
dcae49a561 Fix blank video when switching on/off screen
This happens when using `ExoPlayer.setVideoEffects()`.

This CL also fixes the first frame not rendered problem, originally solved in
7e65cce967, but rolled back in 5056dfaa2b because the solution introduces
the flash that is observed in b/292111083.

Before media3 1.1 release, the output size of `VideoFrameProcessor` is not
reported to the app. This was changed later after introducing
`CompositingVideoSinkProvider`, where the video size after processing **is**
reported to the app. After this CL, the size is again, not reported.

PiperOrigin-RevId: 602345087
2024-01-29 04:24:19 -08:00
tonihei
bb533332f4 Update skip silence algorithm
The updated algorithm has two main improvements:
 - The silence padding is not constant but a ratio of the original
   silence (up to a defined max) to more naturally represent the
   original gaps.
 - The silence is not instantly going to zero, but uses a ramp down
   and up for a smooth volume transition and also retains a small
   percentage of the original noise for more natural "silences" that
   still contain some background noise.

#minor-release

Issue: google/ExoPlayer#7423
PiperOrigin-RevId: 602322442
2024-01-29 02:33:28 -08:00
Googler
994e2fc317 Rollback of f9eb8626eb
PiperOrigin-RevId: 601912101
2024-01-26 17:55:30 -08:00
Googler
9e48fcb8fb Rollback of 2e6982be2c
PiperOrigin-RevId: 601911260
2024-01-26 17:50:24 -08:00
Googler
e0be4c2ff4 Rollback of 4d5f844c61
PiperOrigin-RevId: 601910682
2024-01-26 17:45:40 -08:00
tofunmi
4d5f844c61 Clear the list of videoEffects in trim optimization
If trim optimisation is being applied, then `EditedMediItem.effects.videoEffects` only contains no-op effects or regular rotations that get be applied in the muxer wrapper. Therefore, we should clear the list of video effects to ensure that no effect gets applied twice.

This fixes requested rotations being applied twice in trim optimization.

Manually tested to ensure all combinations of trimming+muting+rotating works at intended.

PiperOrigin-RevId: 601853203
2024-01-26 13:33:53 -08:00
jbibik
eb3173aa90 Remove a redundant TODO in Util
PiperOrigin-RevId: 601820851
2024-01-26 11:34:43 -08:00
tonihei
2fc5590e7a Remove misleading @CanIgnoreReturnValue
The return value of onConfigure must not be ignored as it specifies
the output format of the processor, which may be different from the
input format.

#minor-release

PiperOrigin-RevId: 601799440
2024-01-26 10:19:40 -08:00
tonihei
ed5b7004b4 Replace or suppress deprecated usages
Many usages are needed to support other deprecations and some
can be replaced by the recommended direct alternative.

Also replace links to deprecated/redirected dev site

PiperOrigin-RevId: 601795998
2024-01-26 10:06:18 -08:00
tofunmi
7424cffce1 Support changing input colorinfo for images
since we now can support taking in the inputColor upon registering the stream, there is no need to hardcode the image input color anymore. We should now be able to support switching between texture and image input which we couldn't before, but this is untested and not necessary.

PiperOrigin-RevId: 601784149
2024-01-26 09:17:29 -08:00
huangdarwin
b1c1c2a6dd Transformer: Plumb hdrMode into AssetLoaders instead of forceInterpret.
This allows us to also plumb whether we're doing MediaCodec tone-mapping,
which will be used in a follow-up CL in the ExoAssetLoaderVideoRenderer.

PiperOrigin-RevId: 601774435
2024-01-26 08:36:21 -08:00
ibaker
373822ce45 Add a comment to suggest keeping JUnit version in sync with the Android
source tree - to make importing GTS tests easier.

PiperOrigin-RevId: 601725811
2024-01-26 04:14:40 -08:00
Googler
807d98a3d6 Update IMA README to include link to supported platforms
PiperOrigin-RevId: 601720412
2024-01-26 03:44:24 -08:00
tofunmi
2e6982be2c limit transmuxing to regular rotations only
PiperOrigin-RevId: 601710663
2024-01-26 02:46:50 -08:00
sheenachhabra
605689a020 Fix link to 1.3.0-alpha01 release
PiperOrigin-RevId: 601469906
2024-01-25 09:23:17 -08:00
sheenachhabra
21ab474260 Version bump to media3:1.3.0-beta01
#minor-release

PiperOrigin-RevId: 601441910
2024-01-25 07:28:43 -08:00
ibaker
12157a6b1a Make Cea608Parser and Cea708Parser package-private
It's likely that we will merge these back into their `XXXDecoder`
implementations, but this smaller change allows us to avoid including
these public symbols in the upcoming release.

#minor-release

PiperOrigin-RevId: 601432629
2024-01-25 06:43:57 -08:00
tofunmi
f9eb8626eb Support transmuxing when no op effects and regular rotations are set
PiperOrigin-RevId: 601419245
2024-01-25 05:34:06 -08:00
sheenachhabra
79b0b8090c Update release notes for Media3 1.3.0-beta01 release
#minor-release

PiperOrigin-RevId: 601408404
2024-01-25 04:34:10 -08:00
ibaker
a6812156e6 Throw immediately from ExoPlayer.setVideoEffects() if dep not found
This method works by reflectively loading classes from the `lib-effect`
module, in order to avoid a hard dependency on this module for ExoPlayer
users that don't want video effect functionality. This change ensures
that a failure to load the necessary classes fails immediately, instead
of on a later thread inside `MediaCodecVideoRenderer` when the
reflection currently happens.

Also update the javadoc to make the dependency requirement clear.

#minor-release

PiperOrigin-RevId: 601387957
2024-01-25 02:43:35 -08:00
jbibik
f103a2dcf5 Add a setter of SubtitleParser.Factory to MediaSource.Factory
DASH: `DashMediaSource.Factory` would only propagate it to `DashChunkSource.Factory` -> `BundledChunkExtractor.Factory`

SS: `SSMediaSource.Factory` -> `SsChunkSource.Factory`

HLS: `HlsMediaSource.Factory` -> `HlsExtractorFactory`

Remove nullability of SubtitleParser.Factory across the stack

#minor-release

PiperOrigin-RevId: 601250013
2024-01-24 15:19:50 -08:00
christosts
85db94782a Rollback of e364510937
PiperOrigin-RevId: 601187997
2024-01-24 11:50:24 -08:00
jbibik
4d7b23f0d1 Add setters of SubtitleParser.Factory and experimental toggle
The `SubtitleParser.Factory` is no longer @Nullable and the experimenting toggle is used to enable/disable the use of this factory for subtitle parsing during extraction.

The three places that will hold the "truth" for the `SubtitleParser.Factory` are: BundledChunkExtractor.Factory, SsChunkSource.Factory, DefaultHlsExtractorFactory

DASH: `DashMediaSource.Factory` would only propagate it to `DashChunkSource.Factory` -> `BundledChunkExtractor.Factory`

SS: `SSMediaSource.Factory` -> `SsChunkSource.Factory`

HLS: `HlsMediaSource.Factory` -> `HlsExtractorFactory`

#minor-release

PiperOrigin-RevId: 601151615
2024-01-24 09:55:49 -08:00
sheenachhabra
0acf6902e5 Write "stco" box instead of "co64" for fragmented MP4
As per MP4 spec ISO 14496-12: 8.7.5 Chunk Offset Box, Both "stco" and
"co64" can be used to store chunk offsets. While "stco" supports 32-bit
offsets, "co64" supports 64-bit offsets.
In non fragmented MP4, the mdat box can be extremely large, hence muxer
uses "co64" box.
But for fragmented MP4, muxer does not write any data in this chunk offset
box (present in "moov" box) because all sample related info is present in
"moof" box.
Technically, "co64" box should also work in fragmented MP4because
its empty only but QuickTime player fails to play video if "co64"
box is present in fragmented MP4 output file.

Testing: Verified that QuickTime player does not play video when "co64"
box is present but is able to play when "stco" box is present.

#minor-release

PiperOrigin-RevId: 601147046
2024-01-24 09:40:20 -08:00
jbibik
966b710897 Remove SubtitleParser.Factory references from Hls/Ss/DashMediaPeriod
Those classes only needed to have access to a `SubtitleParser.Factory` to get a potentially updated `Format` for TrackGroups. The `SubtitleParser.Factory` was only used to check the support for the `mimeType` and getting some cue-related behaviour.

This introduced complexity in a way that both Periods and Extractors needed to have the same `SubtitleParser.Factory` in their individual stacks. To ensure that the sample queue would get the same transcoded/original format.

Instead, now we expose `getOutputTextFormat` methods on `ChunkExtractor.Factory`, `SsChunkSource.Factory` and `HlsExtractorFactory`. Those are the dependencies that Hls/Ss/DashMediaPeriod can make use of to delegate the format-updating logic to.

#minor-release

PiperOrigin-RevId: 601130714
2024-01-24 08:40:39 -08:00
rohks
f8dbbc82e2 Add Mp4ExtractorTest for sample with edit list (edts box)
The sample has multiple sync frames for video track.

PiperOrigin-RevId: 601129350
2024-01-24 08:33:02 -08:00
sheenachhabra
806f90922b Write sample data offset related fields in tfhd and trun box
This fix makes output playable on VLC player.
The output does not play on QuickTime player which is being fixed in
a separate CL.

#minor-release

PiperOrigin-RevId: 601118813
2024-01-24 07:52:02 -08:00
michaelkatz
688622eb47 Keep stream offset alive in ImageRenderer until stream transition
Fix modeled after OutputStreamInfo usage for stream offset in `MediaCodecRenderer`

PiperOrigin-RevId: 601109900
2024-01-24 07:10:04 -08:00
tofunmi
b94c7d08c1 MuxerWrapper rotation degree fix
Allow setAdditionalRotationDegrees to be called with same rotation after tracks added. This is needed for processes that mux files partially trim optimization so they don't error out after hitting the check state

Manually tested to ensure trim optimization succeeds, automated test added here as well

PiperOrigin-RevId: 601081778
2024-01-24 04:44:28 -08:00
ibaker
e5621cc709 Add proguard keep rules for ExoPlayer.setVideoEffects
These symbols in `lib-effect` are referenced via reflection from
`CompositingVideoSinkProvider` in `lib-exoplayer` in order to avoid
a hard dependency from `lib-exoplayer` to `lib-effect`. Without this
keep rule, the symbols can get renamed by R8 resulting in the
invocations failing.

#minor-release

PiperOrigin-RevId: 601074636
2024-01-24 04:08:40 -08:00
timpeut
9c1aaa7c43 Suppress nullability warnings
PiperOrigin-RevId: 600891113
2024-01-23 13:34:14 -08:00
tianyifeng
35ac46b92e Change the behaviour in MediaMetadata.Builder.populate
Populate both `artworkUri` and `artworkData` in
`MediaMetadata.Builder.populate(MediaMetadata)` when at least one of them is non-null.

Issue: androidx/media#964
PiperOrigin-RevId: 600826103
2024-01-23 10:08:33 -08:00
sheenachhabra
b98e5ac0d4 Suppress lint warning about missing POST_NOTIFICATIONS permission
For media session related notifications, permission is not required.
https://developer.android.com/develop/ui/views/notifications/notification-permission#exemptions-media-sessions

#minor-release

PiperOrigin-RevId: 600819251
2024-01-23 09:46:50 -08:00