20051 Commits

Author SHA1 Message Date
tonihei
f8f6d80477 Add source prefix to MergingMediaPeriod Format ids
This was already done for the TrackGroup ids in <unknown commit>,
but in some scenarios only the Format instances are known and
it's helpful to be able to identify where they came from.

Issue: androidx/media#883

#minor-release

PiperOrigin-RevId: 604644039
2024-02-06 07:45:42 -08:00
tonihei
766a15a51e Include nullness of RequestMetadata.extras in equals method
This ensures RequestMetadata with just non-null extras is not
considered equal to RequestMetadata.EMPTY. This makes sure the
contents are bundled when a controller sets the extras in a
new MediaItem.

PiperOrigin-RevId: 604632788
2024-02-06 06:58:51 -08:00
ibaker
db74bb9609 Clearly define the consistency requirements for SequenceableLoader
Add a test for this consistency in `CompositeSequenceableLoaderTest`,
and also make the
`CompositeSequenceableLoaderTest.FakeSequenceableLoader` implementation
more realistic.

#minor-release

PiperOrigin-RevId: 604604103
2024-02-06 04:25:14 -08:00
andrewlewis
e683b9a506 Expand encoding operating rate workaround
PiperOrigin-RevId: 604602441
2024-02-06 04:15:49 -08:00
Googler
718cf1299b Fix Kotlin 2.0 compilation error in session demo app
Since Kotlin 2.0 the compiler became better at detecting incorrect
annotation applications. The @OptIn annotation can't be applied to an
expression, so when compiling with Kotlin 2.0 it results in an error.

PiperOrigin-RevId: 604596657
2024-02-06 03:47:20 -08:00
ibaker
25498b151b Merge Cea608Parser back into Cea608Decoder
This reverses 27caeb8038

Due to the re-ordering of packets done in `CeaDecoder`, there's no way
to use the current implementation to correctly parse these subtitle
formats during extraction (the `SubtitleParser` interface), so we have
to keep the `SubtitleDecoder` implementations.

#minor-release

PiperOrigin-RevId: 604594837
2024-02-06 03:36:23 -08:00
ibaker
51b4fa2cc8 Merge Cea708Parser back into Cea708Decoder
This reverses 94e45eb4ad

Due to the re-ordering of packets done in `CeaDecoder`, there's no way
to use the current implementation to correctly parse these subtitle
formats during extraction (the `SubtitleParser` interface), so we have
to keep the `SubtitleDecoder` implementations.

#minor-release

PiperOrigin-RevId: 604350951
2024-02-05 10:03:32 -08:00
huangdarwin
e4145a9953 Update javadoc to be the right DrawableOverlay class.
PiperOrigin-RevId: 604337168
2024-02-05 09:13:40 -08:00
tofunmi
4da576f05f Support transmux when both no op effects and regular rotations are set
PiperOrigin-RevId: 604319412
2024-02-05 08:05:32 -08:00
samrobinson
f8352580cb Add AudioGraphInput tests around getOutput behaviour.
PiperOrigin-RevId: 604297126
2024-02-05 06:18:46 -08:00
tofunmi
49c6d25106 Move setting the muxerWrapper rotation out of shouldTranscodeVideo()
Before supporting transmuxing when both no op effects and regular rotations are set, move setting the muxerWrapper rotation out of shouldTranscodeVideo() to ensure the muxerWrapper rotation is only set at the appropriate times.

This cl also ensures the state between the muxerWrapper and the list of video effects is consistent by clearing 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.

PiperOrigin-RevId: 604292052
2024-02-05 05:54:11 -08:00
samrobinson
029071a342 Improve checks around AudioGraphInput configuring with requested format
Also adds extra AudioGraphInputTest cases.

PiperOrigin-RevId: 603690041
2024-02-02 08:13:54 -08:00
huangdarwin
1bd04cb5d9 Add support for GlProgram GL_FLOAT_VEC4.
https://github.com/androidx/media/issues/1039

PiperOrigin-RevId: 603684630
2024-02-02 07:46:04 -08:00
tofunmi
c79f950d26 ultra HDR: send gainmap downstream if HDR output requested
removing the useHdr parameter from queueInputBitmap() it suggests we support changing between HDR and SDR within a stream, which we don't support. instead, identifying whether to use HDR from the shaderprogram which is informed by the inputColorInfo when the stream is registered.

