4457 Commits

Author SHA1 Message Date
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
aquilescanta
73acdcf1e2 Add a flag to enable the preemptive 608 track in HLS
By passing false, users can disable the preemptive 608 track.

Issue:#5736
PiperOrigin-RevId: 242476274
2019-04-13 01:35:47 +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
bachinger
8b766ba4b8 Use FLAG_UPDATE_CURRENT for PendingIntents of playback commands.
ISSUE: #5734
PiperOrigin-RevId: 242459668
2019-04-13 01:34:27 +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
bachinger
baf00406c0 Provide option to include next/prev button in lock screen/compact mode.
Issue: #5616
PiperOrigin-RevId: 242452686
2019-04-13 01:33:28 +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
olly
42b641221c Provide flag to disable throwing of cache initialization exceptions
PiperOrigin-RevId: 241497141
2019-04-05 20:49:06 +01:00
andrewlewis
9dc22c3086 Enable HDMV DTS stream detection if a flag is set
Issue: #5330
PiperOrigin-RevId: 241381723
2019-04-01 21:06:59 +01:00
bachinger
2dc07fc461 assert userAgent is not empty when constructing a DefaultHttpDataSourceFactory
Issue: #5706
PiperOrigin-RevId: 241360166
2019-04-01 20:33:19 +01:00
bachinger
e612511afc take byte offset into account when unsynchronizing an id3 frame
Issue #5673

PiperOrigin-RevId: 241328598
2019-04-01 20:32:40 +01:00
tonihei
5fd4fddfac Use system Locale language to select audio track.
If no track matches the preferred language or no preferred language is provided,
use the system Locale language as the next decision criterion.

PiperOrigin-RevId: 241322703
2019-04-01 20:32:21 +01:00
Oliver Woodman
334da7deb9 Merge pull request #5390 from zsmatyas:dev-v2
PiperOrigin-RevId: 241308265
2019-04-01 20:31:39 +01:00
olly
592b5eafee Support multiple CC channels in DASH
Issue: #5656
PiperOrigin-RevId: 241235377
2019-04-01 20:31:18 +01:00
olly
5db33deef4 HLS: Fix playlist tracker bundle lookup
As of 99f89132c2 an identity check isn't sufficient for the lookup.

PiperOrigin-RevId: 240989848
2019-03-29 16:51:57 +00:00
olly
99f89132c2 Remove HlsUrl and introduce HlsMasterPlaylist.mediaPlaylistUrls
- This removes the need for Variant and Rendition to have a common
  base class, allowing the url field to be marked as @Nullable in
  Rendition but not in Variant.
- The addition of mediaPlaylistUrls is needed for the new StreamKey
  indexing for HLS. It's also convenient in a couple of places (e.g.
  HlsDownloader), where a list of all media playlist URLs is needed.
- Lots of places where HlsUrl was passed only needed the actual
  URL (not the Format, which is the other piece of HlsUrl). Passing
  just the URL is a little simpler, and resolves some of the naming
  confusion.

Issue: #5596
Issue: #2600
PiperOrigin-RevId: 240970466
2019-03-29 16:51:42 +00:00
olly
2623b4b382 Pre-resolve HlsUrl urls
This is to make it possible to use equality of HlsUrl.url fields
to determine whether two HlsUrls point at the same media playlist.
This doesn't work currently because it's possible to mix absolute
and relative urls, which will not be equal until after the relative
url is resolved against the playlist baseUrl.

Issue: #5596
Issue: #2600
PiperOrigin-RevId: 240966503
2019-03-29 16:51:27 +00:00
tonihei
32924e3f17 Use role flags in DefaultTrackNameProvider.
Also make combination of language and role flags the default over the label,
as it's more readable and auto-translated into other languages.

PiperOrigin-RevId: 240801070
2019-03-29 16:51:12 +00:00
tonihei
28ea31cd4c Use Closeable interface for DownloadStateCursor to simplify closing.
PiperOrigin-RevId: 240775823
2019-03-29 16:50:57 +00:00
tonihei
e8cf67c0cd Allow simplified custom adaptive track selection factories.
Custom factories currently need to copy most of the code in the
AdaptiveTrackSelection.Factory to make use of the same functionality.
Simplify this by allowing to overwrite the factory.

PiperOrigin-RevId: 240773271
2019-03-29 16:50:42 +00:00
tonihei
bb48dc9916 Close cursor in DownloadManager.
Not closing the cursor crashes the demo app when in run in StrictMode.

PiperOrigin-RevId: 240768493
2019-03-29 16:50:27 +00:00
eguven
b1a13f9651 Create internal methods that will run on internal thread
This is the first 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: 240743400
2019-03-29 16:50:11 +00:00
aquilescanta
62f719f3ee Remove some long-deprecated DefaultDrmSessionManager constructors
PiperOrigin-RevId: 240742207
2019-03-29 16:49:56 +00:00
olly
0810fe9159 Remove "variant" terminology from HlsChunkSource
HlsChunkSource may also be downloading segments from demuxed
renditions, which are not variants.

PiperOrigin-RevId: 240625139
2019-03-29 16:49:41 +00:00
olly
65bab95f72 Add video and closed caption renditions to HlsMasterPlaylist
Still skipping any renditions that have a null URL, which means that
closedCaptions in particular is always empty. This restriction will
be removed in a subsequent change, which will also remove muxedAudioFormat
and muxedAudioCaptions from HlsMasterPlaylist and instead derive them
from the Variant and Rendition information in HlsMediaPeriod.

Issue: #5596
Issue: #2600
PiperOrigin-RevId: 240623500
2019-03-29 16:49:26 +00:00
olly
6e6df6a2f0 Improve DownloadService notification documentation
The one functional change here is to require subclasses to implement getForegroundNotification. It seems easier and less error prone to
force developers to implement it than it does to document the cases
in which they need to override it (which is most cases).

PiperOrigin-RevId: 240566737
2019-03-29 16:49:11 +00:00
eguven
facd32e65e Remove DownloadAction.createRemoveAction
PiperOrigin-RevId: 240557315
2019-03-29 16:48:55 +00:00
eguven
d4f5c9c721 Remove DownloadHelper.getRemoveAction
PiperOrigin-RevId: 240444051
2019-03-29 16:48:40 +00:00
olly
9d99f92146 Improve DownloadService action documentation
PiperOrigin-RevId: 240440477
2019-03-29 16:48:24 +00:00
olly
e3a8429ee2 More faithfully parse content of HLS master playlists
- Split HlsUrl into Rendition and Variant
- Add Rendition/Variant specific information to the new types

Issue: #5596
PiperOrigin-RevId: 240419763
2019-03-29 16:48:09 +00:00
eguven
ae5e5f7efc Stop using remove DownloadActions in DownloadManager
PiperOrigin-RevId: 240376409
2019-03-29 16:47:53 +00:00
eguven
709a712a5f DownloadAction custom id
PiperOrigin-RevId: 240363716
2019-03-29 16:47:38 +00:00