297 Commits

Author SHA1 Message Date
olly
b9612bc338 Fix codec initialization data for Opus in MP4
PiperOrigin-RevId: 325327466
2020-08-07 19:03:40 +01:00
kimvde
38dd1bb74f FragmentedMp4Extractor: simplify extra tracks logic
This will simplify the addition of nullness annotations.

PiperOrigin-RevId: 325221749
2020-08-07 19:03:02 +01:00
kimvde
f29af879c0 FragmentedMp4Extractor: allow both first_sample_flags and sample_flags
Having both in the trun box is not allowed (see section section 8.8.8.1
of ISO/IEC 14496-12:2015) but this CL makes the code more robust in case
this happens. Before this change, the first sample flag was not read,
making subsequent reads incorrect.

Issue: #7698
PiperOrigin-RevId: 325212160
2020-08-07 19:02:33 +01:00
olly
5169652575 Fix MP4 sniffing for very short files
The sniffer sniffs boxes at the start of the file to try and determine
whether the file is fragmented. However, if the file is extremely short
then it's possible that sniffing will try and read beyond the end of
the file, resulting i EOFException being thrown.

In general it's OK for sniffing to throw EOFException if the file is
not of the correct type. The problem in this case is that EOFException
can be thrown for an actual MP4 file, due to the sniffer continuing up
sniff atoms up to bytesToSearch in case the file is fragmented.

PiperOrigin-RevId: 325205389
2020-08-07 19:02:23 +01:00
olly
5de56cd618 Opus: Add utility for handling header and initialization data
PiperOrigin-RevId: 325202386
2020-08-07 19:02:14 +01:00
olly
42a7083b5c FragmentedMp4Extractor: Fix clearHeaderSize handling
PiperOrigin-RevId: 324560994
2020-08-07 18:58:21 +01:00
William King
fa81e1690f Lower mp4 filesize 2020-08-06 20:54:58 -07:00
William King
88f6bd6fad address comments 2020-08-06 20:33:01 -07:00
aquilescanta
6d0696a3c8 Stop auto-generating a CEA-608 track for standalone TS
PiperOrigin-RevId: 323811839
2020-08-01 12:55:54 +01:00
William King
c01a6de1b5 Add mp4 DoVi tests 2020-07-30 21:53:57 -07:00
olly
7edc4b1f1e FLV: Ignore invalid SCRIPTDATA name type, rather than fail playback
Issue: #7675
PiperOrigin-RevId: 323371286
2020-07-28 00:00:10 +01:00
ibaker
fda3b3d8ec Use static imports for methods that make sense without their class name
PiperOrigin-RevId: 323349585
2020-07-27 23:59:52 +01:00
ibaker
7083dbf7b4 Remove zero-args ParsableByteArray#reset() method
It's potentially confusing that this resets both position & limit, so
require callers to pass `limit` explicitly, or call setPosition(0)
if that's actually what they intended.

This makes enforcing the limit in an upcoming change slightly safer.

PiperOrigin-RevId: 323340485
2020-07-27 23:59:43 +01:00
ibaker
ce2e6e2fd6 Hide ParsableByteArray#data behind a getter
This allows us to enforce the limit because the array can only be
reassigned through reset(byte[]) or reset(byte[], int) (which update
the limit)

PiperOrigin-RevId: 323339960
2020-07-27 23:59:34 +01:00
olly
5fa7b879a2 Increase MP3 sniff bytes
MP3 is last in the sniffing order now, so I think it's fine to do this
without worrying about impacting on other file types.

PiperOrigin-RevId: 322996771
2020-07-27 23:58:58 +01:00
olly
6d92eebe51 Revert Format back to only containing audio encoding for PCM
PiperOrigin-RevId: 322683545
2020-07-24 10:46:37 +01:00
ibaker
4fbd09693a Fix nullness error in Mp4Extractor
This only manifests when turning ParsableByteArray#data into a getData()
method but I'm fixing it beforehand to avoid introducing changes into a
big refactoring change.

