1997 Commits

Author SHA1 Message Date
tonihei
8e7a2ba958 Don't reset masking position when prepare fails.
The removed condition only applies when prepare fails and no timeline was or
is known. We should keep a pending seek position in such a case. The internal
player does the same thing already.

PiperOrigin-RevId: 243819466
2019-04-18 15:12:07 +01:00
eguven
5856e75781 Rename DownloadAction to DownloadRequest
PiperOrigin-RevId: 243806888
2019-04-16 16:41:29 +01:00
olly
9c759a867b Prepare SimpleCache for 2.10.0 release
- Expose constructors that take DatabaseProvider. Deprecate those
  that do not.
- Expose Cache.getUid. This will likely be used for naming of the
  tables accessed by DefaultDownloadIndex .

PiperOrigin-RevId: 243637786
2019-04-16 15:28:01 +01:00
andrewlewis
45348a97a9 Fix Atom ConstantCaseForConstant suppression
PiperOrigin-RevId: 243636923
2019-04-16 15:27:41 +01:00
aquilescanta
68bd5da3cb Fix DecryptionResource.Owner#onLastReferenceReleased type
PiperOrigin-RevId: 243632134
2019-04-16 15:27:22 +01:00
olly
7b84a1ead7 DownloadManager.getCurrentDownloads: Return list instead of array
- Allows enforcing immutability, which in a future CL will allow
  avoiding allocating a new array/list on every call.
- Also some left over doc cleanup from the DownloadState rename.

PiperOrigin-RevId: 243627352
2019-04-16 15:27:03 +01:00
aquilescanta
9ddd39c1c0 Add the HlsMetadataEntry from the Master playlist to the Hls tracks
PiperOrigin-RevId: 243624081
2019-04-16 15:26:44 +01:00
eguven
ba91501751 Add DownloadService.invalidateForegroundNotification
ISSUE: #4563
PiperOrigin-RevId: 243616444
2019-04-16 15:26:05 +01:00
olly
18dd3fdb46 Bump release to 2.10.0 and update release notes
PiperOrigin-RevId: 243592790
2019-04-16 15:25:47 +01:00
tonihei
1ee51518ae Use new exoplayer.dev domain everywhere.
The old domain automatically forwards to the new one. For consistency, change
all doc and code references regardless.

Also adds GitHub CNAME config file which configures our page for the custom
domain.

PiperOrigin-RevId: 243592110
2019-04-16 15:25:27 +01:00
tonihei
75238e5e4f Remove duplications from handleSourceInfoRefreshed.
handleSourceInfoRefreshed checks for various conditions which may trigger a
change in position. In all cases, we need to resolve the new position for ads,
and if the corresponding MediaPeriods already exist, perform the seek to the new
position.

This change simplified the code by
 1. Moving all conditions in a single if-else structure which just determines
    the new playback position. This makes it easier to read and to follow.
 2. Doing the subsequent seek and position update in one final step to remove
    duplicated code.

As a side effect, it also improves some edge cases. For example when skipping
an ad to an already prebuffered period, we now properly update the existing
prebuffered period.

PiperOrigin-RevId: 243588014
2019-04-16 15:25:08 +01:00
olly
2e3eac25b7 Cleanly detach DownloadThreads on release
- Make a best effort to avoid posting MSG_DOWNLOAD_THREAD_STOPPED
  if the internal thread has already quit. Doing so is harmless,
  but causes an error in Logcat. We used to generate this warning
  quite a bit in ExoPlayerImplInternal as well, and we got quite
  a few issues filed about it, so best to avoid it if possible.
- Null out the back reference DownloadThread holds to its manager
  on release. This avoids a potential issue where a download thread
  can prevent GC of its manager if it doesn't cancel quickly.
  There's similar logic (with a similar comment) in Loader.LoadTask.

PiperOrigin-RevId: 243365143
2019-04-13 01:45:59 +01:00
olly
b2c29da6b3 Finalize DownloadManager interface
- Rename getAllDownloads to getCurrentDownloads to make it clear
  that it doesn't include completed and failed downloads
- Change getDownloadCount to isWaitingForRequirements, which is
  what it's used for. Added TODO to make it returns the right thing

PiperOrigin-RevId: 243257856
2019-04-13 01:43:02 +01:00
olly
a588717b46 Move download state transitions into DownloadManager
Non-trivial download state transitions are currently split across
DownloadManager and Download. These transitions are part of the
same state machine, so it's clearer if they're all in the same place
(i.e. DownloadManager, since this is the component that transitions
downloads between states).

PiperOrigin-RevId: 243249915
2019-04-13 01:42:22 +01:00
olly
f623a9dea0 Reduce use of DownloadInternal in DownloadManager
The only state DownloadInternal holds is duplicate of state contained
in Download, but can confusingly be temporarily out of sync. This is
error prone because it's easy to use the wrong variable (e.g.
download.state vs state). DownloadInternals methods are called into
and call out into DownloadManager, which makes some code paths that
are quite hard to follow.

