16 Commits

Author SHA1 Message Date
olly
6acf59c4fc Fix Widevine L3 provisioning in V2
1. HttpMediaDrmCallback.executeProvisionRequest needs to specify
   an empty byte[], else we do a GET instead of a POST.
2. Content-Type should not be set when making the provision
   request, since there's no body.
3. DataSource implementations must correctly handle a non-null
   body with zero length. CronetDataSource was not handling this
   case. DefaultHttpDataSource was, but made a code modification
   to make it a little clearer. OkHttpDataSource seems to handle
   the case correctly, and it doens't look like the code can be
   made clearer.

Issue #1925

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136042641
2016-10-14 10:42:43 +01:00
olly
94c7ee7252 Cronet - Skip if server doesn't support range requests
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135819142
2016-10-14 10:42:43 +01:00
olly
907b9bf4f6 Sanitize threading in CronetDataSource
- Move nearly all logic onto the calling thread (i.e. the thread
  calling open/read/close), to make threading correctness more
  obvious.
- Document which variables are read/written from which thread, and
  why the call sequences are safe.
- Fix thread safety issue that I think could probably cause data
  corruption in the case of a read timeout followed by another
  request into the DataSource.

Also:

- Relaxed content length checking to be consistent with the other
  http DataSource implementations, and avoided parsing the headers
  where they're not used.
- Fixed missing generics in CronetDataSourceFactory.
- Added TODO to work with servers that don't support partial range
  requests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135702217
2016-10-11 18:16:28 +01:00
olly
97020e0bab CronetDataSource: Fix getContentLength logging
This is a minor cleanup. The main thing it fixes is that
the "Inconsistent headers" and "Unexpected Content-Range"
log messages were printing List<String> objects, rather
than the actual headers they are supposed to print.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135378074
2016-10-11 18:16:28 +01:00
olly
d95baa3ee9 CronetDataSource: Fix thread safety issue with requestProperties
The access in fillCurrentRequestPostBody wasn't protected with
synchronization. Furthermore, just synchronizing it wouldn't be
sufficient, since what we really need to check is whether the
Content-Type header has been added to the UrlRequest.Builder.
The contents of requestProperties may have changed between the
headers being added to UrlRequest.Builder and the call to
fillCurrentRequestPostBody.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135376904
2016-10-11 18:16:28 +01:00
olly
661b14020e Partial cleanup of CronetDataSource II
- Allow null Content-Type in response headers.
- Inline validateResponse, just because it makes it clearer
  what thread it's being executed on when inlined.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135375063
2016-10-11 18:16:28 +01:00
olly
ba56f9165c Partial cleanup of CronetDataSource
- Fix bug in getCurrentRequestStatus where we weren't
  blocking on the condition variable.
- Make methods static where possible.
- Clean up getUri implementation.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135373586
2016-10-11 18:16:28 +01:00
olly
5803b2538d No-op reorder of CronetDataSource methods
This change is a no-op reodering, as a precursor to
further cleanup. The public methods are grouped by
the class/interface they implement. The private methods
are ordered with things that will become static in
a subsequent change at the bottom.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135372629
2016-10-11 18:16:28 +01:00
olly
b3c6f1caae Finish cleaning DataSource implementations.
- Enfroce read returns 0 if readLength==0 everywhere.
- Fixes and simplifications for CronetDataSource.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135138232
2016-10-04 23:42:55 +01:00
falhassen
f2cf086d76 Fix content length calculation for gzipped files
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134011959
2016-09-28 11:25:34 +01:00
mgersh
e20d7034c7 Switch to Cronet 55_0_2860_0
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=133850026
2016-09-28 11:24:55 +01:00
eguven
06a644eccd DataSourceException: Used to specify a DataSource error.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=132053698
2016-09-02 16:20:06 +01:00
eguven
860c6588c0 created DefaultHttpDataSourceFactory
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131931668
2016-09-02 16:15:18 +01:00
olly
a779eabdc5 Update SDK / Tools.
- Centralise compileSdkVersion, targetSdkVersion and
  buildToolsVersion in a single place for gradle.
- Bump compileSdkVersion and targetSdkVersion to 24.
- Bump com.android.tools.build version to re-enable
  instant start.
- Bump targetSdkVersion in manifests (needed for
  internal builds).
- Use standard expandable_list_item from Android in
  the demo app, since ours doesn't look right when
  targeting API level 24. We were also setting the
  theme on the wrong element in the manifest, so I'm
  removing that line.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131929216
2016-09-02 16:12:55 +01:00
olly
9adce6b007 Make sure Cronet extension/tests are pushed to GitHub
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131825185
2016-09-02 16:08:00 +01:00
cchiappini
4df63314d4 Create Cronet extension in v2
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131393395
2016-08-31 15:25:31 +01:00