#exofixit

PiperOrigin-RevId: 322342497
2020-07-24 10:43:35 +01:00
ibaker
7ed729b175 Fix warning about int overflowing before being assigned to long
#exofixit

PiperOrigin-RevId: 322322340
2020-07-24 10:42:57 +01:00
kimvde
34ed79e6d9 Remove nullness warnings in extractors
#exofixit

PiperOrigin-RevId: 322311309
2020-07-24 10:42:21 +01:00
kimvde
8dd564c9a8 Remove Mp4Extractor from nullness exclusion list
PiperOrigin-RevId: 322310474
2020-07-24 10:42:12 +01:00
kimvde
ee222f7027 Remove AtomParsers from extractors nullness exclusion list
PiperOrigin-RevId: 322131697
2020-07-24 10:40:06 +01:00
kimvde
d615a3a740 Fix sample time of partially fragmented MP4s with tfdt box
PiperOrigin-RevId: 321109232
2020-07-24 10:31:12 +01:00
William King
3799cb3485 fix tab 2 2020-07-23 18:13:41 -07:00
William King
05f10cc7ed fix tab 2020-07-23 18:13:16 -07:00
William King
aedf538aa8 MKV Dolby Vision Support 2020-07-23 17:57:33 -07:00
kimvde
92437f3a0f Remove some occurrences of dummy
Remove occurrences in comments and private fields.

ISSUE: #7565
PiperOrigin-RevId: 320948364
2020-07-13 17:00:21 +01:00
kimvde
efce10c873 Simplify FragmentedMp4Extractor sample time logic
PiperOrigin-RevId: 320574671
2020-07-13 14:03:10 +01:00
andrewlewis
1e2ed51f25 Add support for H.263 and MPEG-4 Part 2 in TS
The new reader is named H263Reader as it handles H.263 streams, but
MPEG-4 Part 2 streams are also intended to be handled. The reader's
output format MIME type is video/mp4v as the H.263 streams can be
decoded by decoders supporting this MIME type.

The implementation is based on the framework implementation for
extracting MPEG-4 video in MPEG-TS
(https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/libstagefright/mpeg2ts/ESQueue.cpp;l=1825;drc=86e363c1fac27302ca4ae33e73296f7797672995)
and is similar to the existing H262Reader.

Issue: #1603
Issue: #5107
PiperOrigin-RevId: 320565337
2020-07-13 14:02:34 +01:00
kimvde
c29fc94540 Fix saiz and senc sample count checks for FMP4
Issue: #7592
PiperOrigin-RevId: 320556981
2020-07-10 09:09:39 +01:00
olly
9b652ac14b Fix TrackSampleTable.durationUs to be 0 for sideloaded tracks
PiperOrigin-RevId: 320006659
2020-07-08 13:55:55 +01:00
kimvde
c06fa144e1 Remove some sanity occurrences in Java files
Remove occurrences in comments and private fields.

ISSUE: #7565
PiperOrigin-RevId: 319828820
2020-07-08 13:54:51 +01:00
kimvde
3612874d19 Miscellaneous fixes to FragmentedMp4Extractor
ISSUE: #7308
PiperOrigin-RevId: 319747742
2020-07-06 16:46:58 +01:00
kimvde
64a24e08fe Add compatible brands to MP4 sniffer
Issue: #7584
PiperOrigin-RevId: 319744023
2020-07-06 16:46:58 +01:00
kimvde
6872910d5a Add support for partially fragmented MP4s
ISSUE: #7308
PiperOrigin-RevId: 319541273
2020-07-06 16:43:26 +01:00
kimvde
ccb337f2e1 MP4: set TrackSampleTable to 0 when there are no samples
Because the stbl atom is mandatory, there is no reason for having a
special C.TIME_UNSET value instead of 0.

