19844 Commits

Author SHA1 Message Date
ibaker
1202f8690c Bump effect and leanback minSdk to 19
These were overriding the previous minimum of 16 and therefore not
included in e54abaa75d.

PiperOrigin-RevId: 597242364
2024-01-10 07:22:00 -08:00
ibaker
3f9e0540b7 Remove non-progressive limitation from DefaultMediaSourceFactory.experimentalParseSubtitlesDuringExtraction
This involves promoting `setTextTranscodingEnabled` to
`ExtractorsFactory`, and also making it experimental, to indicate it's a
short-lived method.

PiperOrigin-RevId: 597235252
2024-01-10 06:46:50 -08:00
jbibik
d6ef48fff8 Plumb SubtitleParser.Factory into Mp4Extractor
Mp4Extractor will no longer be wrapped in SubtitleTranscodingExtractor, but instead use SubtitleTranscodingExtractorOutput under the hood.

FLAG_EMIT_RAW_SUBTITLE_DATA flag will be used to toggle between subtitle parsing during extraction (before the sample queue) or during decoding (after the sample queue).

PiperOrigin-RevId: 597221831
2024-01-10 05:36:08 -08:00
tofunmi
51d60e1f3a GaussianBlur: make short constructor call the longer one
PiperOrigin-RevId: 597212434
2024-01-10 04:42:35 -08:00
tonihei
3596bc332d Use AudioAtributes when determining AudioCapabilities
The capabilities change depending on the attributes, so we should
pass down the actual attributes used during playback and update
the capabilities whenever these change.

PiperOrigin-RevId: 597197507
2024-01-10 03:17:54 -08:00
ibaker
4fde35c9cc MP3: Extract Xing/Info parsing code from XingSeeker
This means in a later change we can still use some of the info for CBR
files, even if we want to ignore the imprecise table of contents and
seek based on a constant bitrate assumption instead.

PiperOrigin-RevId: 597193997
2024-01-10 03:00:30 -08:00
Googler
460501fcd1 Log ExportResult information when running transformer demo app
Log elapsed time, in addition to displaying it on screen.
Reuse logging logic between tests and demo.

PiperOrigin-RevId: 597186692
2024-01-10 02:24:31 -08:00
ibaker
143d782b1c Add private @SeekHeader IntDef to Mp3Extractor
Also use `switch` instead of `if-else`.

PiperOrigin-RevId: 597004322
2024-01-09 12:04:24 -08:00
ibaker
1c1d4d506d MP3: Correct duration calculation in XingSeeker
An audio file can only play sound between two PCM samples (the 'start'
and 'end' of section of a wave form). Therefore when calculating
duration from a count of PCM samples we need to subtract one first (the
'end' sample which has no duration of its own).

This only changes durations by one PCM sample (21us - 22us for 44.1kHz sample
rate).

PiperOrigin-RevId: 596990306
2024-01-09 11:16:49 -08:00
tonihei
ba8f55694a Set PCM encoding in Flac extractor
The extractor knows the PCM encoding of the losslessly
encoded data in the samples and should set it in the
Format to allow downstream components to use this information.

PiperOrigin-RevId: 596974863
2024-01-09 10:28:55 -08:00
ibaker
320dd32be9 Add extractor test for an MP3 file with Info header
Issue: androidx/media#878
PiperOrigin-RevId: 596957503
2024-01-09 09:30:21 -08:00
jbibik
da724c8cc4 Plumb SubtitleParser.Factory into FragmentedMp4Extractor
We introduce SubtitleParser.Factory that supports no formats to be used FragmentedMp4Extractors that will not do any subtitle parsing on the extraction side. We also slowly move away from using SubtitleTranscodingExtractor to SubtitleTranscodingExtractorOutput (hence making it public).

This is required by individual Extractor impls so that they can start using SubtitleTranscodingExtractorOutput rather than be wrapped by SubtitleTranscodingExtractor. The latter is to be deprecated after all the subtitle related Extractors have achieved this migration.

