637 Commits

Author SHA1 Message Date
olly
a5c47243f4 HLS: Fix incorrect handling of byte ranges for EXT-X-MAP tags
Issue: #8783
#minor-release
PiperOrigin-RevId: 366265419
2021-04-06 16:13:52 +01:00
olly
1f54776024 HLS: Set initial SampleQueue start times
This ensures BUFFER_FLAG_DECODE_ONLY is set on samples that are
before the playback start position, in the case that the queue
is created after the start position is set.

#minor-release

PiperOrigin-RevId: 366249188
2021-04-01 16:07:07 +01:00
Justin Wong
b3c8ffeb50 Use #EXT-X-START PRECISE attribute 2021-03-29 00:48:10 +08:00
Justin Wong
1fe7fbc4cd Use most recent part for start position 2021-03-28 23:59:00 +08:00
Justin Wong
a3d6f03ff9 Use playlist start time for target live offset 2021-03-28 20:25:44 +08:00
aquilescanta
8337991be3 Avoid invalid extractors in DefaultHlsExtractorFactory
This change fixes playback of playlists where segments have the
extension and Content-Type of JPEG pictures (although in reality)
they are transport streams. File inferrence before this change will
cause an exception when assuming the inferred file type is one of
the allowed HLS containers.

#minor-release
Issue: #8733
PiperOrigin-RevId: 363641277
2021-03-24 18:04:17 +00:00
olly
2d9177b7c2 SampleStream/SampleQueue: Introduce read flags
- SampleQueue.peek is replaced with SampleQueue.read with
  FLAG_PEEK. This also exposes peek functionality through
  SampleStream.
- Use of DecoderInputBuffer.isFlagsOnly is replaced with
  FLAG_OMIT_SAMPLE_DATA. This flag can be used with or
  without FLAG_PEEK, where-as previously the read position
  would never be advanced for an isFlagsOnly buffer.
- formatRequired is replaced with FLAG_FORMAT_REQUIRED.

PiperOrigin-RevId: 363460105
2021-03-24 18:03:28 +00:00
olly
6f8a8fbc1c HLS: Allow audio variants to initialize the timestamp adjuster
This makes HLS playback less liable to become stuck if discontinuity
tags are inserted at different times across media playlists.

Issue: #8700
Issue: #8372
PiperOrigin-RevId: 362903428
2021-03-15 19:14:52 +00:00
aquilescanta
c8c51452cd Fallback to inferred file types when sniffing fails
If none of the extractors successfully sniff the content then we will fall back
to inferred file types in the following order:
- Webvtt if the media comes from a SUBTITLE EXT-X-MEDIA.
- The type of media declared in the HTTP "Content-Type" header.
- The type of the media according to the file extension.
- Transport stream.

Issue: #8700
PiperOrigin-RevId: 362519769
2021-03-15 19:14:06 +00:00
olly
2a22b347c4 Suppress SwitchIntDef warning where it makes sense
In both cases it's deliberate that all excluded constants should use
the default branch. Furthermore, there are quite a lot of excluded
constants missing, so it's probably better to suppress the warning
than to include them all.

#minor-release

PiperOrigin-RevId: 355426749
2021-02-04 00:24:04 +00:00
krocard
ec43735054 Split mutations method out of TrackSelection
`TrackSelection` had mutation methods which were to be called only
internally by ExoPlayer components but were exposed in the
public `Player` interface.

The mutation methods have been moved out of `TrackSelection`
to a new class `ExoTrackSelection`.

Current track related read-only method have also been moved out,
because they are actually something quite unclear.
Even for a single item playlist, it's the track being buffered rather
than the track being played, which is unclear.
But when you have a playlist it starts to get really confusing,
because if the next item is being buffered, then it's actually
the last track to be buffered in the currently playing item.
As a final aside, the implementations don't do proper thread synchronization
to ensure visibility of updated state by the calling thread.

Exposing those mutable methods in the public `Player` interface
was problematic because they leaking internal concepts of `ExoPlayer`.
This is also required to minimize the `Player` interface for long term
stability.

`ExoTrackSelection` is a subclass of `TrackSelection`.
This is not ideal as an `TrackSelection` implementation could
break the current immutability.
This was done in order for this refactor to be simpler.
A future patch will fully split the two classes.

All `MediaPeriod` and `Sources` had to be updated to use the new
`TrackSelection` dynamic aspect class name.
An alternative would have been to break ExoPlayer's public API, keeping
`TrackSelection` as the dynamic aspect name, and calling the public static
aspect class `TrackSelectionState` or similar.
Nevertheless, while it would have impacted less files, it would have
many more small apps and casual users of ExoPlayer.

#player-to-common

PiperOrigin-RevId: 353637924
2021-01-25 15:37:38 +00:00
ibaker
5b9fa7d7d9 Add MediaSourceFactory#setDrmSessionManagerProvider()
Deprecate other DRM config methods.

Issue: #8466
PiperOrigin-RevId: 353251452
2021-01-22 16:58:56 +00:00
ibaker
b2a42ea157 Rename MediaSourceDrmHelper to DefaultDrmSessionManagerProvider
Also move it to the `drm` package, and extract a
`DrmSessionManagerProvider` interface.

I'll add `MediaSourceFactory.setDrmSessionProvider()` in a follow-up
change.

