400 Commits

Author SHA1 Message Date
aquilescanta
78c6b39ae8 Fix HLS media playlist only playback
This was broken by []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182206548
2018-01-23 18:53:08 +00:00
aquilescanta
0697fb3955 Fail on HLS+TS loss of sync
Issue:#3632

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182202289
2018-01-23 18:51:40 +00:00
aquilescanta
3919843db2 Force single audio and video sample queues
This solves the problem of having dense tracks' ids change.
For example, if the available variants offer both HEVC and AVC video
tracks, all video samples will map to the same sample queue even if
IDs don't match.

Issue:#3653

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182070486
2018-01-23 18:48:44 +00:00
aquilescanta
be304486e0 Fix HLS' mime type propagation
Issue:#3653

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182064250
2018-01-23 18:47:13 +00:00
tonihei
4867748c50 Add assertions to check that media sources are not prepared twice.
This lets apps fail-fast when they try to reuse media source instances.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180934445
2018-01-15 11:23:31 +00:00
olly
a5cd0b87bc Update SingleSampleMediaSource with factory/listener changes
- Convert the Builder into a Factory
- Have it use MediaSourceEventListener
- Also made some misc related fixes to other sources

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178906521
2017-12-15 11:58:48 +00:00
olly
2e3667eeff Expose ability to get adjusted seek position from MediaPeriod
Issue: #2882

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178606133
2017-12-12 19:16:34 +00:00
andrewlewis
ba32d95dc4 Make HlsMediaSource.Builder a factory for HlsMediaSources
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178384204
2017-12-12 19:11:08 +00:00
aquilescanta
586e657bd7 Allow opt-in HLS chunkless preparation
If allowed, the media period will try to finish preparation without downloading
chunks (similar to what DashMediaPeriod does). To create track groups,
HlsMediaPeriod will try to obtain as much information as possible from the
master playlist. If any vital information is missing for specific urls,
traditional preparation will take place instead.

This version does not support tracks with DrmInitData info. This affects tracks
with CDM DRM (e.g: Widevine, Clearkey, etc). AES_128 encryption is not affected.
This information needs to be obtained from media playlists, and this version
only takes the master playlist into account for preparation.