PiperOrigin-RevId: 603681736
2024-02-02 07:33:15 -08:00
tofunmi
271eb88b48 Remove texture copy from SpeedChangeShaderProgram
Introduces PassthroughShaderProgram to make the effect more efficient.

PiperOrigin-RevId: 603670438
2024-02-02 06:30:18 -08:00
huangdarwin
8b6c8fc480 Test: Remove assertions from test infra.
PiperOrigin-RevId: 603664759
2024-02-02 05:57:30 -08:00
samrobinson
2b52c2d74f Add extra documentation to AudioGraphInput.
PiperOrigin-RevId: 603663084
2024-02-02 05:47:05 -08:00
sheenachhabra
30b60f6c60 Refactor assertFileHasColorTransfer method
PiperOrigin-RevId: 603662313
2024-02-02 05:42:28 -08:00
huangdarwin
ae85ba9ee9 Effect: Remove extra checkStateNotNull by reordering logic.
PiperOrigin-RevId: 603660773
2024-02-02 05:34:11 -08:00
huangdarwin
d87179b463 Effect: Remove stale TODO.
PiperOrigin-RevId: 603632255
2024-02-02 02:55:13 -08:00
huangdarwin
a27511cc50 Effect: Remove inputColorInfo from create() methods.
Transformer export and ExoPlayer previewing both read inputColorInfo from
registerInputStream now, instead of maintaining a consistent input color
throughout multiple streams in a sequence.

Therefore, we can remove inputColor-related arguments and methods now.

PiperOrigin-RevId: 603423509
2024-02-01 11:09:57 -08:00
huangdarwin
dd7846ee1c Effect: Use element instead of peek, when throwing if null.
If nullness should result in an exception, we should throw as soon as possible,
so that stack traces are easier to follow.

Did a quick scan of media3.effect+transformer and this covers all uses of
peek that immediately throw there.

PiperOrigin-RevId: 603393366
2024-02-01 09:32:21 -08:00
huangdarwin
42ac0e5492 Effect: Report errors during registerInputStream
Without this, GLSL compilation errors may lead to the test stalling indefinitely

PiperOrigin-RevId: 603381111
2024-02-01 08:42:43 -08:00
sheenachhabra
198e3fb166 Assert Export output mime type by retrieving output file metadata
PiperOrigin-RevId: 603333340
2024-02-01 04:49:02 -08:00
tonihei
e3e57c9b99 Fix HlsPlaybackTest flakiness
The new test introduced in 45bd5c6f0a is flaky because we only
wait until the media is fully buffered. However, we can't fully
control how much of this data is initially read by the Robolectric
codec and thus the output dump files (containing these codec
interactions) are flaky.

This can be fixed by fully playing the media once and then seeking
back instead.

#minor-release

PiperOrigin-RevId: 603324068
2024-02-01 03:58:37 -08:00
michaelkatz
62c7ee0fb0 Render last image despite not receiving EoS
If seeking between last image sample and end of the file where the current stream is not final, then EoS sample will not be provided to `ImageRenderer`. ImageRenderer must still produce the last image sample.

PiperOrigin-RevId: 603312090
2024-02-01 02:54:36 -08:00
Copybara-Service
f85860c041 Merge pull request #1011 from cedricxperi:dts-lbr-hls-bitrate-unknown-fix
PiperOrigin-RevId: 603302863
2024-02-01 02:09:02 -08:00
huangdarwin
554530a426 Effect: Remove unused setOutputSurfaceInfo method
This hasn't been used, since b466b06ace

PiperOrigin-RevId: 603097097
2024-01-31 10:49:42 -08:00
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
tonihei
9ba93d386d Reworded comment and formatting fixes 2024-01-31 18:05:33 +00: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
Cedric T
460280556e Move DTS Express bit-rate change to DefaultAudioSink.java 2024-01-31 12:33:18 +00:00
Cedric T
b915b04594 Fix HLS DTS Express bit-rate unknown issue. 2024-01-31 12:33:18 +00: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