423 Commits

Author SHA1 Message Date
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
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
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
ibaker
486230fbd7 Throw a clear error from Cea608/708Parser.parseToLegacySubtitle
This would have immediately exposed the mistakes fixed by
7ca26f898d

Issue: androidx/media#904
PiperOrigin-RevId: 592244943
2023-12-19 08:34:37 -08:00
tonihei
01578780a6 Use different wraparound assumptions for duration readers
The timestamp adjuster also estimates the number of wraparounds
of the 90Khz TS timestamp. It does that by assuming that a new
timestamp is always close to the previous one (in either direction).

This logic doesn't always work for duration estimates because the
timestamp at the end of the media is not close to the one at the
beginning and it may also never be less than the one at the beginning.

This can be fixed by introducing a new estimation model that assumes
the new timestamp is strictly greater than the previous one without
making the assumption that it has to be close to it.

Issue: androidx/media#855

#minor-release

PiperOrigin-RevId: 590936953
2023-12-14 07:47:11 -08:00
lpribanic
d52772dff8 Set image tile counts to what the manifest says
Vertical and horizontal tile counts inside Format used by ImageRenderer
used to be required to equal 1 and were set to 1 regardless of what
the manifest said.

This change removes the above requirement and sets the tile counts to
the values from the manifest.

PiperOrigin-RevId: 590608353
2023-12-13 08:37:06 -08:00
Copybara-Service
f465efeefd Merge pull request #864 from v-novaltd:dsparano-exo129_2
PiperOrigin-RevId: 590234505
2023-12-12 09:37:41 -08:00
ibaker
5580b78b13 Fix VorbisComment.populateMediaMetadata key comparison to ignore case
Issue: androidx/media#876

#minor-release

PiperOrigin-RevId: 590215918
2023-12-12 08:43:02 -08:00
ibaker
5266c71b3a Fix handling of multiple HEVC tracks in JPEG motion photos
The MP4 data in JPEG motion photos can contain multiple `video/hevc` tracks, but only the first is at a playable frame rate while the others are low-fps, high-res tracks designed for specific use-cases (not direct video playback).

ExoPlayer currently selects the unplayable track by default, because it
has a higher resolution. This change introduces a flag to
`Mp4Extractor` that results in the first video track being marked as
`ROLE_FLAG_MAIN`, and all subsequent video tracks `ROLE_FLAG_ALTERNATE`
- this then results in the playable lower-res track being selected by
default.

PiperOrigin-RevId: 589832072
2023-12-11 08:31:13 -08:00
tonihei
eb2092bc8b Formatting fixes and release notes 2023-12-11 15:12:50 +00:00
Daniele Sparano
6f5187a34b Format to wake up PR 2023-12-11 14:28:11 +00:00
Daniele Sparano
4a17ca7600 Add basic h264 sample unit test to ensure correct sample flags, including key frames 2023-12-11 14:28:11 +00:00
Daniele Sparano
d4af13803a Fix H264 reader key frame detection 2023-12-11 14:28:11 +00:00
ibaker
379cb3ba54 Tighten the handling of validDataChannelTimeoutMs in Cea608Parser
This matches the documented requirements for this parameter.

PiperOrigin-RevId: 589799256
2023-12-11 06:05:53 -08:00
ibaker
bd19953ac9 Split Cue.toBundle into serializable and binder-based variants
The serializable form is used when we need to serialize the result into
bytes in the sample queue. The binder-based (ultimately
filedescriptor-based) form is used for
session/controller IPC, in order to avoid sending the bitmap bytes over
the IPC.

Issue: androidx/media#836

#minor-release

PiperOrigin-RevId: 588420836
2023-12-06 07:35:34 -08:00
ibaker
6360082b87 Add extractor and playback tests for Pixel JPEG motion photo
This image has two video tracks in the MP4 data, one is a 'real' video
which we want to play by default, and the other is a low-fps video track
which isn't intended to be directly played, it's encoded in HEVC for
compression and decoding efficiency.

This test demonstrates ExoPlayer's current behaviour default extraction
and playback, which results in selecting the high-res, low-fps track
(actually single sample in this example), instead of playing the actual
video.

PiperOrigin-RevId: 588068908
2023-12-05 07:46:19 -08:00
michaelkatz
d1e38abf93 Limit processing Opus decode-only frames by seek-preroll in offload
As Opus decoders skip some bytes prior to playback during a seek, the renderer for bypass playback should send samples to the decoder even if they would be decode-only. However, the renderer should not send samples with time preceding that range. This change adds that constraint.

#minor-release

PiperOrigin-RevId: 588014983
2023-12-05 03:44:37 -08:00
tonihei
b1541b096f Map VORBIS channel layout to Android layout
Both the extension OPUS decoder and the OMX/C2 MediaCodec
implementations for OPUS and VORBIS decode into the channel
layout defined by VORBIS. See
https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-140001.2.3

While this is technically correct for a stand-alone OPUS or VORBIS
decoder, it doesn't match the channel layout expected by Android.
See https://developer.android.com/reference/android/media/AudioFormat#channelMask

The fix is to apply the channel mapping after decoding if needed.
Also add e2e tests with audio dumps for the extension renderer,
including a new 5.1 channel test file.

Issue: google/ExoPlayer#8396

#minor-release

