449 Commits

Author SHA1 Message Date
ibaker
fa594489d9 Completely separate MediaSource & DrmSession EventDispatchers
PiperOrigin-RevId: 319989989
2020-07-08 13:55:38 +01:00
olly
93b5b947db Support decode-only metadata buffers
PiperOrigin-RevId: 319798613
2020-07-08 13:54:24 +01:00
kimvde
b30e2b961f Rename some white/blacklist occurrences in core library
ISSUE: #7565
PiperOrigin-RevId: 319734842
2020-07-06 16:43:36 +01:00
olly
8bd01a7bec Discard samples on the write-side of SampleQueue
PiperOrigin-RevId: 319205008
2020-07-03 09:01:46 +01:00
olly
c9717f67ea Push all Downloader networking onto the executor
Issue: Issue: #6978
PiperOrigin-RevId: 318710782
2020-06-29 13:32:36 +01:00
tonihei
4138e28d62 Move common gradle setup to a setting file.
This removes a lot of duplication from the module configuration,
avoids divergence, and makes sure that only the important differences
to the default are visible in each module file.

PiperOrigin-RevId: 318024823
2020-06-26 11:13:25 +01:00
samrobinson
836babd5d6 Replace usages of Charset.forName with Guava Charsets.
PiperOrigin-RevId: 317672619
2020-06-23 11:07:43 +01:00
tonihei
1836f1df36 Update Checkerframework.
The compat dependency is no longer maintained and we need to keep
it at its old version.

PiperOrigin-RevId: 317658349
2020-06-23 11:07:34 +01:00
andrewlewis
dbe16cd268 Remove unnecessary null check
PiperOrigin-RevId: 317604812
2020-06-23 11:06:41 +01:00
tonihei
c5c4c87728 Restrict some Handler to current Looper only.
They currently fall back to the main Looper if the current thread
doesn't have a Looper. All the changed Handlers are guaranteed to
be created on a thread with a Looper (mostly the ExoPlayer playback
Looper) and thus can make this stricter assumption. This makes it
easier to reason about the code as there are no ambiguities as to which
thread the Handler is running on.

PiperOrigin-RevId: 317334503
2020-06-23 11:06:31 +01:00
tonihei
7d66865d20 Rollback of 63ae4cc54b
*** Original commit ***

Rollback of 6ae472243f

*** Original commit ***

PiperOrigin-RevId: 317331407
2020-06-23 11:06:22 +01:00
olly
63ae4cc54b Rollback of 6ae472243f
*** Original commit ***

Rename Util methods to clarify which Looper is used.

The method name didn't clarify that either the main or current
Looper is used.

***

PiperOrigin-RevId: 317283606
2020-06-23 11:05:56 +01:00
tonihei
6ae472243f Rename Util methods to clarify which Looper is used.
The method name didn't clarify that either the main or current
Looper is used.

PiperOrigin-RevId: 317276561
2020-06-23 11:05:46 +01:00
olly
88883ffd67 Generalize MimeTypes.isWebm to MimeTypes.isMatroska
It seems more natural given we always end up instantiating a Matroska extractor,
not one that's specific to the WebM subset of Matroska. There's also no reason
not to support Matroska MIME types in DASH.

PiperOrigin-RevId: 316975451
2020-06-23 11:04:56 +01:00
bachinger
5b28cb5209 Add getMediaItem() to MediaSource
This change adds MediaSource.getMediaItem and deprecates MediaSource.getTag. For backwards compatibility, the tag is made available through the Window with `mediaItem.playbackProperties.tag` as well as in the deprecated `tag` attribute.

PiperOrigin-RevId: 316539752
2020-06-17 14:30:04 +01:00
andrewlewis
28a7e59d7b Fix javadoc
PiperOrigin-RevId: 316071392
2020-06-12 18:11:12 +01:00
olly
5324dc37e3 Support passing custom manifest parsers to Downloaders
Issue: #5978
PiperOrigin-RevId: 315941765
2020-06-12 00:26:08 +01:00
aquilescanta
e7da26368a Add MediaParser-based implementation of ChunkExtractor
PiperOrigin-RevId: 315720712
2020-06-11 10:11:20 +01:00
aquilescanta
c37af0b543 Make ChunkExtractor return a ChunkIndex instead of a SeekMap
PiperOrigin-RevId: 315283645
2020-06-08 17:40:55 +01:00
bachinger
52e39cd755 Handle factory attributes consistently
This change applies the same approach of handling tag/streamKeys from factories like in the SmoothStreaming and Hls factories. It is functionally equivalent but improves readability.