PiperOrigin-RevId: 319496999
2020-07-03 15:31:09 +01:00
kimvde
2eab6802c9 Parse stbl in FragmentedMp4Extractor
This will be necessary to support partially fragmented MP4s.

PiperOrigin-RevId: 318798726
2020-06-29 14:38:42 +01:00
kimvde
e9249c3a73 Add methods to get the current sample info in FragmentedMp4Extractor
This enhances readability, particularly as those methods will become
more complex when partially fragmented media will be supported.

PiperOrigin-RevId: 318795536
2020-06-29 13:33:26 +01:00
krocard
78825a41dc Store encodings in Format instead of just pcm encodings
Previously only pcm encoding were stored in Format,
this was an issue as for audio passthrough and offload
lots of code needs to pass complex format informations
(encoding, sample rate, channel count, gapless metadata)
but could not use Format and each function was taking
each as different parameter.

By allowing Format to contain any encoding, and not only
pcmEncoding, it allows to pass a Format everywhere in ExoPlayer
code that needs a Format.

This patch does not have any functional change. It is only an internal refactor.

PiperOrigin-RevId: 318789444
2020-06-29 13:33:09 +01:00
kimvde
8e09cf45c0 Fix bug unseekable FMP4
The seek start position was set to the first mdat but this box was
always skipped because the moof box was not read.

PiperOrigin-RevId: 318762126
2020-06-29 13:32:44 +01:00
kimvde
4227c8f19f Move MP4 getTrackSampleTables to AtomParsers
PiperOrigin-RevId: 318485946
2020-06-29 13:32:28 +01:00
kimvde
aaa7fd114e Remove redundant default parameter in Parameter annotation
PiperOrigin-RevId: 318255509
2020-06-26 11:23:19 +01:00
tonihei
4138e28d62 Move common gradle setup to a setting file.
This removes a lot of duplication from the module configuration,
avoids divergence, and makes sure that only the important differences
to the default are visible in each module file.

PiperOrigin-RevId: 318024823
2020-06-26 11:13:25 +01:00
samrobinson
836babd5d6 Replace usages of Charset.forName with Guava Charsets.
PiperOrigin-RevId: 317672619
2020-06-23 11:07:43 +01:00
tonihei
1836f1df36 Update Checkerframework.
The compat dependency is no longer maintained and we need to keep
it at its old version.

PiperOrigin-RevId: 317658349
2020-06-23 11:07:34 +01:00
olly
f8843441a2 Align flags between the core and extension FLAC extractors
- It seems conceptually simpler for DefaultExtractorsFactory
- It seems unlikely we'll need to diverge the two. In the case of
  workaround flags we can just have them be no-ops in the version
  that doesn't need them.

PiperOrigin-RevId: 317151955
2020-06-23 11:05:37 +01:00
olly
e6b6a86a77 Remove support for MKV invisible flag
We haven't seen it used anywhere in practice. It's a niche feature not
supported by any other extractors, and is one of the very few things
stopping us from simplifying MediaSource implementations to not set the
decodeOnly sample flag. This is a simplification that we want to make,
since the current mechanism doesn't work properly for cases where a
downstream decoder adjusts the buffer presentation timestamps so that
they're different on the output side than on the input side.

PiperOrigin-RevId: 316712302
2020-06-17 14:31:27 +01:00
kimvde
88b36abce6 Sniff all inferred extractors in DefaultHlsExtractorFactory
PiperOrigin-RevId: 315857270
2020-06-11 10:11:40 +01:00
kimvde
1f17756ad2 Optimize DefaultExtractorsFactory order using MIME types
PiperOrigin-RevId: 315485985
2020-06-11 10:10:00 +01:00
kimvde
b1e56304a1 Add support for inferring file format from MIME type
PiperOrigin-RevId: 315283926
2020-06-08 17:41:16 +01:00
kimvde
12a9351781 Miscellaneous renamings in FilenameUtils
PiperOrigin-RevId: 314723830
2020-06-05 13:05:20 +01:00