Issue: #8466
PiperOrigin-RevId: 352582559
2021-01-19 19:24:06 +00:00
christosts
d4a84b88b5 Remove deprecated method setMinLoadableRetryCount().
Remove setMinLoadableRetryCount() from SingleSampleMediaSource,
DashMediaSource, HlsMediaSource and SsMediaSource factories.

PiperOrigin-RevId: 352008657
2021-01-17 21:51:13 +00:00
bachinger
6e8af81ddc Reload HLS media playlist when merging delta update fails
Issue: #5011
PiperOrigin-RevId: 350550204
2021-01-08 15:31:54 +00:00
bachinger
b05fa731d8 Propagate segment properties when merging HLS delta updates
Issue: #5011
PiperOrigin-RevId: 350540152
2021-01-08 15:31:22 +00:00
olly
d01093d711 Rollback of dd7b379dc0
*** Original commit ***

DataSource.open() throws if already opened.

Update DataSource implementations to throw an error if open() is called
when the DataSource is already open.

***

PiperOrigin-RevId: 348783425
2020-12-23 22:53:24 +00:00
christosts
dd7b379dc0 DataSource.open() throws if already opened.
Update DataSource implementations to throw an error if open() is called
when the DataSource is already open.

PiperOrigin-RevId: 348609860
2020-12-23 22:52:21 +00:00
tonihei
cf0a4e528e Disable delta updates until merging bug is fixed.
The delta updates loose information about previous init segments.
Until this is properly fixed, we can avoid the problem by not
using delta updates.

Issue: #5011
PiperOrigin-RevId: 348023895
2020-12-23 22:50:51 +00:00
tonihei
490519a49a Update HLS window duration with trailing parts.
If we have trailing parts the available window should reach to
the end of all trailing parts and not only to the last finished
segment.

Issue: #5011
PiperOrigin-RevId: 347996626
2020-12-23 22:48:38 +00:00
christosts
8da4eaa377 HlsPlaylistParser: ignore subtitles without URI
Issue: #8323
PiperOrigin-RevId: 347827615
2020-12-17 11:25:54 +00:00
bachinger
05c928f96d Add live configuration to Timeline.Window
Issue: #5011
PiperOrigin-RevId: 346828103
2020-12-14 10:17:23 +00:00
bachinger
734565a83c Use parts when choosing next chunk after track change
Issue: #5011
PiperOrigin-RevId: 346080748
2020-12-14 10:15:05 +00:00
bachinger
3b7aa1d5f1 Use HLS rendition report when changing primary playlist
Issue: #5011
PiperOrigin-RevId: 345440697
2020-12-03 17:12:41 +00:00
bachinger
4907c2153b Add FLAG_MIGHT_NOT_USE_FULL_NETWORK_SPEED to HLS preload media chunks
Issue: #5011
PiperOrigin-RevId: 345425048
2020-12-03 17:12:04 +00:00
bachinger
affdff65e3 Remove HLS chunks based on parts not in playlist anymore
Issue: #5011
PiperOrigin-RevId: 345275266
2020-12-03 17:11:22 +00:00
Oliver Woodman
b22b53f6f1 Merge pull request #8215 from TiVo:p-fix-apple-iframe-bug
PiperOrigin-RevId: 345202157
2020-12-03 17:11:03 +00:00
bachinger
1a5d79b78a Schedule load for non-primary playlist for low latency streams
Low latency streams potentially need to remove preload chunks in case they are removed from the playlist. Hence we need to schedule loading the next playlist even if the playlist is not a primary playlist.

Issue: #5011
PiperOrigin-RevId: 344995891
2020-12-03 17:10:10 +00:00
tonihei
8349d7849e Prevent reading into preload parts.
This is to ensure we can still discard the data if needed.

Issue: #5011
PiperOrigin-RevId: 344977548
2020-12-03 17:09:44 +00:00
bachinger
e6046a5c07 Discard HLS preload chunks when an HTTP 410 or 404 occurs
This change avoids an early fatal exception for replaced hinted parts.

Issue: #5011
PiperOrigin-RevId: 344828076
2020-12-03 17:09:17 +00:00
andrewlewis
4446e2637d Fix unexpected multiline comments
#exofixit

PiperOrigin-RevId: 344517105
2020-11-30 09:32:25 +00:00
ibaker
46598a46fd Audit usages of ParsableByteArray#reset(int)
This method should be assumed to clear the data of the underlying array
(it will do this if the new limit > data.length).

This means it should only be called (directly) before writing into the
backing array.

It shouldn't be used as a shorthand for position=0, limit=x - those
should be two explicit method calls.

Most of these changes are no-ops, but they make the code more correct.

The TS SectionReader can't be easily changed to be 'safe', because it
relies on sectionData maintaining state between iterations of the while
loop. Instead I've added comments justifying the existing code.

PiperOrigin-RevId: 344515340
2020-11-30 09:31:49 +00:00
bachinger
c17d1091f3 Remove "live" from fields in MediaItem.LiveConfiguraton
#exofixit

PiperOrigin-RevId: 344065519
2020-11-27 11:05:54 +00:00
bachinger
39f8c77568 Replace cancelled HLS preload parts
Issue: #5011
PiperOrigin-RevId: 343277357
2020-11-19 17:13:19 +00:00
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