It's possible to simplify DownloadManager quite a lot by removing the
duplicated state in DownloadInternal, at which point DownloadInternal's
methods flatten into DownloadManager, which can just hold an internal
list of Downloads directly.

This is a first step, which makes it clear that DownloadThready only
needs its immutable DownloadAction + an isRemove flag.

PiperOrigin-RevId: 243245288
2019-04-13 01:42:02 +01:00
aquilescanta
bd841b18f2 Add DecryptionResource to FormatHolder
PiperOrigin-RevId: 243243975
2019-04-13 01:41:42 +01:00
aquilescanta
9cfac7ea07 Rename CryptoResource to DecryptionResource
PiperOrigin-RevId: 243237265
2019-04-13 01:41:03 +01:00
andrewlewis
53934c13b2 Select non-primary tunneling decoder
Issue: #3100
Issue: #5547
PiperOrigin-RevId: 243181217
2019-04-13 01:40:43 +01:00
olly
b84c51434f Deprecate ActionFile and simplify upgrading
PiperOrigin-RevId: 243085292
2019-04-13 01:40:24 +01:00
olly
112117a1ac Reorder DownloadManager methods
Put methods into a more sensible order (the same order as
in the switch statement, which is a more natural order with
e.g. initialize coming first and release coming last).

PiperOrigin-RevId: 242891742
2019-04-13 01:40:04 +01:00
olly
9779d71a1d Fix stopping downloads
- Changed startDownloads/stopDownloads back to their previous behavior
  of starting and stopping all downloads at the manager level.
- Made setManualStopReason methods for the new case of setting a manual
  stop reason or some or all downloads.
- Added plumbing to specify an initial manual stop reason when adding a
  new download, without also overwriting the manual stop reasons of all
  other preexisting downloads. Using the value is left as a TODO pending
  a bit of further cleanup that'll make it easier.

PiperOrigin-RevId: 242891688
2019-04-13 01:39:44 +01:00
olly
30beb9b300 Add DownloadAction merge tests
PiperOrigin-RevId: 242851294
2019-04-13 01:38:45 +01:00
eguven
8688bd2d88 Rename DownloadState to Download
PiperOrigin-RevId: 242839480
2019-04-13 01:38:25 +01:00
olly
3f565c33be Simplify offline Requirements
- Remove NETWORK_TYPE_NOT_ROAMING and NETWORK_TYPE_METERED
  because JobScheduler doesn't support them, and they're
  probably not useful to many people (data when roaming is
  normally enabled/disabled at the OS level, and restricting
  to *only* metered networks seems niche)
- Convert network requirements proper flags
- Stop persisting requirements in DownloadIndex. The direction
  we're headed to solve the manager start/stop problem is
  going to involve state in DownloadManager determining whether
  downloads actually start, and if we're doing that then it's
  no worse to do it for this as well

PiperOrigin-RevId: 242713196
2019-04-13 01:37:44 +01:00
tonihei
9e6f9ee9dd Remove DataSpec self-links.
We usually avoid linking to the same page. Replacing all {@link DataSpec}
with just "data spec" accordingly.

PiperOrigin-RevId: 242689537
2019-04-13 01:37:24 +01:00
aquilescanta
9779b34885 Fix Parcelable.Creator#newArray implementations
PiperOrigin-RevId: 242686312
2019-04-13 01:37:05 +01:00
olly
d3b63a97ad Remove DownloadAction serialization
Implement Parcelable instead, which is a more intented way of
passing structured data via Intents.

PiperOrigin-RevId: 242646441
2019-04-13 01:36:46 +01:00
tonihei
14d40b0faf Fix test which is relying on wrong Robolectric behavior.
Robolectric calls messages posted to the main thread immediately inline. This
will change in the upcoming release and will break tests implicitly relying
on that behavior.

Update ConcatenatingMediaSourceTest to actually wait for the posted message.

PiperOrigin-RevId: 242631531
2019-04-13 01:36:27 +01:00
olly
18dcad9b8d Simplify DownloadState to contain its DownloadAction
This makes sense now that DownloadAction is only for downloading,
and not also for removal.

PiperOrigin-RevId: 242561575
2019-04-13 01:36:07 +01:00
olly
9a03e73b7a Remove ActionFile serialization, which is no longer used
PiperOrigin-RevId: 242465135
2019-04-13 01:35:28 +01:00
olly
e7d717b96c Sanitize naming of keys variable.
PiperOrigin-RevId: 242460786
2019-04-13 01:35:07 +01:00
olly
a0c21461aa Ensure getAllDownloadStates order is stable
HashMap.values does not guarantee a stable order, but our tests
assert that the order is stable. It's probably a nice property
that the order is the same as that in which downloads are added,
so this change makes the order stable, with that order.

A future change will likely improve the way this works, by
changing the internal thread "downloads" variable to have type
ArrayList<Download>, at which point the internal thread can just
pass a read-only copy of its list to the main thread whenever a
state changes.

PiperOrigin-RevId: 242460725
2019-04-13 01:34:47 +01:00
olly
47601980d9 Use DownloadAction.id properly
- Fix ID being dropped when DownloadAction is serialized and
  de-serialized as it's passed to DownloadService
