637 Commits

Author SHA1 Message Date
aquilescanta
04c56c44cf Publish components that depend on MediaParser
This change will be followed up by:
- Changes adding APIs to enable the use of MediaParser in each of the supported
  media sources.
- Changes removing TODOs related to the change of the stable SDK to API 30.

PiperOrigin-RevId: 339556777
2020-11-02 22:59:05 +00:00
bachinger
fe2acb5954 Parse HLS #EXT-X-PART tag
Issue: #5011
PiperOrigin-RevId: 339467702
2020-11-02 22:58:43 +00:00
bachinger
949e26d1ba Support delta updates for media playlists
Issue: #5011
PiperOrigin-RevId: 339093145
2020-11-02 22:56:49 +00:00
aquilescanta
a184924322 Avoid chunkless preparation if the codec mapping is ambiguous
Issue: #7877
PiperOrigin-RevId: 338659937
2020-11-02 22:55:03 +00:00
aquilescanta
4783c329cc Map HLS sample formats to the correct codec string
This change fixes format creation for traditional preparation of streams
where the master playlist contains more than one codec string per track
type.

Issue: #7877
PiperOrigin-RevId: 338538693
2020-10-23 13:54:50 +01:00
aquilescanta
ccf78f99c4 Allow multiple codecs with same type in DefaultHlsExtractorFactory
When disabling a TsExtractor track type because of a missing codec
in the master playlist, look through the entire codecs string
instead of checking the first codec with matching type.

Issue: #7877
PiperOrigin-RevId: 338530046
2020-10-23 13:54:40 +01:00
christosts
a21eb772b1 HlsMediaSourceTest: rename dashMediaItem to hlsMediaItem
Issue: #4904
PiperOrigin-RevId: 338249499
2020-10-21 22:26:25 +01:00
christosts
e52a044ec5 Parse #EXT-X-SERVER-CONTROL and #EXT-X-PART-INF in HLS media playlists.
PiperOrigin-RevId: 338232910
2020-10-21 22:26:05 +01:00
ibaker
2371b024dd Switch to an 'api' dependency on Guava
The 'implementation' dependency causes problems when resolving
ListenableFuture in contexts that also include the
com.google.guava:listenablefuture:1.0 dependency.

Issue: #7905
Issue: #7997
Issue: #7993
PiperOrigin-RevId: 337093024
2020-10-17 01:34:15 +01:00
tonihei
94b8fab25e Remove deprecated MediaSource builder methods and constructors.
All these methods have been deprecated since at least 2.9.0.

PiperOrigin-RevId: 336320219
2020-10-13 16:27:20 +01:00
aquilescanta
64d5be8719 Fix HLS chunkful preparation bug affecting certain master playlists
The bug affects playlists that start with an I-FRAME only variant.

Issue: #8025
PiperOrigin-RevId: 335819497
2020-10-13 16:26:32 +01:00
olly
cdcb30ed21 Exclude Guava transitive annotation dependencies
PiperOrigin-RevId: 331148067
2020-09-11 16:01:15 +01:00
olly
04f67e4adc Simplify DefaultMediaSourceFactory ad configuration
- Use a setter, which is consistent with how other optional
  components are passed.
- Remove nesting where a provider provides another provider.
  Since AdSupportProvider then only provides one thing, it
  can be renamed to AdsLoaderProvider, which more clearly
  expresses what it provides.

PiperOrigin-RevId: 330396334
2020-09-07 20:43:41 +01:00
olly
fd71e38db3 Fix DASH/SS/HLS module readme files
PiperOrigin-RevId: 329751934
2020-09-07 20:42:23 +01:00
bachinger
e55b345595 Make all media source factories create a drm session
PiperOrigin-RevId: 327691347
2020-08-21 12:55:14 +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
aquilescanta
fcb263a407 Make DrmSessionManager take a Format instead of DrmInitData
Skipping acquirePlaceholderSession which will be removed
in a following change.

PiperOrigin-RevId: 326402746
2020-08-17 16:11:17 +01:00
ibaker
da4d55635c Create a DumpFileAsserts from the dumpfile logic in FakeExtractorOutput
Also use it to replace the same logic in CapturingAudioSink

PiperOrigin-RevId: 325969455
2020-08-17 16:08:24 +01:00
olly
283bed8cb2 Fix ExoMediaCryptoType attachment
- Attach types for placeholder sessions. If a placeholder session will be
  attached and a downstream renderer doesn't know what to do with it, then
  this attachment is necessary to correctly determine that the renderer
  does not support the track.
- Attach types to sample formats. Without this, if playback fails due to
  a CryptoException, the ExoPlaybackException that gets thrown spuriously
  indicates that the format's DRM type was not supported.

PiperOrigin-RevId: 325214745
2020-08-07 19:02:42 +01:00
aquilescanta
8da7fc7d2f Fix chunkless preparation for playlists with dangling EXT-X-MEDIA tags
We are not able to associate a codecs attribute to an EXT-X-MEDIA tag if
there is no variant with a matching AUDIO GROUP-ID. Lack of codecs string
prevents chunkless preparation from determining the track type.

Issue: #7678
PiperOrigin-RevId: 324822415
2020-08-07 19:00:48 +01:00
aquilescanta
0670782de8 Avoid using trickplay variants for preparing an HLS stream
PiperOrigin-RevId: 324810361
2020-08-07 19:00:38 +01:00
tonihei
a6be8eeb6b Prevent extractor reuse after upstream discard.
After discarding upstream we shouldn't reuse the extractor from the
(newly) last media chunk because the extractor may have been reused
already by the discarded chunks.

Also add an assertion to SampleQueue that prevents the hard-to-detect
failure mode of overlapping sample byte ranges.