PiperOrigin-RevId: 313771318
2020-05-29 18:34:37 +01:00
bachinger
f84bd4635a Replace manifest uri without changing the media item
We aim to have the same media item instance published in the timeline that is passed to the createMediaSource(mediaItem) method. This means when the manifest uri is manually replaced by a developer, the media item published in the next timeline update is still the same.

Note: This leads to the fact that the manifest published in that timeline is loaded from a different URI than the URI of the media item in the same timeline.
PiperOrigin-RevId: 313375421
2020-05-27 19:01:22 +01:00
aquilescanta
32c356177f Extract a ChunkExtractor interface
A future implementation will depend on MediaParser.

PiperOrigin-RevId: 313367998
2020-05-27 19:01:02 +01:00
krocard
151ea531b1 Make constants more readable with _ separator
Add an `_` in long constants.
Eg: 10000 => 10_000.

I'm proposing this change because I have had multiple
missread due to confusing the number of 0 in a long number.

More specifically, added an underscore to all number matching:
`final.*\ [0-9]{2,}000;`

PiperOrigin-RevId: 313186920
2020-05-27 19:00:36 +01:00
bachinger
2d52b0d5cf Add createMediaSource method with manifest and media item
This change adds an overloaded createMediaSource method which allows developers to pass in a media item with a in-memory manifest. Without this method the developer would not have a chance to pass in a non-dummy media item when using the factory for creting a DASH media source with an in-memory manifest.

PiperOrigin-RevId: 312660418
2020-05-21 17:10:30 +01:00
bachinger
634634f8e3 Make DashMediaSource add the media item to the timeline
PiperOrigin-RevId: 312646461
2020-05-21 17:09:51 +01:00
ibaker
02e74d6c94 Fix Guava deps from compileOnly to implementation
PiperOrigin-RevId: 312479354
2020-05-21 17:09:03 +01:00
bachinger
d233c04582 Simplify DownloadHelper
PiperOrigin-RevId: 312467496
2020-05-21 17:08:43 +01:00
ibaker
b9157a9e23 Add Guava dependency to ExoPlayer
Guava is heavily optimized for Android and the impact on binary size
is minimal (and outweighed by the organic growth of the ExoPlayer
library).

This change also replaces Util.toArray() with Guava's Ints.toArray()
in order to introduce a Guava usage into a range of modules.

PiperOrigin-RevId: 312449093
2020-05-21 17:08:33 +01:00
Oliver Woodman
3db703a983 Merge pull request #7370 from jruesga:embedded-cea-708-support
PiperOrigin-RevId: 312090461
2020-05-18 22:38:10 +01:00
olly
b667a0e7e2 Rename closed caption variables to be non-608 specific
This is the rename-only part of https://github.com/google/ExoPlayer/pull/7370

PiperOrigin-RevId: 312057896
2020-05-18 16:14:01 +01:00
bachinger
9e35c6c28c Make all segment downloader use the media item
PiperOrigin-RevId: 311527440
2020-05-14 22:24:31 +01:00
Jorge Ruesga
435639979f
Enable embedded CEA-708 support
Currently, DashMediaPeriod only takes into account as CEA-608 accessibility tags as embedded
closed captions tracks CEA-608. CEA-708 closed captions format is parsed when is present on
its own AdaptationSet, but not when is embedded as an accessibility tag in a video AdaptaticonSet.

Embedded CEA-708 support is added by parsing accessibility tags like the example below:

  <Accessibility schemeIdUri="urn:scte:dash:cc:cea-708:2015" value="1=lang:eng;2=lang:deu"/>
  <Accessibility schemeIdUri="urn:scte:dash:cc:cea-708:2015" value="1=lang:eng;2=lang:eng,war:1,er:1"/>

so it creates a new CEA-708 track for accessibility tags with schemeIdUri = urn:scte:dash:cc:cea-708:2015
and extract accessibilityChannel and language from value attribute.

Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
2020-05-13 04:45:56 +01:00
aquilescanta
fff3f99f4a Pass LoadErrorInfo to LoadErrorHandlingPolcy
Issue: #7309
PiperOrigin-RevId: 309749566
2020-05-05 18:37:57 +01:00
olly
32516d85be Simplify thread interruption for downloads.
- Stop throwing InterruptedException from CacheUtil. When a CacheUtil operation
  throws or returns, the caller should always check its own state to determine
  whether they canceled the operation. If a caller is trying to catch
  InterruptedException separately to IOException to do something different in
  that case, they're probably doing the wrong thing. So it's simpler, and probably
  less error prone, just to throw an IOException in the case of interruption.
