417 Commits

Author SHA1 Message Date
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
olly
d87fc72378 Add DASH text representation parsing tests
PiperOrigin-RevId: 305140826
2020-04-07 13:39:03 +01:00
aquilescanta
41853169a7 Remove loadTaskId to Loader.Callback
Partial rollback of ca799716b8. We'll have to plumb
the id manually, like the rest of the LoadEventInfo
members.

PiperOrigin-RevId: 304067761
2020-04-01 22:37:43 +01:00
aquilescanta
ca799716b8 Add loadTaskId to Loader.Callback
PiperOrigin-RevId: 303447837
2020-03-30 17:16:41 +01:00
bachinger
25d9f76a07 deprecate createMediaSource with uri argument
PiperOrigin-RevId: 303217607
2020-03-27 23:31:37 +00:00
aquilescanta
aa9eb5abc9 Remove generics from DRM components
PiperOrigin-RevId: 301798563
2020-03-20 12:48:50 +00:00
Oliver Woodman
b46f64ab70 Merge pull request #7064 from davibe:enhancement/6907
PiperOrigin-RevId: 300330109
2020-03-11 16:27:47 +00:00
Oliver Woodman
0175dd4441 Merge pull request #7057 from Chimerapps:dash_assetidentifier
PiperOrigin-RevId: 300313753
2020-03-11 16:27:36 +00:00
bachinger
a5f0eb1e10 replace extension with mime type
This change uses mime types in a functionally equivalent way to how we used the extension hint so far.

Using a mimeType instead of the extension has some advantages. Most importantly mimeTypes are used by the cast SDK with which we want to achieve interoperability in the cast extension.

Using a mimeType instead of the extension hint further appears to be a bit more clear (which might be opinionated). Further mime types are a well known and widely used concept to identify file type on the internet and it provides asterix based generalizations (audio/*, */*) which could express the media type OTHER that ExoPlayer is using internally (no usage of asterix required so far though).

PiperOrigin-RevId: 300058945
2020-03-11 16:26:23 +00:00
bachinger
87405cb1c0 remove DefaultMediaSourceFactory.Delegate
PiperOrigin-RevId: 299943596
2020-03-10 10:21:37 +00:00
ibaker
eeab811301 Add EventDispatcher to DrmSession(Manager) acquire & release calls
This is passed in but not currently used. I'll use it in follow-up
changes.

Pre-work for issue:#6765

PiperOrigin-RevId: 299314341
2020-03-10 10:20:01 +00:00
aquilescanta
47b62e8c02 DataReader: replace InterruptedException with InterruptedIOException
PiperOrigin-RevId: 299092243
2020-03-10 10:19:45 +00:00
bachinger
4517829610 add DefaultMediaSourceFactory and use it in PlayerActivity
PiperOrigin-RevId: 298879027
2020-03-10 10:19:27 +00:00
tonihei
b5976a55ff Upgrade Kotlin annotations and fix gradle warnings
The new version fixes some warnings in Gradle builds. Also
add missing indirect compileOnly dependencies to fix some more warnings

Issue:issue:#7007
PiperOrigin-RevId: 298855510
2020-03-10 10:19:19 +00:00
bachinger
eb3ea92806 remove unnecessary null-check
PiperOrigin-RevId: 298559123
2020-03-10 10:17:31 +00:00
olly
f248a10627 [AVOD] Added if empty checks for streamKeys.
DashMediaSource is created with Manifest data and streamKeys can be empty given that streamKeys are only created out of MediaItem inside DashMediaSource, and this particular implementation don't extract them out of MediaItem properties.

Tested=Verified playback works.
PiperOrigin-RevId: 298550021
2020-03-10 10:17:23 +00:00
bachinger
d1bbd3507a add media item to create media sources
This change adds the createMediaSource(MediaItem mediaItem) method to the MediaSourceFactory interface. It doesn't deprecate createMediaSource(Uri uri) to keep the cl smaller. Deprecation and removing calls to the deprecated method from within the library and extension follow in a separate CL.

PiperOrigin-RevId: 298352442
2020-03-10 10:17:03 +00:00
olly
a6d0caaa3c Drop prefix test- from test methods under v2/library
This is one step toward following the google3's test naming convention.
See go/java-testing/getting_started#basic-test-template for details
why prefix test isn't necessary.

