1869 Commits

Author SHA1 Message Date
andrewlewis
2169b9417f Fix HEVC level error logging
PiperOrigin-RevId: 232651944
2019-02-06 15:46:27 +00:00
olly
6b81d9e7a4 Fix DownloadHelper for some HLS streams
onContinueLoadingRequested can occur during preparation, so
MediaPreparer needs to handle it.

PiperOrigin-RevId: 232507267
2019-02-06 15:45:44 +00:00
olly
391f2bb6c2 Remove indirection in DefaultDownloadIndex
DefaultDownloadIndex is currently just forwarding all calls to its
inner class. getDownloadTable() handles initialization, but this
doesn't really seem different to having an initialization method. It
doesn't guarantee initialization happens, since a bad method
implementation could try and access downloadTable directly, just as
a bad method implementation could forget to call the initialization
method. Hence this change removes the indirection.

PiperOrigin-RevId: 232482228
2019-02-06 15:45:10 +00:00
eguven
c0e6cd1b17 Add DownloadState.mergeAction method
This method is needed by DownloadManager.

PiperOrigin-RevId: 232447145
2019-02-06 15:44:45 +00:00
olly
67be9e7783 Merge #5462: Making easier to set the playClearSampleWithoutKeys to renderers
Imported from GitHub PR https://github.com/google/ExoPlayer/pull/5462

Pull request for the following issue: #5421
Merge d9d88b079c4ca0533a836b2715a65b924babbb89 into a73819162751116acd3863cf5473b0ff78fac805

PiperOrigin-RevId: 232335113
2019-02-04 19:40:22 +00:00
tonihei
3818d7329d Use ExoPlayer's AnalyticsListener and AnalyticsCollector.
This combines all the different listeners in ExoVideosPlayerV2 into one and
moves the PlaybackLogger class towards ExoPlayer's AnalyticsCollector with
the same purpose.

In the future this allows two things:
 1. Gradually move LogginClient implementations to AnalyticsListener to
    prevent custom event forwarding.
 2. Using ExoPlayer's QoE extension (which is also an AnalyticsListener).

PiperOrigin-RevId: 232321182
2019-02-04 19:40:06 +00:00
tonihei
7a4cf96f4a Improve housekeeping of ConcatenatingMediaSource callbacks.
When calling releaseSource(), all pending messages will be removed. That means
that all action-on-completion callbacks which are somewhere in flight are
just dropped without being called. This change adds code to keep track of the
current state of each callback to allow all of them being called when the
source is released.

Issue:#5464
PiperOrigin-RevId: 232312528
2019-02-04 19:39:54 +00:00
eguven
a5d64463c7 Make DownloadTracker use DownloadIndex
DownloadTracker will stop updating DownloadIndex when DownloadManager
starts using the same DownloadIndex.

PiperOrigin-RevId: 232306803
2019-02-04 19:39:34 +00:00
olly
fb99c26426 Implement CacheContentIndex storage switching
This change enables transitioning to/from different Storage
implementations, to allow experimentally enabling (and if
necessary, disabling) SQLiteStorage. All that's left to do
is the final wiring to turn it on

PiperOrigin-RevId: 232304458
2019-02-04 19:39:24 +00:00
olly
f1ded9c3c2 Wider fix for OMX.SEC.mp3.dec issue
Issue: #4519
PiperOrigin-RevId: 232299233
2019-02-04 19:39:13 +00:00
eguven
5e311fc82a Refactor DownloadManage to simplify DownloadThread management
Now DownloadManager is responsible for starting and stopping DownloadThreads.

PiperOrigin-RevId: 232278072
2019-02-04 19:39:00 +00:00
ybai001
55ed5cfac6 Set ac4-is sync only if SDK_INT <= 28 2019-02-01 09:03:40 +08:00
aquilescanta
503c17d2ed Add constraint based track selection for ExoCast
PiperOrigin-RevId: 231764284
2019-01-31 14:06:28 +00:00
olly
d0b3d1cf63 Add additional device to output surface workaround
Issue: #4468
PiperOrigin-RevId: 231759438
2019-01-31 14:06:17 +00:00
olly
ef6725bf48 Bump version for 2.9.5 release
PiperOrigin-RevId: 231744540
2019-01-31 14:06:02 +00:00
ybai001
8f32c29cc6 Update code based on code review result
* remove field mimeType in Ac4Util.java
 * change constant CHANNEL_COUNT_2 to private in Ac4Util.java
2019-01-31 11:31:19 +08:00
aquilescanta
2bd12c2270 Move DefaultTrackSelector.Parameters out of DefaultTrackSelector
Including ParametersBuilder and TrackSelectionOverride.

PiperOrigin-RevId: 231609249
2019-01-30 20:32:08 +00:00
olly
ab67ab1aea Implement database CachedContentIndex.Storage
PiperOrigin-RevId: 231600104
2019-01-30 16:38:37 +00:00
eguven
c9b848e500 Synchronously change to next state from downloading state
PiperOrigin-RevId: 231586206
2019-01-30 16:38:26 +00:00
aquilescanta
dc7bc4785e Update ProgressiveMediaSource note
PiperOrigin-RevId: 231567138
2019-01-30 16:38:05 +00:00
olly
0dd305461d Clarity improvement: Use named variables
PiperOrigin-RevId: 231425073
2019-01-30 16:37:52 +00:00
andrewlewis
52ff1820df Fix buffered position when loading has not completed
If there is data after the last samples in the container, we may request
continue loading after the last samples have been read but before the load has
completed. In this situation the buffered position is returned as
Long.MAX_VALUE, which prevents continuing loading, yet the media period is not
treated as fully buffered because its buffered position is not
C.TIME_END_OF_SOURCE.

PiperOrigin-RevId: 231406964
2019-01-29 16:46:27 +00:00
tonihei
f4e7af3fd0 Handle duration change in updateQueuedPeriods.
We can keep the reading media period and continue playing if we haven't read
beyond the new duration. Otherwise, we can keep the period, but need to reset
the renderers as we already read too far.

PiperOrigin-RevId: 231406252
2019-01-29 16:46:16 +00:00
olly
d49e7ebae2 Fix nullness checks (pending stub to fix it properly)
PiperOrigin-RevId: 231396213
2019-01-29 16:46:04 +00:00
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
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
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
de3a749b97 Fix scheduler NPE in DownloadService
PiperOrigin-RevId: 230260266
2019-01-29 16:40:09 +00:00
ybai001
e462c6aab7 Add AC-4 format support
* Add AC-4 MIME type definition
 * Add AC-4 format support in Mp4Extractor and TsExtractor
 * Add AC-4 Extractor
 * Add AC-4 playback support in MPEG-4, MPEG-DASH, TS and HLS
2019-01-25 16:32:45 +08: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