PiperOrigin-RevId: 588004832
2023-12-05 03:01:32 -08:00
ibaker
63062a9c10 Make CueSerializationTest more realistic
Serializing bitmap cues is currently broken, but this test is
incorrectly passing. This change makes two changes to introduce the same
failure (both changes are necessary, each one alone still passes):

1. Move from Robolectric to an instrumentation test.
2. Trigger the `Bitmap` to be serialized using a file descriptor, either
   by calling `Bitmap.asShared` in the test when constructing the `Cue`,
   or constructing the `Bitmap` from a 'real' image byte array instead a
   1x1 token image.

Issue: androidx/media#836
PiperOrigin-RevId: 585643486
2023-11-27 07:16:19 -08:00
jbibik
c0ef5f6de4 Serialize media3 custom Spans for Cue encoding/decoding
PiperOrigin-RevId: 585028521
2023-11-24 01:32:40 -08:00
Copybara-Service
fde142d66e Merge pull request #793 from androidx:mpegh_extractor_changes
PiperOrigin-RevId: 584291984
2023-11-21 05:07:27 -08:00
Rohit Singh
4c3ca9b6f4 update mhm1 mp4 samples and corresponding extractor dumps 2023-11-21 12:12:23 +00:00
ibaker
4bcb60d31d Add Cea708Decoder/ParserTest with a single, simple example
PiperOrigin-RevId: 584042033
2023-11-20 09:06:03 -08:00
jbibik
94e45eb4ad Migrate CEA-708 logic to a SubtitleParser implementation
This change is similar to 27caeb8038 (CEA-608), but is currently lacking unit tests.

PiperOrigin-RevId: 582585457
2023-11-15 01:38:56 -08:00
tonihei
b570c72588 Normalize MIME types when accepting user or media input
MIME types are case-insensitive, but none of the many existing
comparisons across our code base take this into account. The
code can be made more robust by normalizing all MIME types at the
moment they are first set into a class/builder and adding toLowerCase
as part of the normalization.

Most concretely, this fixes an issue with playing HLS streams via
the IMA SDK where the stream MIME type is indicated with all lower
case "application/x-mpegurl", which failed the MIME type comparison
in DefaultMediaSourceFactory.

PiperOrigin-RevId: 582317261
2023-11-14 07:40:15 -08:00
Rohit Singh
6297e7aeae Changes based on internal review 2023-11-07 14:23:07 +00:00
Rohit Singh
8e554c6d6a - some further changes according to review comments
- update MPEG-H test data and extractor dumps
2023-11-07 13:01:20 +00:00
Rohit Singh
6d2059080b - changes according to review comments
- add test data and dumps
2023-11-06 13:28:26 +00:00
Rohit Singh
94442291bd Extend MP4 extractor implementation with complete parsing of mhaC and mhaP boxes 2023-11-06 13:11:46 +00:00
microkatz
dc530289bb Changed av1c parser from a class to a method 2023-11-02 15:38:27 +00:00
microkatz
9d43cdac17 Add av1C to atom list comment in colr atom parse 2023-11-02 15:31:49 +00:00
Haixia Shi
258f45f874 Fix unit test problems with sample_with_av1c.mp4 2023-11-02 15:31:49 +00:00
microkatz
5a70bbfeec Format with google-java-format 2023-11-02 15:31:49 +00:00
Haixia Shi
834664be4f Add a unit test to Mp4ExtractorTest with a small av1 sample with color info. 2023-11-02 15:31:49 +00:00
microkatz
918079059c Format files and add release note 2023-11-02 15:31:49 +00:00
Haixia Shi
f455e843bc Address review comments on Av1BitstreamParser
* Rename method f(n) to a more helpful name.
* Move the private inner class to the bottom.
* Move public fields before private fields but below the static field.
* Make `private ParsableByteArray data` final.
* Make sure `parseSequenceHeader` can only be called once.
2023-11-02 15:31:48 +00:00
Haixia Shi
4ded7e588d Add AV1 color space parsing in MP4 atom parser
This adds av1C parsing based on the AV1 bitstream specification: https://aomediacodec.github.io/av1-spec/av1-spec.pdf

This is needed to have correct color space when using hardware AV1 decoder.
2023-11-02 15:31:48 +00:00
tonihei
d4e5ab2c4d Make BundleableUtil more generic by taking Function parameters
BundleableUtil is the only class that really depends on the type
inheritence from Bundleable. However, it only needs this as a way
to define Function<T, Bundle> and Function<Bundle, T>, which could
just be passed in as parameters as it's already done for some of
these methods.

Also rename the class to BundleCollectionUtil accordingly.

PiperOrigin-RevId: 578791946
2023-11-02 03:17:17 -07:00
ibaker
27caeb8038 Migrate CEA-608 logic to a SubtitleParser implementation
PiperOrigin-RevId: 578505919
2023-11-01 07:07:19 -07:00
jbibik
97efa70852 Add DASH support for parsing standalone TTML files during extraction
This change applies to standalone TTML files linked directly from the manifest.

As a result, we no longer have the flakiness in the DashPlaybackTest which uses sidecar-loaded (standalone file) TTML subtitles. We experimentally opt into parsing subtitles during extraction and use SubtitleExtractor in hybrid mode.

PiperOrigin-RevId: 577457256
2023-10-28 06:59:45 -07:00
Copybara-Service
009d48a75e Merge pull request #491 from v-novaltd:dsparano-exo128
PiperOrigin-RevId: 574129451
2023-10-17 06:35:19 -07:00