This CL is generated by following command
$ find -name '*Test.java' | xargs -I{} sed -i 's/^\ \ public\ void\ test\([A-Z]\)\(.*\)$/  public void \L\1\E\2/' {}

and then manually modified following tests where test method names conflict with test target.
- VorbisUtilTest
- VorbisReaderTest
- UtilTest
- DownloadManagerDashTest
- DefaultOggSeekerTest
- OggPageHeaderTest
- HlsMasterPlaylistParserTest

PiperOrigin-RevId: 298074653
2020-03-10 10:15:43 +00:00
Davide Bertola
8908cc85ed DASHMediaSource: avoid potentially locking twice
It many happen when changing manifest uri because of http 302 and MPD.Location present.
2020-03-09 16:43:55 +01:00
Davide Bertola
ca70b10c03 DASHMediaSource: ensure MPD.Location is applied in also case of http redirect 2020-03-09 16:33:57 +01:00
Davide Bertola
087c6e0e05 stick to new dash manifest uri after http 302 redirection 2020-03-09 16:02:22 +01:00
Nicola Verbeeck
170fc852ca DASH: Include AssetIdentifier in period
DASH: Parse AssetIdentifier in period
Breaking: DashManifestParser.buildPeriod signature has changed
2020-03-06 12:24:04 +01:00
aquilescanta
a114a0ed7f Rename SampleDataReader to DataReader and move to common
PiperOrigin-RevId: 297603312
2020-02-27 17:16:53 +00:00
olly
c6a6e0d6f3 Migrate various call sites to Format.Builder
PiperOrigin-RevId: 297562889
2020-02-27 17:15:34 +00:00
olly
f342df2047 Migrate DASH to Format.Builder
Bitrates in the DASH manifest are peak bitrates, as per the ref'd issue.

Issue: #5978
PiperOrigin-RevId: 296478812
2020-02-25 21:23:45 +00:00
olly
42d4afe7b6 Make Format.Builder, peakBitrate and averageBitrate public
- Deprecate old Format.createXXX methods
- Deprecate most Format.copyXXX methods
- Stop using deprecated Format.copyXXX methods in the library

Note: Replacing library usages of Format.createXXX method
will be done in follow up CLs. These changes aren't purely
mechanical because we need to decide which out of peakBitrate
and averageBitrate to set in each case where currently a
single bitrate is provided.

Issue: #2863
PiperOrigin-RevId: 296450935
2020-02-25 21:23:21 +00:00
olly
47133f46cb Keep method signature together when overriding
Not important, but when overriding a method that can return null,
it seems preferable to put @Override first, followed by what it's
overriding (which includes the @Nullable).

Also remove explicit @NonNull use in the core library. @NonNull is
propagated by default, so this is redundant.

PiperOrigin-RevId: 296188379
2020-02-25 21:22:10 +00:00
aquilescanta
5c3c803460 Remove DRM management from Renderers
PiperOrigin-RevId: 295569075
2020-02-17 17:40:30 +00:00
olly
e606893ff8 Create a SampleDataReader interface for TrackOutput.sampleData().
Modify TrackOutput.sampleData() to accept SampleDataReader instead of ExtractorInput. SampleDataReader supports only read and skip calls, which all sampleData() implementations already restrict themselves to.

PiperOrigin-RevId: 294905155
2020-02-13 15:46:13 +00:00
olly
1cbe3f72e6 DataSpec: Deprecate most constructors
Keeping (Uri) and (Uri, position, length) to avoid needing
Builder for the trivial case.

PiperOrigin-RevId: 294530226
2020-02-13 15:43:54 +00:00
kimvde
363599dd54 Move assets from dash to testdata module
PiperOrigin-RevId: 294241169
2020-02-11 17:12:21 +00:00
andrewlewis
704dae097a Add missing @deprecated tag
PiperOrigin-RevId: 292915739
2020-02-11 17:06:55 +00:00
olly
3a702cf53a Change Format.createTextSampleFormat for common uses cases
PiperOrigin-RevId: 292863614
2020-02-03 11:20:56 +00:00