4334 Commits

Author SHA1 Message Date
olly
e0711c64b8 DatabaseFileProvidingContext: Support older API levels
On older API levels it's also necessary to implement
openOrCreateDatabase, to be called by SQLiteOpenHelper.

PiperOrigin-RevId: 231387559
2019-01-29 16:45:52 +00:00
olly
45433869e5 Rename ExtractorMediaSource to ProgressiveMediaSource
It better describes what the class does. More importantly, we've had
inconsistent class names since we added offline support, for which we
added ProgressiveDownloader ("ExtractorDownloader" doesn't make any
sense). We could really do with aligning the names for clarity.

(Sorry)

PiperOrigin-RevId: 231387268
2019-01-29 16:45:42 +00:00
tonihei
ef8335fc50 Ensure normalized language code is used everywhere and update documentation.
Issue:#2867
PiperOrigin-RevId: 231385677
2019-01-29 16:45:32 +00:00
tonihei
6983f92ffd Add convenience methods to select multiple audio or text tracks for downloading.
These methods take a list of languages to be downloaded and add selections for
each of the languages.

PiperOrigin-RevId: 231385632
2019-01-29 16:45:22 +00:00
tonihei
71d77d7fa0 Remove DownloadHelper subclasses and use static methods instead.
The subclasses only call specific constructor combinations and can easily
replaced by static methods.

PiperOrigin-RevId: 231385606
2019-01-29 16:45:10 +00:00
tonihei
0a8ae74217 Update DownloadHelper to use MediaSource and MediaPeriod directly.
This requires to prepare the media source and the periods in a small helper similar
to the metadata retriever. It also gets rid of the need to have abstract protected
methods to load the manifest, to extract the track groups and to convert to stream keys,
as this can now be handled by the media period.

PiperOrigin-RevId: 231385590
2019-01-29 16:44:56 +00:00
tonihei
32b40502fc Add HlsMediaPeriod getStreamKeys implementation and tests.
PiperOrigin-RevId: 231385563
2019-01-29 16:44:46 +00:00
tonihei
6a52cd7445 Ensure HlsMediaPeriod works with playlists without variants.
Currently, we remove all variants if none of the stream keys contains any
variants. This causes HlsMediaPeriod to throw exceptions as it expects at least
one variant.

Change it to support master playlists without variants.

PiperOrigin-RevId: 231385547
2019-01-29 16:44:36 +00:00
tonihei
9779f2c358 Add DashMediaPeriod getStreamKeys implementation and test.
PiperOrigin-RevId: 231385518
2019-01-29 16:44:25 +00:00
tonihei
92bf8e918c Change getStreamKeys to take a list of TrackSelections.
Converting a single track selection to stream keys is only possible if the output
is independent from other track selections being made.

This is not the case for DASH and HLS embedded track groups which should select the
already selected primary track if possible (and thus needs to know  whether a primary
track group is selected).

Also, update the test method to take a period index.

PiperOrigin-RevId: 231385490
2019-01-29 16:44:15 +00:00
tonihei
f74e0eb992 Add back deprecated MediaSource.prepareSource for ExoPlayerSampleExtractor.
This should be removed after releasing.

PiperOrigin-RevId: 231380393
2019-01-29 16:44:04 +00:00
olly
39505452de Make VersionTable static
The way it is currently, it's very unclear that an operation on the
version table will correctly belong to a transaction in code such as
this, taken from DefaultDownloadIndex:

writableDatabase.beginTransaction();
try {
  writableDatabase.execSQL(...);
  versionTable.setVersion(...);
  writableDatabase.setTransactionSuccessful();
} finally {
  writableDatabase.endTransaction();
}

This change explicitly passes the database, to make it obvious that
the operation will really go into the same transaction:

writableDatabase.beginTransaction();
try {
  writableDatabase.execSQL(....);
  VersionTable.setVersion(writableDatabase, ...);
  writableDatabase.setTransactionSuccessful();
} finally {
  writableDatabase.endTransaction();
}

PiperOrigin-RevId: 231374933
2019-01-29 16:43:52 +00:00
eguven
bac8dfea12 Add DownloadState not met requirement stop flags
PiperOrigin-RevId: 231223201
2019-01-29 16:43:42 +00:00
olly
19144c4c73 Allow to disable libyuv dependency on LIBVPX
Goal: reduce binary size.
PiperOrigin-RevId: 231198579
2019-01-29 16:43:32 +00:00
andrewlewis
866835ea03 Fix float output capability check
Float output is only possible from API 21, but the high-res int
to float conversion path was checking for 32-bit PCM not float
output capability.

