159 Commits

Author SHA1 Message Date
olly
9fb2902dad Exclude Guava transitive annotation dependencies
PiperOrigin-RevId: 331148067
2020-09-11 16:02:37 +01:00
olly
49699d398d Make User-Agent optional
PiperOrigin-RevId: 330593247
2020-09-09 09:45:48 +01:00
tonihei
6290d093c1 Support ExtractorFactory in DefaultMediaSourceFactory.
This allows to customize extractor flags more easily when setting up the player.

In addition, we need to provide a way to pass in the ExtractorFactory through
the constructor chain starting in SimpleExoPlayer so that removing the
DefaultExtractorsFactory is possible for R8.

PiperOrigin-RevId: 330472935
2020-09-09 09:45:42 +01:00
kim-vde
bcad98b9ff Merge pull request #7667 from willtrking:dev-v2-mkv-dovi
PiperOrigin-RevId: 328536503
2020-08-26 16:40:35 +01:00
kimvde
6960dde8a8 Add nullness annotations to FragmentedMp4Extractor
PiperOrigin-RevId: 327797428
2020-08-26 16:39:07 +01:00
William King
b7739283e0 add back removed tests 2020-08-18 21:25:48 -07:00
William King
081c5900bf add mkv samples 2020-08-18 21:21:11 -07:00
aquilescanta
4cd8f00d72 Avoid setting a PMT reader if one exists for the same PID
This change should only affect HLS, where we don't remove the
PAT reader after reading a PAT.

Issue: #7756
PiperOrigin-RevId: 327008936
2020-08-17 16:14:57 +01:00
ibaker
f0ae8afd80 Separate the dump files from the test assets
This allows us to more easily create different dumps derived from the
same assets.

This moves media/source files from `assets/` to `assets/media/` and
dump files from `assets/` to `assets/extractordumps/` and
`assets/audiosinkdumps/` as appropriate. I intend to add
`assets/playbackdumps/` in a future CL.

PiperOrigin-RevId: 326986283
2020-08-17 16:13:53 +01:00
andrewlewis
6aeacd70bc Fix miscellaneous nits
PiperOrigin-RevId: 326208366
2020-08-17 16:09:19 +01:00
olly
7f6940fb8b TS EsInfo: Be robust against a invalid descriptor length
Issue: Issue: #7722
PiperOrigin-RevId: 325431839
2020-08-07 19:04:47 +01:00
kimvde
d8a95af5e0 FragmentedMp4Extractor: simplify track bundle initialization
This will simplify the addition of nullness annotations.

PiperOrigin-RevId: 325414700
2020-08-07 19:04:18 +01:00
olly
6a54ddd217 FMP4: Correctly handle multiple sbgp and sgpd boxes
Find sbgp and sgpd boxes with grouping_type == seig in the case they don't
come first. Previoulsy we would only find them if they came first.

Issue: Issue: #7716
PiperOrigin-RevId: 325407819
2020-08-07 19:03:50 +01:00
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