Issue: #7690
PiperOrigin-RevId: 324785093
2020-08-07 19:00:09 +01:00
christosts
f4287ed070 Add a builder for DownloadRequest
PiperOrigin-RevId: 324616617
2020-08-07 18:59:30 +01:00
tonihei
d625af67db Add load cancelation support to DASH and SS
Issue: #7244 added this feature to HLS. This change is the exact copy
in ChunkSampleStream to add the same support to the other adaptive
formats.

Note that ChunkSampleStream doesn't support slicing, so we can't cancel
a read-from chunk, and we need to prevent reading into an already
canceled chunk load so that the chunk can be automatically discarded
after the cancelation.

Issue: #2848
PiperOrigin-RevId: 324179972
2020-08-01 12:56:39 +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
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
bachinger
f81a353bf8 Remove onMediaPeriodCreated/Released/ReadingStarted
These callbacks were only necessary to track the queue in AnalyticsCollector and there is no other known benefit of having them.

PiperOrigin-RevId: 322535274
2020-07-24 10:44:48 +01:00
olly
576ef82191 Remove explicit use of Robolectric PAUSED looper mode
It's now the default everywhere, so there's no need to specify it
explicitly.

PiperOrigin-RevId: 322153319
2020-07-24 10:41:00 +01:00
olly
0cd15d9158 Proactively check listener arguments are non-null
PiperOrigin-RevId: 322143359
2020-07-24 10:40:24 +01:00
aquilescanta
ecc834d704 Make DrmSessionManager.getExoMediaCryptoType cover placeholder sessions
getExoMediaCryptoType will only return null for drmInitData == null and
track types for which placeholder sessions are not used. This change
will allow renderers to abstract themselves from format.drmInitData.

PiperOrigin-RevId: 322131219
2020-07-24 10:39:57 +01:00
christosts
b249480060 Offline: store MIME type and keySetId
Replace `type` with (optional) `mimeType` and add `keySetId` in
DownloadRequest. The DownloadHelper infers the downloading method (DASH,
HLS, SmoothStreaming or Progressive) from the content's MIME type and
URI.

PiperOrigin-RevId: 322117384
2020-07-24 10:39:30 +01:00
ibaker
ab95e3f388 Migrate usages of deprecated SimpleCache constructors
I duplicated some methods in SimpleCacheTest to ensure we keep testing
the deprecated code paths for now.

PiperOrigin-RevId: 321548802
2020-07-24 10:37:14 +01:00
ibaker
49db15ef73 Migrate usages of DownloadHelper TrackSelector constants
PiperOrigin-RevId: 321157115
2020-07-24 10:32:51 +01:00
ibaker
7b69b47a5e Migrate usages of deprecated MediaSource#getTag() method
PiperOrigin-RevId: 321156463
2020-07-24 10:32:42 +01:00
ibaker
e9482c7f0c Migrate uses of deprecated DefaultDownloadFactory constructor
PiperOrigin-RevId: 321153963
2020-07-24 10:32:15 +01:00
ibaker
e9a8335381 Migrate callers to pass MediaItem to createMediaSource()
createMediaSource(Uri) is deprecated.

PiperOrigin-RevId: 321121383
2020-07-24 10:31:22 +01:00
tonihei
29b12e2f8d Split SampleQueue.advanceTo into two operations.
The method currently advances the read position and returns the number
of skipped samples. This prevents checking how many samples are skipped
before the operation is executed.

Instead, we have a new method that returns the number of to be skipped
samples and a skip method that executes the skipping.

PiperOrigin-RevId: 320953439
2020-07-13 17:00:33 +01: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
olly
09e97cf279 Fix some Javadoc issues
PiperOrigin-RevId: 320581002
2020-07-13 14:03:19 +01:00
ibaker
fa594489d9 Completely separate MediaSource & DrmSession EventDispatchers
PiperOrigin-RevId: 319989989
2020-07-08 13:55:38 +01:00
kimvde
0ee3a35ade Rename some white/blacklist occurences in HLS library
ISSUE: #7565
PiperOrigin-RevId: 319536055
2020-07-06 16:43:16 +01:00
olly
8bd01a7bec Discard samples on the write-side of SampleQueue
PiperOrigin-RevId: 319205008
2020-07-03 09:01:46 +01:00
tonihei
2e749f70ae Don't support upstream discard from spliced-in chunks.
We can't restore the previous state of the remaining chunk, so we can't
support discarding from spliced-in chunks. Mark this explicitly instead
of attempting to discard from the previous chunk.

PiperOrigin-RevId: 318983628
2020-07-03 09:00:01 +01:00
olly
c9717f67ea Push all Downloader networking onto the executor
Issue: Issue: #6978
PiperOrigin-RevId: 318710782
2020-06-29 13:32:36 +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
aquilescanta
05f3fd8138 Add MediaParserHlsMediaChunkExtractor
Which is an HlsMediaChunkExtractor based on MediaParser.

PiperOrigin-RevId: 317886412
2020-06-26 11:13:01 +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
tonihei
c5c4c87728 Restrict some Handler to current Looper only.
They currently fall back to the main Looper if the current thread
doesn't have a Looper. All the changed Handlers are guaranteed to
be created on a thread with a Looper (mostly the ExoPlayer playback
Looper) and thus can make this stricter assumption. This makes it
easier to reason about the code as there are no ambiguities as to which
thread the Handler is running on.

PiperOrigin-RevId: 317334503
2020-06-23 11:06:31 +01:00
tonihei
7d66865d20 Rollback of 63ae4cc54b
*** Original commit ***

Rollback of 6ae472243f

*** Original commit ***

PiperOrigin-RevId: 317331407
2020-06-23 11:06:22 +01:00