80 Commits

Author SHA1 Message Date
sammon
d3686cf8a2 Updating DefaultHttpDataSource to allow for http methods other than GET and POST,
as specified by DataSpec.httpMethod.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207769779
2018-08-13 13:39:10 +01:00
olly
af507efb2a Deprecate/remove DataSource constructors that accept listeners
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207713478
2018-08-07 16:28:02 +01:00
tonihei
ffdc17d0e0 Remove generic type parameter from TransferListener.
All known instances use DataSource as generic type and thus code can be simplified
by removing the generic type altogether.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205798542
2018-07-24 14:56:45 +01:00
sammon
01b69854ff Refactoring DataSpec constructor calls to use DataSpec.withUri() and DataSpec.subrange().
This reduces the number of calls to the DataSpec constructor and minimizes the number of files that need to be updated when adding a new DataSpec parameter (ex: followup []

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=205719005
2018-07-24 14:52:58 +01:00
tonihei
a076924caa Simplify using DataSource factories without a TransferListener.
Setting the transfer listener on the data source factories is only needed for debug
purposes, logging and for custom bandwidth metering which doesn't use the
player-provided bandwidth meter. As such, it is not compulsary and it should be easy
to set up the data source factory without a transfer listener.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=204926083
2018-07-17 20:40:56 +01:00
tonihei
c3df64f102 Extend TransferListener with onTransferInitializing and additional parameters.
This allows more fine-grained analysis of transfers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203950327
2018-07-11 14:54:35 +01:00
tonihei
2b1434dfcb Change DataSource.Type to a boolean.
There are only two types at the moment and we can therefore use a boolean.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203937357
2018-07-11 14:53:14 +01:00
tonihei
55ce085a0d Add transferInitializing to BaseDataSource.
This allows implementations to notify when the transfer is about to be started.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203102117
2018-07-06 14:24:21 +01:00
tonihei
985160a47d Use BaseDataSource for all internal leaf data sources.
This allows all leaf data sources (i.e. ones which do not forward the requests
to other data sources) to accept multiple listeners.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=203097587
2018-07-06 14:23:02 +01:00
aquilescanta
bb684b528e Promote getResponseHeaders to DataSource
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199607604
2018-06-18 10:51:31 +01:00
andrewlewis
d5034ca889 Set interrupted flag when throwing InterruptedIOE
This avoids the interrupted flag being lost if the exception
is handled as an IOException.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=195366244
2018-05-07 07:04:09 +01:00
olly
c68e00e28f Fix crash in CronetEngineWrapper
Cronet now returns an unmodifiable list, so we need to copy it

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=194790506
2018-05-07 06:32:59 +01:00
tonihei
66d2b76a6c Remove test max SDK version overrides.
These don't seem to be needed anymore. All tests run without them in gradle
and Blaze.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191867518
2018-04-08 16:39:57 +01:00
olly
82c71378eb Remove unnecessary testInstrumentationRunner lines
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191418665
2018-04-03 15:35:40 +01:00
olly
8b5a34769f Remove unnecessary line from test manifests
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191409777
2018-04-03 15:30:40 +01:00
hoangtc
fcb796a80c Migrate ExoPlayer Gradle build files.
- Change 'compile' configuration (deprecared) to using 'implementation'
and 'api' configurations instead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187311778
2018-03-02 09:20:02 +00:00
tonihei
b47fb2826b Move extension tests to Robolectric.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187021822
2018-02-27 11:03:50 +00:00
aquilescanta
8f81abee86 Prevent "unexpected read attempt" illegal state exception
When using cronet data source, calling read after the end of input has
been read will trigger this.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184667794
2018-02-08 14:49:00 +00:00
tonihei
e991a8015b Use Truth instead of framework asserts in all tests.
This achieves two things:
1. All our tests use the same type of assertions.
2. The tests currently run as instrumentation test can be moved to
   Robolectric without changing the assertions.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182910542
2018-01-23 19:29:12 +00:00
andrewlewis
13fbe7b2f2 Fix cronet extension package name
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181331715
2018-01-15 11:40:29 +00:00
tonihei
183870d9d3 Update Cronet extension readme on how to enable Java 8 features.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180660349
2018-01-04 15:45:26 +00:00
olly
c06fe73b66 Bump target API level to 27
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176366693
2017-11-21 13:03:28 +00:00
tonihei
3f6b4d18a9 Move MockitoUtils to testutils and use it for all Mockito set-ups.
In particular this allows to have the workaround for
https://code.google.com/p/dexmaker/issues/detail?id=2 in one place only.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176340526
2017-11-20 13:40:28 +00:00
falhassen
46172ffd0f Preserve original on redirect with the set-cookie flow.
We need to make sure the original header is retained when we redirect.

I filed a request on Cronet to allow headers to be provided to the UrlRequest#followRedirect method:
https://bugs.chromium.org/p/chromium/issues/detail?id=779611

Until that API is changed, i.e., pulled into GMSCore, and most clients are using the version of GMSCore with the API change, we can stick with this approach.

FYI

Cronet generally uses the original headers on redirect:

http://[]

but modifies the headers for these special cases:

hhttp://[]

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174074572
2017-11-01 14:15:12 +00:00
falhassen
46bf254033 Add option for handling "Set-Cookie" requests in CronetDataSource.
This time, we avoid using the problematic CookieManager and HttpCookie framework APIs by just forwarding the cookie request only when the client has enabled the feature and the server responds with a "Set-Cookie" response header.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173532023
2017-10-27 16:22:40 +01:00
falhassen
69e43b6abc Automated g4 rollback of changelist 171999924.
*** Reason for rollback ***

CookieManager APIs are fundamentally broken (b/67951242)

*** Original change description ***

Cookie-based validation in CronetDataSource

Using cookie validation from streamer, streamer can enforce that only clients who have the cookie are able to stream the video.

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173396251
2017-10-27 16:18:35 +01:00
mishaque
5a91a71cd0 Make CronetDataSource interruptable.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=173262660
2017-10-27 16:07:30 +01:00
tonihei
c9ed9366ce Fix Cronet extension build and test.
Recently added Java 8 features in the cronet extension and the linked native libs
require to enable Java 8 desugaring in gradle. Moreover, junit.assertThrows is not
available in our version and its usage has been replaced by the manual check.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=172077967
2017-10-13 19:54:28 +01:00
byungh
3ae4143be3 Cookie-based validation in CronetDataSource
Using cookie validation from streamer, streamer can enforce that only clients who have the cookie are able to stream the video.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=171999924
2017-10-13 19:51:38 +01:00
olly
b17a6ba51d Add TODO to respect FLAG_ALLOW_GZIP in CronetDataSource
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=169927989
2017-09-26 14:05:16 +01:00
olly
f1b3f3a177 Fix broken link + minor doc tweak
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165920927
2017-08-22 16:15:29 +01:00
olly
34960ad891 Tweak and add READMEs + remove refs to V1
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165578518
2017-08-17 22:59:34 +01:00
olly
08d16c55d4 Some Leanback extension + minVersion bump fixes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=165219604
2017-08-17 22:36:47 +01:00
olly
40f34956a8 Bump minimum and target API levels + support lib version
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164863447
2017-08-11 15:01:43 +01:00
olly
d4c45861f4 Clean up extension READMEs
Issue: #1157

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=164434768
2017-08-07 11:54:21 +01:00
eguven
cdb71a80aa Remove empty line after copyright text
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163186057
2017-07-31 20:52:49 +01:00
tonihei
0717c3502f Extend Clock interface with sleep method and add FakeClock.
The FakeClock allows to simulate timing behaviour including sleep time
for test cases.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162345258
2017-07-19 14:06:18 +01:00
olly
387720d182 Allow module registrations + log player release
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162223981
2017-07-17 23:21:34 +01:00
matttt
7b20e130ce Allow a direct executor for Cronet's response handling thread.
We want to experiment with a direct executor to avoid thread hops between the
network thread and the response handling thread. This change is needed to do
so.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161812382
2017-07-15 17:29:41 +01:00
olly
d5c2cf79f4 Update READMEs with new local build instructions
Issue: #2851
Issue: #2974

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160290097
2017-06-28 22:26:05 +01:00
olly
4a59c7cf40 Make it easier to use ExoPlayer modules in other projects II
With this change, it becomes possible to depend on ExoPlayer
locally in settings.gradle by doing:

gradle.ext.exoplayerRoot = 'path/to/exoplayer/root'
apply from: new File(gradle.ext.exoplayerRoot, 'core_settings.gradle')

You can optionally add a prefix onto ExoPlayer's module names
by adding:

gradle.ext.exoplayerModulePrefix = 'prefix'

Issue: #2851
Issue: #2974

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160277967
2017-06-28 22:26:05 +01:00
olly
2a8eb5a2a1 Make it easier to use ExoPlayer modules in other projects
It's currently difficult to use ExoPlayer modules in other gradle
projects because they rely on constants and dependencies defined
in our own top level gradle file. This change moves the constants
into a separate file referenced directly from each module. It also
removes the need for the top level gradle file to declare a
dependency on com.novoda:bintray-release. This is now only needed
if "exoplayerPublishEnabled = true" is specified.

Issue: #2851
Issue: #2974

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=160272072
2017-06-28 22:26:05 +01:00
tonihei
edbc2046e2 Clean-up manifest merge attributes.
1. Remove tools:replace in manifest files. This attribute is only needed to establish priority when two manifests are merged and have the same attribute with different values.
As this is not happening here, the attributes can be removed.

2. Some BUILD files also define a deprecated manifest merge strategy different from the android default merge strategy. For consistency these are set to "android'.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158075128
2017-06-06 16:38:45 +01:00
tonihei
4359d44331 Rename CronetEngineFactory to CronetEngineWrapper
In addition, the class now accepts available Cronet instances and returns the
source of the current CronetEngine.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=156185701
2017-05-17 16:48:07 +01:00
ojw28
785fc76124 Delete gcore_versions.bzl 2017-05-10 22:17:39 -07:00
tonihei
d33a6b49f0 User-defined fallback if Cronet is not available
When using the CronetEngine.Builder class, it automatically selects the
Cronet version preferring higher version codes and falling back to a Java
Http implementation if no native or GMSCore version is available.

This version selection has now been moved into the CronetEngineFactory
class to always prefer GMSCore over natively bundled versions. We also
ignore the Cronet internal Java implementation. Instead, users of
CronetDataSourceFactory can provide their own fallback factory. If none is
provided, we use DefaultHttpDataSourceFactory.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154821040
2017-05-04 20:48:59 +01:00
tonihei
94ffbb2b6a Support for Cronet from GMSCore (Blaze only)
The blaze BUILD file for the Cronet extension now has three options:
Using native bundled Cronet libs, using GMSCore, or using whichever is newer.
The GMSCore version is preselected (as it is the smallest), but other variants
may be used by uncommenting the respective lines.

The API is the same for all cases and the CronetEngine.Builder automatically
selects the newest option or falls back to default http.

To avoid that apps using this extension need to add a dependency to Cronet
themselves, I added a CronetEngineFactory to the Exoplayer extension.

Gradle builds can't be supported (as far as I can see), as the GMSCore Cronet
version is first party only.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=154812029
2017-05-04 20:46:44 +01:00
tonihei
da1b55ed4c NullPointerException in CronetDataSource constructor
When calling CronetDataSourceFactory.createDataSourceInteral, a null pointer
is passed as clock to the CronetDataSource constructor which in turn throws a
NullPointerException. Can be prevented by using other constructor without
clock parameter.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153470874
2017-04-18 19:45:50 +01:00
olly
8be85d4d2f Consolidate version codes in root gradle file
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=153453768
2017-04-18 19:42:27 +01:00
olly
382ba7ecf0 Generate combined Javadoc
Notes:
- Now only generating a single module Javadoc task for the
  release variant.
- Combined Javadoc now includes extensions. VP9 is excluded
  for now since it's failing for an unknown reason.

Issue: #2139

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=150865589
2017-03-22 19:11:28 +00:00