PiperOrigin-RevId: 596942147
2024-01-09 08:33:27 -08:00
ibaker
e54abaa75d Increase minSdk to 19
This is aligned with all other AndroidX libraries, and is required for
us to upgrade to the latest versions of our AndroidX dependencies:
https://android-developers.googleblog.com/2023/10/androidx-minsdkversion-19.html

PiperOrigin-RevId: 596923511
2024-01-09 07:15:21 -08:00
michaelkatz
324e1beef2 Bump media3 version to 1.2.1 and update RELEASENOTES
#minor-release

PiperOrigin-RevId: 596916027
2024-01-09 06:39:56 -08:00
tofunmi
dee2d3af73 GlassianBlurTest: move golden images comment next to the test
PiperOrigin-RevId: 596892569
2024-01-09 04:41:46 -08:00
christosts
4198f7e242 Add utility testing Player.Listener in transformer tests
PiperOrigin-RevId: 596891721
2024-01-09 04:36:45 -08:00
Copybara-Service
6f8249184b Merge pull request #942 from datdoantelus:CC_708_parser_fix
PiperOrigin-RevId: 596836615
2024-01-09 00:25:58 -08:00
huangdarwin
c6b51003d3 Effect: Allow updating inputColorInfo between streams in VFP.
Whenever the inputColorInfo updates, update the samplingGlShaderProgram.

Also, allow either SDR or gamma2.2 to be used for HDR->SDR tone-mapping
`outputColorInfo` request. This is required because we can't update the
`outputColorInfo`, but plan to always use gamma2.2 for `outputColorInfo` in the
future.

This allows VideoFrameProcessor to work as is for exoplayer previewing, but
only when not seeking. As we haven't plumbed the per-stream inputColorInfo from
ExoPlayer down to VFP.registerInputStream, follow-up CLs will be needed to
properly support previewing with changing inputColorInfo.

PiperOrigin-RevId: 596627890
2024-01-08 10:09:04 -08:00
ibaker
77f311917f Play clear samples in DRM content without keys by default
This behavior was previously available as opt-in via
`MediaItem.DrmConfiguration.Builder.setPlayClearContentWithoutKey` and
`DefaultDrmSessionManager.Builder.setPlayClearSamplesWithoutKeys`. This
change flips the default of both these properties to true.

This should speed up the time for playback to start when playing DRM
content with a 'clear lead' of unencrypted samples at the start.
Previously playback would wait until the keys for the later encrypted
samples were ready. The new behaviour could result in mid-playback
stalls/rebuffers if the keys are not ready yet by the transition from
clear to encrypted samples, but this is not really a regression since
previously playback wouldn't have started at all at this point.

PiperOrigin-RevId: 595992727
2024-01-05 07:46:25 -08:00
ibaker
62f6c64a91 Rename test.mp3 test asset to test-cbr-info-header.mp3
This file is CBR encoded with LAME, so it has an `Info` header (the CBR
equivalent to `Xing`).

A follow-up change will use this file in `Mp3ExtractorTest`.

Issue: androidx/media#878
PiperOrigin-RevId: 595938327
2024-01-05 02:31:20 -08:00
ibaker
95e742948c Clarify docs on Player.setMediaItem(s) and replaceMediaItem(s)
These methods sound similar, but have different behaviour. This change
tries to make the distinction clearer, and sign-post from one to the
other.

#minor-release

Issue: androidx/media#910
PiperOrigin-RevId: 595701540
2024-01-04 07:41:34 -08:00
bachinger
5c50b27e8f Return null if media notification controller Future is not done
When the media notification controller is requested for a session
with `getConnectedControllerForSession` and the `Future` is not null
but not yet completed, the `Future` was returned either way. This was
reported as creating a race condition between the notification
being requested for update the very first time, and the media
notification controller having completed connecting to the session.

Returning null from `getConnectedControllerForSession` when the
`Future` is available but not yet done fixes the problem. This is
safe because for the case when a notification update is dropped,
the media notification controller will trigger the update as soon
as the connection completes.

