1862 Commits

Author SHA1 Message Date
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
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
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
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
olly
07e3509dd9 Support providing all keys via EXT-X-SESSION-KEY tags
PiperOrigin-RevId: 240333415
2019-03-26 13:18:48 +00:00
eguven
c04f5b9c5d Add DownloadManager.removeDownload method
PiperOrigin-RevId: 240330799
2019-03-26 13:18:30 +00:00
eguven
3919f3843d Make DownloadManager use DownloadIndex
PiperOrigin-RevId: 240320220
2019-03-26 13:18:11 +00:00
tonihei
679b628326 Add experimental option for multiple parallel adaptive track selections.
If enabled, DefaultTrackSelector returns multiple groups with more than one
track. AdaptiveTrackSelection then decides on the order in which the tracks
are changed such that the BandwidthProvider for each selection can figure out
the allocated bandwidth.

PiperOrigin-RevId: 240150206
2019-03-26 10:41:41 +00:00
aquilescanta
32347362f4 Select text track matching selected audio language when selecting forced text tracks
PiperOrigin-RevId: 240133676
2019-03-26 10:41:28 +00:00
olly
e91eec7cf8 Make DownloadThread extend Thread
PiperOrigin-RevId: 240120782
2019-03-26 10:41:14 +00:00
tonihei
b0bb6ec8a5 Allow to set selection reason and data when specifying an override.
It's currently very difficult to actually set a reason for track selection
triggered by a SelectionOverride. It would require creating a new custom
TrackSelection.Factory where the reason gets injected somehow before the
override is specified on the player.

Simplify this whole procedure by allowing to set the reason directly and
forward this reason to all fixed selections created based on this override.

PiperOrigin-RevId: 240114942
2019-03-26 10:41:00 +00:00
eguven
6f9d33dbd3 Add DefaultDownloadIndex setManualStopReason variant for single download
PiperOrigin-RevId: 240108843
2019-03-26 10:40:46 +00:00
tonihei
afd9014b82 Ignore AC-3 tracks with fscod=3.
3 ("11") is the reserved code for fscod in AC3. The spec says that "If the
reserved code is indicated, the decoder should not attempt to decode audio and
should mute."

We currently throw an exception as we try to access an array with an invalid
index. Now ignoring the track instead by invalidating the format.

Issue:#5638
PiperOrigin-RevId: 240106255
2019-03-26 10:40:32 +00:00
Toni
5da4c67c8a Merge pull request #5303 from DolbyLaboratories:dev-v2-ac4
PiperOrigin-RevId: 239957730
2019-03-26 10:40:18 +00:00
olly
77d597de5f Parse CHARACTERISTICS attribute for EXT-X-MEDIA tags
PiperOrigin-RevId: 239844963
2019-03-22 19:57:01 +00:00
aquilescanta
cdd433acda Disambiguate comment in Ac3Reader
PiperOrigin-RevId: 239810798
2019-03-22 19:56:43 +00:00
tonihei
e5aed73fba Switch format language tag to use full BCP 47 codes.
This allows to distinguish between regional variants and scripts.

We still need to normalize the language code itself to make track selection
independent of the whether 2 or 3 letter codes are used.

PiperOrigin-RevId: 239783115
2019-03-22 19:56:25 +00:00
tonihei
3543116da4 Prevent seeking when ICY metadata is present.
Any seek map with non-zero offsets breaks playback with ICY metadata as
the metadata is no longer read from the correct position.

Issue:#5658
PiperOrigin-RevId: 239605839
2019-03-22 19:56:06 +00:00
aquilescanta
b7299a1164 DefaultTrackSelector: make audio track selections before text
PiperOrigin-RevId: 239594105
2019-03-22 19:55:48 +00:00
tonihei
a989304a4d Add missing thread verification to SimpleExoPlayer.release().
This call also needs to be made from the right thread to prevent messages
from getting lost and causing ANRs.

PiperOrigin-RevId: 239564573
2019-03-22 19:55:30 +00:00
olly
68ef1d3e97 Temporarily disable cache UID creation.
PiperOrigin-RevId: 239476751
2019-03-20 23:35:31 +00:00
olly
3abf5ed143 Automated g4 rollback of changelist 239294713.
*** Reason for rollback ***

Trying to forward fix instead.

*** Original change description ***

Automated g4 rollback of changelist 237051112.

*** Original change description ***

Add SimpleCache deletion functionality

This is needed now that index data may be stored outside
of the cache directory.

***

***

PiperOrigin-RevId: 239429430
2019-03-20 23:35:18 +00:00