- Throwing InterruptedIOException is also consistent with what our Extractor and
  DataSource implementations do.

Issue: #5978
PiperOrigin-RevId: 309411556
2020-05-01 19:51:05 +01:00
aquilescanta
0774ee1da9 Merge LoadErrorHandlingPolicy cleanup methods
Issue: #7309
PiperOrigin-RevId: 309387483
2020-05-01 19:49:24 +01:00
aquilescanta
c4f65eb84a Add LoadErrorHandlingPolicy cleanup callbacks
Implementors should use the new callbacks to
clean up any resources associated with the
corresponding LoadEventInfo ids.

PiperOrigin-RevId: 309198455
2020-05-01 19:47:57 +01:00
bachinger
b22783f895 Rename sourceUri to uri
PiperOrigin-RevId: 308918151
2020-05-01 19:46:04 +01:00
olly
2d494861ec Cleanup and document TestDownloadManagerListener
PiperOrigin-RevId: 308843488
2020-05-01 19:45:29 +01:00
olly
37d9e2f485 DownloadManagerTest: Improve thread interactions
- Remove assertReleased and replace it with a proper condition variable
  that's opened when Downloader.download or Download.remove finish. As
  far as I can tell assertReleased was basically implementing "sleep for
  10 seconds after the Downloader starts". Note fixing this properly
  also makes the tests run much faster!
- Use ConditionVariable instead of CountDownLatch(1).
- Use AtomicInteger instead of volatile int because it's clearer and
  allows removal of explanatory comments.

PiperOrigin-RevId: 308819204
2020-05-01 19:44:27 +01:00
aquilescanta
b5112492be Add loadTaskId to LoadEventInfo
To be used by the LoadErrorHandlingPolicy.

PiperOrigin-RevId: 308657905
2020-05-01 19:43:34 +01:00
olly
0ba397cd4e SegmentDownloader: Pull manifest loading up to base class.
This will make it a bit easier to push manifest loads to an Executor.

Issue: #5978
PiperOrigin-RevId: 308608155
2020-05-01 19:43:25 +01:00
olly
2e9ed51503 Use Executor instead of ExecutorService for parallel downloads
- Executor is a superclass of ExecutorService, so this is arguably a little
  more flexible.
- It removes the need to use null for direct execution, because Runnable::run
  is a direct executor that can be trivially used instead.
- Removing the error-prone "cannot be a direct executor" restriction in the
  parallel version of SegmentDownloader requires not relying on the futures
  returned from ExecutorService.submit() anyway.

Issue: #5978
PiperOrigin-RevId: 308586620
2020-04-27 11:34:30 +01:00
aquilescanta
30c55d117e Fix NPE when reading from a SampleQueue from a loading thread
Issue: #7273
PiperOrigin-RevId: 308238035
2020-04-27 10:41:50 +01:00
aquilescanta
25f17acd21 Move LoadEventInfo creation to the caller
LoadEventInfo needs to also be sent to the LoadErrorHandlingPolicy.

PiperOrigin-RevId: 308066998
2020-04-27 10:41:33 +01:00
olly
cd828e5c10 Plumb an ExecutorService into Downloader implementations
Issue: #5978
PiperOrigin-RevId: 307819608
2020-04-27 10:40:01 +01:00
olly
4abaaf138c Remove DownloadConstructorHelper
Something that helps a constructor always seemed a bit strange.
It's now possible to use CacheDataSource.Factory directly instead.

PiperOrigin-RevId: 307661930
2020-04-27 10:39:34 +01:00
aquilescanta
7839955f31 Separate encryption data into a new TrackOutput method
Allows media parser to populate crypto data.

PiperOrigin-RevId: 307616083
2020-04-27 10:19:13 +01:00
olly
fea4376779 Merge trick play tracks into main track groups
Issue: #6054
PiperOrigin-RevId: 307285068
2020-04-20 13:29:05 +01:00
olly
ba0028ca2c Parse trick-play role flags from DASH manifests
Issue: #6054
PiperOrigin-RevId: 306641689
2020-04-15 17:42:19 +01:00
olly
74a9d8f680 Clean up manifest MIME type and codec parsing
PiperOrigin-RevId: 305258836
2020-04-07 17:07:10 +01:00