Issue: androidx/media#917
#minor-release
PiperOrigin-RevId: 595699929
2024-01-04 07:35:54 -08:00
ibaker
1cb6865884 Remove CEA-6/708 support from DefaultSubtitleParserFactory
`Cea608Parser` and `Cea708Parser` don't currently work correctly on
their own without the re-ordering of input buffers implemented in
`CeaDecoder`, and it's not clear how we can properly do this re-ordering
during extraction. This change ensures that if 'parse subtitles
during extraction' is enabled, CEA-6/708 subs will be passed through
without transcoding and can then be decoded during rendering by
`Cea6/708Decoder`.

PiperOrigin-RevId: 595658628
2024-01-04 03:48:41 -08:00
Copybara-Service
8eda9f2ed2 Merge pull request #369 from Tolriq:fix_invalid_frames
PiperOrigin-RevId: 595650068
2024-01-04 03:02:29 -08:00
rohks
5970d2d586 Document and remove check for C.TIME_UNSET when consuming data in TS
PiperOrigin-RevId: 595647795
2024-01-04 02:50:04 -08:00
Ian Baker
0b482ef58c Remove columnLock, columnCount (unimplemented) and rowLock (always true)
Also add a release note and simplify the test by removing the garbage
prefix and suffix.
2024-01-03 17:49:35 +00:00
Ian Baker
04751a1cdb Format with google-java-format 2024-01-03 17:36:55 +00:00
datdoantelus
a58ddcfa23 Update test comment. 2024-01-03 17:36:55 +00:00
datdoantelus
28eb55c077 Use skipBits(2) instead of readBits for ignored bits.
Add singleServiceAndWindowDefinition_ignoreRowLock test to Cea708ParserTest
2024-01-03 17:36:55 +00:00
datdoantelus
8b39f7e287 Ignore rowLock and columnLock values as specified by ANSI/CTA-708-E S-2023 document (section 8.4.7) 2024-01-03 17:36:55 +00:00
Ian Baker
f935f59eaa Improve logging by including full stack trace, and add release note 2024-01-03 16:14:37 +00:00
Ian Baker
820278c564 Format with google-java-format 2024-01-03 15:49:43 +00:00
Tolriq
de772cfbf0 Catch errors and OOM when decoding ID3 frames.
Invalid frames have no impact on ExoPlayer ability to play the media and should not fail on errors.
Some tools can add 100Mb images in the tags that will trigger recoverable OOM with this fix.
2024-01-03 15:49:43 +00:00
samrobinson
c230414bd3 Set the default audio encoder bitrate in DefaultEncoderFactory.
Matches the approach for video frame rate.

PiperOrigin-RevId: 595385930
2024-01-03 06:37:16 -08:00
sheenachhabra
3ecf8732ba Add comments for skipping input files in Mp4Muxer tests
PiperOrigin-RevId: 595356012
2024-01-03 03:50:46 -08:00
bachinger
b11c0c19b0 Declare demo service as MediaLibraryService
The `PlaybackService` of the demo app is declared
as `androidx.media3.session.MediaSessionService` instead
of `androidx.media3.session.MediaLibraryService`. While
this technically works, its confusing to do that in the
demo app.

Generally, apps that declare the legacy
`android.media.browse.MediaBrowserService` should also
declare `androidx.media3.session.MediaLibraryService`
and the demo app should reflect this common case.

Issue: androidx/media#672
PiperOrigin-RevId: 595320994
2024-01-03 00:51:17 -08:00
ibaker
258ffa68b5 Add tests with out-of-order CEA-608 input buffers
The `Cea608DecoderTest` added here fails if re-ordering is removed from
`CeaDecoder`.