Issue:#3149

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178098759
2017-12-12 18:51:51 +00:00
hoangtc
88dea59cd2 Add ability for media period to discard buffered media at the back of the queue
In some occasions, we may want to discard a part of the buffered media to
improve playback quality. This CL adds this functionality by allowing the
loading media period to re-evaluate its buffer periodically (every 2s) and discard
chunks as it needs.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177958910
2017-12-12 18:43:26 +00:00
aquilescanta
6606d73b29 Unset sample queue index in HlsSampleStream#unbindSampleQueue
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177950960
2017-12-12 18:42:07 +00:00
aquilescanta
f0e9dbf148 Fix HLS (broken on []
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177922948
2017-12-12 18:34:48 +00:00
amesbah
b3ebdaaed3 Add @SuppressWarnings("ComparableType") for instances of a class implementing 'Comparable<T>' where T is not compatible with the type of the class.
In order to facilitate enabling a compile-time error check, we are suppressing these existing instances. Once the compile-time error is enabled, we will file bugs to clean up any unfixed instances in [].

Note that this CL should result in no effective changes to the code, but the code as currently-written might contain a real bug. If you'd prefer to fix the bug now, please either reply with edits, or accept this CL then follow up with a change that fixes the underlying issue.

Tested:
    tap_presubmit: []    Some tests failed; test failures are believed to be unrelated to this CL

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177836122
2017-12-12 18:31:43 +00:00
aquilescanta
002df729a5 Allow late HLS sample queue building
Issue:#3149

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177836048
2017-12-12 18:30:00 +00:00
andrewlewis
fd938fb454 Update internal usages of deprecated AdaptiveMediaSourceEventListener
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177786580
2017-12-04 17:38:11 +00:00
aquilescanta
23cc102151 Move internal HlsSampleStreamWrapper methods under internal methods
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177462449
2017-12-04 17:38:11 +00:00
aquilescanta
ce8736c71a Avoid concurrent read/write access to sampleQueues in HlsSampleStreamWrapper
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177435977
2017-12-04 17:38:11 +00:00
aquilescanta
69f8b250d5 Match SequenceableLoader method order in HlsSampleStreamWrapper
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177146923
2017-12-04 17:38:11 +00:00
olly
d84398788a Update moe equivalence
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177063576
2017-12-04 17:38:10 +00:00
olly
a0f6bba842 Force wrapping of HLS ID3 timestamp
Merge of https://github.com/google/ExoPlayer/pull/3495

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=177057183
2017-11-27 21:29:14 +00:00
simophin
77d8c13621
Guard against out-of-range timestamp
We've found that in our production environment, the AAC stream's timestamp exceeds the 33bit limit from time to time, when it happens, `peekId3PrivTimestamp` returns a value that is greater than `TimestampAdjuster.MAX_PTS_PLUS_ONE`, which causes a overflow in `TimestampAdjuster.adjustTsTimestamp` (overflow inside `ptsToUs`) after playing for a while . When the overflow happens, the start time of the stream becomes negative and the playback simply stucks at buffering forever.

I fully understand that the 33bit is a spec requirement, thus I asked our stream provider to correct this mistake. But in the mean time, I'd also like ExoPlayer to handle this situation more error tolerance, as in other platforms (iOS, browsers) we see more tolerance behavior.
2017-11-24 17:27:35 +13:00
olly
2537e883d6 Move HlsSampleStreamWrapper to use ArrayList
Also prevent skip when there's a pending reset, and add a
TODO to split/fix chunk discard and downstream format change
reporting.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176760955
2017-11-23 15:13:51 +00:00
olly
c06fe73b66 Bump target API level to 27
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176366693
2017-11-21 13:03:28 +00:00
hoangtc
0de57cbfae Allow more flexible loading strategy when loading multiple sub streams.
Currently for a DASH ChunkSource that consists of multiple sub-streams, we
always use a CompositeSequenceableLoader, which only allows the furthest behind
loader or any loader that are behind current playback position to continue
loading.
This changes allow clients to have more flexibility when deciding the loading
strategy:
- They can construct a different kind of composite SequenceableLoader from
the sub-loaders, and use it by injecting a different CompositeSequeableLoaderFactory accordingly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176363870
2017-11-21 12:59:11 +00:00
olly
bd0bc03f64 Inject toKeyframe discard parameter from ExoPlayerImplInternal
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175805139
2017-11-17 18:45:51 +00:00
hoangtc
28df0e133b Add Builder pattern to HlsMediaSource.
Add Builder pattern to HlsMediaSource and mark existing constructors as
deprecated.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175803853
2017-11-17 18:44:28 +00:00
aquilescanta
b17ae80679 Fix cenc mode support and add support for the .mp4a extension.
Also add encrypted HLS internal sample streams.

Issue:#1661

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175577648
2017-11-17 18:26:41 +00:00
olly
afe6f667b2 Move all buffer discard to MediaPeriod.discardBuffer
This is a step toward retaining a back-buffer in a way that
works for all MediaSource implementations. It's not possible
to adjust the discardBuffer calls in ExoPlayerImplInternal
to discard up to (position - backBufferDurationUs). Next steps
are to:

1. Find an appropriate place to specify the back buffer value,
   to be passed to the discardBuffer calls. I guess the
   LoadControl is the appropriate place to define such values.
2. Enhance discardBuffer to support a toKeyframe argument to
   pass through to discardTo.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=175565363
2017-11-13 20:07:25 +00:00
aquilescanta
15543f13b7 Decouple TrackGroups from SampleQueues in HlsSampleStreamWrapper
This CL does not aim to introduce any functionality changes.

Issue:#3149

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174864875
2017-11-13 15:01:55 +00:00
aquilescanta
98301467dc Fix DefaultHlsExtractorFactory javadoc
Issue:#2748

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174854541
2017-11-13 15:00:32 +00:00
aquilescanta
4630fa2b4c Propagate codec information from EXT-X-STREAM-INF to EXT-X-MEDIA
This is the first CL in a series to add chunkless preparation support.

Also did a bit a tidying up in HlsSampleStreamWrappen and
HlsMasterPlaylistParserTest.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174461737
2017-11-03 16:11:11 +00:00
aquilescanta
6ec53f4717 Add support for 608/708 captions in HLS+fMP4
This also allows exposing multiple CC channels to any fMP4 extractor client.

Issue:#1661

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174458725
2017-11-03 16:08:20 +00:00
aquilescanta
4cb2be2a46 Replace Queue with ArrayDequeue in HlsPlaylistParser
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174327876
2017-11-02 16:33:46 +00:00
olly
3c201a0491 Pass MediaSource instance through onSourceInfoRefreshed
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173382423
2017-10-27 16:13:59 +01:00
olly
d09f872179 Fix positions passed to TrackSelection
- When transitioning to a new period, the value of bufferedDurationUs
  passed to TrackSelection.updateSelectedTrack was incorrectly set to
  0. It should have been set to correctly reflect buffered media in
  previous periods still being played out.
- This change fixes the issue described above, and also propagates the
  playback position through to this method. The position of the next
  load within the period can be calculated by adding the position and
  bufferedDurationUs.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172736101
2017-10-19 16:48:39 +01:00
aquilescanta
2cfc478c3e Allow extractor injection for HLS
Issue:#2748

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172726367
2017-10-19 16:47:04 +01:00
Oliver Woodman
12513e9898 Tweak recently merged pull requests 2017-10-13 20:40:08 +01:00
Nate Roy
9783fc0924 remove reordering playlist parser 2017-10-06 14:35:18 -04:00
Nate Roy
2f622b8bd8 Allow passing of HlsPlaylistParser to HlsMediaSource.
Also create helper method in HlsMasterPlaylist to allow the copying of
the playlist to another, but with the variants reordered based on a
passed comparator. Also added an implementation of HlsPlaylistParser
which will reorder the variants returned.
2017-10-06 14:31:46 -04:00
olly
a3be937650 Prevent unnecessary consecutive playlist loads
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170078933
2017-09-26 19:19:57 +01:00
Oliver Woodman
792f046c02 Clean up HlsPlaylistTracker 2017-09-26 17:06:36 +01:00
ojw28
8ee6da1fe9 Merge pull request #3280 from yqritc/fix-primary-playlist-update
Fix primary hls playlist update
2017-09-26 16:54:47 +01:00
hoangtc
324339b88f Tweak live-streaming track selection logic.
Follow-up on the update to ABR logic in AdaptiveTrackSelection for live
streaming case:
- Do not reset liveEdgeTimeUs when user seek to a different position.
- For HlsChunkSource, for non-independent segments, currently the
bufferedDuration calculate will subtract previousChunk's duration. So to make
it work with live-streaming ABR logic, we subtract timeToLiveEdgeUs a similar
amount to compensate for that operation.
- Minor update to DefaultSSChunkSource, only perform TrackSelection when needed
(after checking necessary conditions).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169531275
2017-09-26 13:48:23 +01:00
yqritc
455f9fb9f0 remove space 2017-09-21 16:01:32 +09:00
yqritc
cac16f1647 remove keep alive check for updating primary url to avoid redundant playlist loading 2017-09-21 14:18:59 +09:00
yqritc
ff2ece56dd fix primarySnapshotAccessAgeMs 2017-09-21 12:01:25 +09:00
aquilescanta
6314a0ec82 Add support for Widevine encrypted HLS
This includes both cbcs and cenc. Will only work for streams that require a single
pssh.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169382884
2017-09-20 19:28:02 +01:00
aquilescanta
fed2a1a6ea Fix PTS wraparound in HLS+Webvtt
Issue:#2928

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169246424
2017-09-19 18:17:43 +01:00
hoangtc
5019da3e7b Update ABR logic in AdaptiveTrackSelection for live streaming case
In live streaming, if the playback position is very close to live edge,
the buffered duration will never reach minDurationForQualityIncreaseMs,
which prevents switching from ever happening. So we will provide the
durationToLiveEdgeUs to AdaptiveTrackSelection in live streaming case,
so it can handle this edge case.

GitHub: #3017

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168535969
2017-09-15 23:33:10 +01:00
olly
6bd0ba887c Allow more aggressive switching for HLS with independent segments
We currently switch without downloading overlapping segments, but
we do not actually switch more aggressively. This change fixes
this. Note there's an implicit assumption made that if one media
playlist declares independent segments, the others will too. This
is almost certainly true in practice, and if it's not the penalty
isn't too bad (the player may try and switch to a higher quality
variant one segment's worth of buffer too soon).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167120992
2017-08-31 16:33:43 +01:00