603 Commits

Author SHA1 Message Date
tonihei
c529a0b9c7 Rollback of 31430f1ac5
*** Original commit ***

Suppress warnings in preparation for Checker Framework 3.7.1 upgrade.

***

PiperOrigin-RevId: 343100646
2020-11-18 18:40:37 +00:00
tonihei
f13ffb4390 Rollback of 5d9c2d7b6a
*** Original commit ***

Suppress warnings in preparation for Checker Framework 3.7.1 upgrade.

***

PiperOrigin-RevId: 343086403
2020-11-18 18:40:30 +00:00
aquilescanta
79e8295cd2 Fix HLS format derivation in traditional preparation
ExoPlayer's traditional HLS preparation works by loading a chunk from each track
group, and then tries to use the sample information plus the master playlist
information to generate the preparation's resulting TrackGroups.

There are 3 possible scenarios:
- Supported case: Each variant has a single codec string per track type. We can
  assign each track the codec string which matches the loaded sample's type.
- Supported case: Each variant has more than one codec string, but each track
  group has a single track. This is the case when different languages use
  different codecs. In this case, we can assign whichever codec matches the
  loaded sample's mime type.
- Unsupported case: Each variant has more than one codec string, and track
  groups contain more than one track. We are not able to safely map tracks to
  codec strings because that would require loading a chunk from each track
  (which would considerably delay preparation).

Broken in:
4783c329cc

PiperOrigin-RevId: 343072201
2020-11-18 18:40:21 +00:00
olly
3c91ba14b3 Suppress warnings in preparation for Checker Framework 3.7.1 upgrade.
PiperOrigin-RevId: 343003559
2020-11-18 18:40:17 +00:00
olly
0abdfe94a6 Suppress warnings in preparation for Checker Framework 3.7.1 upgrade.
PiperOrigin-RevId: 342952746
2020-11-18 18:39:55 +00:00
kimvde
e4d693ebb9 Add comment explaining DefaultHlsExtractorFactory fallback behaviour
Issue:#8219
PiperOrigin-RevId: 342843964
2020-11-17 13:50:54 +00:00
olly
0a778ceb1c HLS playlist tracking cleanup
Make the public loadPlaylist method not take an argument again.

PiperOrigin-RevId: 342646259
2020-11-17 13:50:25 +00:00
tonihei
1984779fa1 Discard buffer synchronously after seek before cancelling a load.
This ensures the buffer is not full when the `DefaultLoadControl` determines
whether we should continue loading and thus prevents a false warning about
not having enough memory left.

PiperOrigin-RevId: 342616623
2020-11-16 16:50:35 +00:00
bachinger
e3c725aa38 Create chunks from parts in HlsChunkSource
Issue: #5011
PiperOrigin-RevId: 342022947
2020-11-13 14:54:41 +00:00
mdobrzyn71
4b1b924cf1 Fix for Apple's I-Frame-only stream playback.
See bug: https://github.com/google/ExoPlayer/issues/7512
2020-11-12 14:42:11 -08:00
ibaker
1e776a864b Fix some typos
PiperOrigin-RevId: 341573964
2020-11-11 09:50:30 +00:00
bachinger
7f49b33fea Block HLS playlist requests at part level
Issue: #5011
PiperOrigin-RevId: 340625816
2020-11-06 16:33:15 +00:00
bachinger
4332dc2304 Parse HLS #EXT-X-RENDITION-REPORT tag
Issue: #5011
PiperOrigin-RevId: 340621758
2020-11-06 16:33:06 +00:00
bachinger
c04dd8b328 Use blocking HLS media playlist reload for segments
Issue: #5011
PiperOrigin-RevId: 340477795
2020-11-06 16:32:40 +00:00
christosts
42a2b9230a HLS: populate targetLiveOffset in MediaItem from server control
Issue: #5011
PiperOrigin-RevId: 340260636
2020-11-02 23:01:57 +00:00
bachinger
0d6ec21b30 Parse #EXT-X-PRELOAD-HINT tag
Issue: #5011
PiperOrigin-RevId: 339738292
2020-11-02 22:59:52 +00:00
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