PiperOrigin-RevId: 231172495
2019-01-29 16:43:20 +00:00
olly
6b068c6ffb Clarify LoopingMediaSource documentation
PiperOrigin-RevId: 231171425
2019-01-29 16:43:11 +00:00
olly
3c6b72ee29 Fix nullness test
PiperOrigin-RevId: 230889470
2019-01-29 16:43:00 +00:00
olly
a1c13ca6f5 Hack to instantiate ExoDatabaseProvider without a context
This will allow CachedContentIndex to start using database
storage without us having to change the SimpleCache and
CachedContentIndex constructors to require a Context or a
DatabaseProvider.

PiperOrigin-RevId: 230884501
2019-01-29 16:42:50 +00:00
tonihei
582adb748a Decouple end position from MediaPeriodId again.
If are allowing changing durations of periods, we shouldn't use the end position
of clipped content as part of the id as it may change. This change moves the end
position back to MediaPeriodInfo and adds the next ad group index to the id
instead to ensure we still have unique ids for all content parts.

PiperOrigin-RevId: 230878389
2019-01-29 16:42:29 +00:00
aquilescanta
6dde1e67d3 Parse CHANNELS attribute from EXT-X-MEDIA
PiperOrigin-RevId: 230743198
2019-01-29 16:42:18 +00:00
aquilescanta
9d19a7a4b6 Move parseSelectionFlags with the rest of the parse{attribute} methods
PiperOrigin-RevId: 230734189
2019-01-29 16:42:07 +00:00
aquilescanta
642a0275d8 Propagate ExoCast errors receiver from the receiver app
PiperOrigin-RevId: 230717561
2019-01-29 16:41:55 +00:00
olly
355b3d6334 Increase minSdkVersion to 16
The combination of pre-16 API levels accounting for ~0.5% of the device
population, and that the most important components in ExoPlayer (e.g.
the MediaCodec renderers) have always required API level 16, mean it's
very unlikely this will negatively impact on anyone.

PiperOrigin-RevId: 230701808
2019-01-29 16:41:45 +00:00
olly
2c54b83464 Move CachedContentIndex storage behind an interface
This interface will get an SQLite implementation in a subsequent CL

PiperOrigin-RevId: 230693881
2019-01-29 16:41:34 +00:00
olly
f182c0c116 Centralize serialization in CachedContentIndex
We need to support serialization to/from an SQLite table. The
model of passing something around for each class to write into
doesn't work well for SQL, and it would be messy to have two
different structural designs for serialization. This change
centralizes the logic in CachedContentIndex, where a centralized
SQL based version can more easily sit alongside it.

PiperOrigin-RevId: 230692291
2019-01-29 16:41:24 +00:00
tonihei
49b9775d08 Add getReadingPositionUs to Renderer.
This method is a generalization of the existing hasReadStreamToEnd. It is
useful to determine whether a renderer already read beyond a new duration of
a period.

PiperOrigin-RevId: 230689165
2019-01-29 16:41:13 +00:00
tonihei
d7b3820175 Make updateQueuedPeriods more readable and fix bug.
1. The method kept track of the current period index to check if the next
period is still in the correct period. This is unneccessary since we no longer
use the period index but the actual uid in MediaPeriodId and mismatches are
already detected by canKeepMediaPeriodHolder.
2. We updated the MediaPeriodIndfo twice: once in getFollowingMediaPeriodInfo
and once in getUpdatedMediaPeriodInfo. That's confusing and difficult to
follow. The only difference is that getUpdatedMediaPeriodInfo keeps the
content position while getFollowingMediaPeriodInfo resets it. This is made more
explicit for readability.
3. The durations compatibility check for all following periods was broken as
it compared the same durations (partly due to the confusion caused by 2.)

PiperOrigin-RevId: 230519295
2019-01-29 16:40:51 +00:00
olly
3a54d744b9 Default to respecting the DataSpec cache fragmentation flag
Issue: #4253
PiperOrigin-RevId: 230497544
2019-01-29 16:40:41 +00:00
olly
4182f37b6e Make notification dismissible iff player is active
Seems like more useful default behaviour

PiperOrigin-RevId: 230356813
2019-01-29 16:40:20 +00:00
olly
de3a749b97 Fix scheduler NPE in DownloadService
PiperOrigin-RevId: 230260266
2019-01-29 16:40:09 +00:00
olly
29711b922d Cancel notification on dismiss
This doesn't happen automatically after all on older devices