- Properly set DownloadAction.id when building an action from
  a DownloadState
- Make ID a required constructor argument. Else it's too easy
  to not propagate it by accident.

PiperOrigin-RevId: 242457831
2019-04-13 01:34:07 +01:00
andrewlewis
401e20d9c8 Signal fallback via renderer constructor
Remove MediaCodecSelector.DEFAULT_WITH_FALLBACK, as codec selectors
will need to be able to return a list of decoder infos even when not
using fallback in a later change. Instead signal that fallback should
be used via a renderer constructor.

Fallback is always disabled for audio.

PiperOrigin-RevId: 242454172
2019-04-13 01:33:47 +01:00
tonihei
a6d52d4ae7 Update initial bitrate estimates.
PiperOrigin-RevId: 242449883
2019-04-13 01:33:08 +01:00
tonihei
2d7b9d876f Allow ContainerMediaChunks to provide their own TrackOutputProvider.
Adding a protected method for that allows to supply a customized
TrackOutputProvider to the ExtractorWrapper used by the ContainerMediaChunk
(e.g. for logging purposes).

The alternative would be to provide a  TrackOutputProvider through the
ChunkSampleStream constructor, but the extra initialization taking place
in the ChunkSampleStream constructor would need to move somewhere else and
some methods of BaseMediaChunkOutput would need to move to the
TrackOutputProvider interface. This seems too much effort for niche
customization case.

PiperOrigin-RevId: 242448776
2019-04-13 01:32:48 +01:00
olly
66e416b615 Fix bug when caching from non-zero position
The position should be subtracted from the total content length
retrieved from the cache in this case, both for iteration and for
filling out counters.contentLength (for the latter, note not
doing it this way is inconsistent with what happens when dataSpec
length is set to a known value).

PiperOrigin-RevId: 242445034
2019-04-13 01:32:28 +01:00
olly
0daaba443c Get rid of DownloadState.STATE_REMOVED
It's a transient state whose only use is when passing a removed
download to onDownloadStateChanged. It's a bit strange to have it
as a proper state, since we end up asserting that it's an invalid
value in other places.

This change adds an explicit onDownloadRemoved, which allows
removal of the transient STATE_REMOVED, related assertions, and
uncertainty when dealing with an @State variable whether it's
necessary to handle it being STATE_REMOVED.

PiperOrigin-RevId: 242444128
2019-04-13 01:32:08 +01:00
olly
925dd5aa12 Fix most remaining issues with DownloadManager threading
PiperOrigin-RevId: 242439330
2019-04-13 01:31:48 +01:00
eguven
c17c722158 Make DataIndex accessing code run on internal thread
This is the last cl of a series of cls that will convert DownloadManager
threading model as public methods post actions on an internal thread
which then do the work.

PiperOrigin-RevId: 242437229
2019-04-13 01:31:28 +01:00
tonihei
346c72c00e Move PriorityTaskManager from DefaultLoadControl to SimpleExoPlayer.
The priority task manager only needs to listen to loading state changes and
is independent of the rest of DefaultLoadControl. This also fixes problems
where the player stops loading without consultin the LoadControl.

PiperOrigin-RevId: 242098374
2019-04-05 21:14:09 +01:00
eguven
37bab0a98d Temporally make DataIndex accessing code run on main thread
This is the second cl of a series of cls that will convert DownloadManager
threading model as public methods post actions on an internal thread
which then do the work.

PiperOrigin-RevId: 241773765
2019-04-05 21:13:12 +01:00
eguven
27884c70f8 Make DownloadState counters mutable
PiperOrigin-RevId: 241763220
2019-04-05 21:12:35 +01:00
bachinger
b10f4023f0 handle meta atom as a full box when parsing mp4
Issues: #5698, #5694
PiperOrigin-RevId: 241762106
2019-04-05 21:12:16 +01:00
aquilescanta
95f65e5258 Add abstract superclass for Crypto resources
Necessary for implementing scheme-independant resource management.

Example: A media source needs to have ownership of a crypto resource
while samples are in buffer (but not yet in the renderer).
PiperOrigin-RevId: 241698575
2019-04-05 20:54:35 +01:00
eguven
8480a4b44d Add Downloader.getCounters method
PiperOrigin-RevId: 241636860
2019-04-05 20:50:59 +01:00
olly
ee7bf4b0ee Make callback Handler instantiation consistent
Most of our components that have Handler instances for calling
back to application code instantiate the Handler using Util.getLooper
in the constructor. This makes the two components that do
something else consistent with that model.

PiperOrigin-RevId: 241545575
2019-04-05 20:50:40 +01:00
olly
7c265dfb3a Detect external surround sound on Amazon devices
PiperOrigin-RevId: 241544595
2019-04-05 20:50:22 +01:00
eguven
9b064fb9d5 Use CachingCounters in SegmentDownloader
PiperOrigin-RevId: 241543543
2019-04-05 20:50:03 +01:00
eguven
d5b19694fa Add percentage field to CacheUtil.CachingCounters
PiperOrigin-RevId: 241524766
2019-04-05 20:49:44 +01:00