The `Cea608ParserTest` is added with `@Ignore` because there's currently
no re-ordering support in this part of the subtitle handling pipeline
(partly because there's no concept of 'current playback time', meaning
it's hard to know **when** to re-order).

PiperOrigin-RevId: 595320205
2024-01-03 00:45:31 -08:00
ibaker
7b450f0d0a Fix limit calculation to include offset in Cea6/708Parser.parse
PiperOrigin-RevId: 595007390
2024-01-01 20:22:27 -08:00
sheenachhabra
5149cc60ac Skip Mp4Muxer tests for unwanted input files
PiperOrigin-RevId: 594478028
2023-12-29 11:10:26 -08:00
bachinger
426bc94090 Don't set negative values to setWhen()
When the 'when' timer of the notification is disabled
`DefaultMediaNotificationProvider` may set `C.TIME_UNSET`
as the time. Users reported problems on some devices with
this and the docs ask for an event time that probably
shouldn't be a negative number.

This change sets `0L` instead of `C.TIME_UNSET` when the
timer is disabled.

Issue: androidx/media#903

#minor-release

PiperOrigin-RevId: 594451074
2023-12-29 06:56:02 -08:00
sheenachhabra
846ace16aa Allow creating fragmented MP4 file via demo app
PiperOrigin-RevId: 594435072
2023-12-29 04:39:04 -08:00
sheenachhabra
27ae6d974e Allow creating fragmented MP4 file via InAppMuxer
PiperOrigin-RevId: 594431665
2023-12-29 04:15:01 -08:00
sheenachhabra
e0257f403f Implement fragmented MP4 (fMP4) in the Mp4Muxer
Changes includes;
1. Public API to enable fMP4 and to pass fragment duration.
2. Added `FragmentedMp4Writer`.
3. Added logic to create fragments based on given fragment duration.
4. Write "moov" box only once in the beginning.
3. Add all the required boxes for current implementation.
4. Unit tests for all the new boxes.
5. E2E test for generating fMP4.

Note: The output file is un seek-able with this first implementation.
PiperOrigin-RevId: 594426486
2023-12-29 03:39:38 -08:00
sheenachhabra
b0e00a7d28 Fix ByteBuffer.array() warning
PiperOrigin-RevId: 594274620
2023-12-28 10:07:47 -08:00
sheenachhabra
1609928242 Throw exception when B-frames are written to Mp4Muxer
Mp4Muxer does not support out of order B-frames. Currently it
silently writes out of order B-frames, producing an invalid file (with
negative sample durations).

Although `Mp4Extractor` is somehow able to process this invalid file and
`Exoplayer` is able to play it but that is unexpected.

The `sample.mp4` test file contains B frames. Other test files does not
contain `H264 video + AAC audio` format hence created a new test file by
running `sample.mp4` via `Transformer` after applying some effects.

PiperOrigin-RevId: 594016144
2023-12-27 08:32:36 -08:00
tofunmi
0ab7bafa87 Migrate Gaussian Blur Effect to media3.
PiperOrigin-RevId: 593164068
2023-12-22 14:13:19 -08:00
tofunmi
e3056dacac Rename Mp4MetadataInfo to mp4Info
PiperOrigin-RevId: 593143940
2023-12-22 11:10:30 -08:00
tofunmi
4fc11a98a1 ignore dropSamplesBeforeFirstVideoSample in audio-only streams
PiperOrigin-RevId: 593126632
2023-12-22 08:54:29 -08:00
ibaker
64231ee079 Tweak SubtitleTranscodingTrackOutput.ensureSampleDataCapacity
This more closely matches the intended, documented behaviour of this
method. The previous implementation was incorrectly checking
`sampleDataEnd + newSampleSize`, but it's more correct to compare
`existingSampleDataLength + newSampleSize`, in order to handle the
case of non-zero `sampleDataStart`. We've already checked above whether
`newSampleSize` fits after `sampleDataEnd` without growing or
reshuffling the array, so no need to basically repeat that check.

In the case of handling one sample at a time, the previous
implementation resulted in `sampleData` growing by `sampleSize`
**every time** the pointers reached the end. With the new check for
`sampleDataStart == sampleDataEnd`, this is avoided by always writing
each new sample at the start of the array (because the previous sample
has already been consumed), meaning `sampleData` remains equal to
`sampleSize` without growing.

PiperOrigin-RevId: 593119927
2023-12-22 08:06:30 -08:00
tofunmi
7e12b9e15f Add rough progress updates in trim optimization
PiperOrigin-RevId: 593116025
2023-12-22 07:37:23 -08:00