PiperOrigin-RevId: 230251258
2019-01-29 16:39:56 +00:00
tonihei
923aa420df Use loading period event time for fatal load errors.
ExoPlaybackExceptions of type SOURCE are always associated with the loading
period and thus we can use the event time for the loading period in
onPlayerError. Renderer and unexpected exceptions are still associated with the
currently playing period.

Issue:#5407
PiperOrigin-RevId: 230216253
2019-01-21 14:10:49 +00:00
olly
c2f6dd6b0a Only allow one layer of sub-directories in the cache for now
PiperOrigin-RevId: 230209898
2019-01-21 12:58:16 +00:00
tonihei
e4eaaedad3 Add max video size workaround for Amlogic decoder.
The Amlogic awesome decoder reduces the video size of interlaced videos by half
if the internal configuration isn't force reset with new maximum input size
values. The product of these new values must exceed 1920x1088 to force the
reset.

Issue:#5003
PiperOrigin-RevId: 230206675
2019-01-21 12:58:06 +00:00
olly
fb6154a905 Wipe database on downgrade
PiperOrigin-RevId: 230203593
2019-01-21 12:57:56 +00:00
aquilescanta
93e24561bb Add DefaultTsPayloadReaderFactory flag to ignore HDMV DTS streams
Prevents collisions with SCTE-35 subtitles.

Issue:#5330
PiperOrigin-RevId: 230195494
2019-01-21 12:57:46 +00:00
olly
82da627c1a Split out shared database components for reuse in caching
PiperOrigin-RevId: 229946997
2019-01-21 12:57:35 +00:00
tonihei
02dc937c78 Fix flaky DownloadIndexUtilTest.
PiperOrigin-RevId: 229934901
2019-01-21 12:57:25 +00:00
olly
14eb561e38 Use MediaCrypto.setMediaDrmSession to avoid black flicker
Issue: #3561
PiperOrigin-RevId: 229934093
2019-01-21 12:57:04 +00:00
tonihei
23c07e5c4d Update buffer-based ABR to not select track in constructor.
This mimicks a similar change in the default AdaptiveTrackSelection.
Also adds an option to cap initial format height.

PiperOrigin-RevId: 229923149
2019-01-21 12:56:33 +00:00
tonihei
ac86d3b5f6 Add missing @Nullable to SimpleExoPlayer fields and methods.
Issue:#5402
PiperOrigin-RevId: 229758525
2019-01-17 17:26:35 +00:00
tonihei
22413b8037 Add start position to MediaSource.createPeriod.
That's the same position set in MediaPeriod.prepare (where it may be removed
in the future).

Having the position at an earlier point is necessary to fix an
issue with lazy preparation in ConcatenatingMediaSource where the prepare
position was assumed to be known but MediaPeriod.prepare hasn't been called
yet.

Issue:#5350
PiperOrigin-RevId: 229756637
2019-01-17 17:26:24 +00:00
bachinger
76baa5724c solve nullness check warnings with asserts
PiperOrigin-RevId: 229755532
2019-01-17 17:26:14 +00:00
eguven
f2139d1b71 Add DownloadIndexUtil
This class includes helper methods to upgrade ActionFiles
and custom download records to DownloadIndex.

PiperOrigin-RevId: 229744441
2019-01-17 17:26:01 +00:00
bachinger
16a185de1d make PlayerNotificationListener better suited for foreground services
Issue: #5301
Issue: #4988
Issue: #4813
Issue: #5344
Issue: #5117
PiperOrigin-RevId: 229603354
2019-01-17 14:37:23 +00:00
eguven
ec77f737ee Make DownloadManager watch requirements directly
PiperOrigin-RevId: 229544734
2019-01-17 14:37:12 +00:00
bachinger
8adc16a623 allow developers to set the subText of the notifcation
Issue: #5344
PiperOrigin-RevId: 229527963
2019-01-17 14:37:00 +00:00
tonihei
ca7675ceae Fix bug where missing switch adaptation set causes multiple identical track groups.
When the extra adaptation set of a switch group isn't defined in the manifest, we
currently assume it's the first adaptation group. This either leads to wrong grouping
or duplicate track groups.

Such a case may easily happen if the manifest is filtered such that only one of the
switch adaptation sets will be present in the manifest.

PiperOrigin-RevId: 229365379
2019-01-15 15:24:16 +00:00
tonihei
c6092bbb43 Fix typo.
PiperOrigin-RevId: 229365333
2019-01-15 15:24:03 +00:00
olly
36883e6277 Bump version for 2.9.4 release
PiperOrigin-RevId: 229364563
2019-01-15 15:03:35 +00:00