237 Commits

Author SHA1 Message Date
olly
d6650e6514 Migrate SmoothStreaming to Format.Builder
Bitrates in SmoothStreaming manifests are average bitrates, as per
the ref'd issue.

Issue: #5978
PiperOrigin-RevId: 296467667
2020-02-25 21:23:37 +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
75bb45e510 Format: Add Builder
Package private for now. It will be made visible in a child CL.

Issue: #2863
PiperOrigin-RevId: 296255558
2020-02-25 21:22:48 +00:00
olly
54283746be Fix lint errors
PiperOrigin-RevId: 295953956
2020-02-25 21:21:29 +00:00
christosts
3fb8ab2545 Async queueing: avoid extra memory allocations
When copying CryptoInfo for asynchronous input buffer queueing,
re-use the destination CryptoInfo's arrays to avoid re-allocating
memory.

PiperOrigin-RevId: 295706771
2020-02-25 21:20:30 +00:00
Fillmore, Christopher
f288b3e6a8 Read response body in CronetDataSource for error response
Issue #6853
2020-02-21 11:27:11 -05:00
Pierre-Hugues Husson
274743cddc [ParsableBitArray] Add readString 2020-02-18 15:03:57 +01:00
olly
ab21f885d4 Bump version to 2.11.3
PiperOrigin-RevId: 295695297
2020-02-18 11:00:59 +00:00
olly
80ae40f6f4 Add missing IntDef to switch
PiperOrigin-RevId: 295692163
2020-02-18 11:00:51 +00:00
olly
5b3ed8286c Add non-null by default to source package (last one!)
Note on UnknownNull: Where there exists a generically typed
base class and both null and non-null types are permitted,
we need to clear the default non-null that's otherwise
propagated everywhere. This then lets the nullness of the
type work properly.

PiperOrigin-RevId: 295582444
2020-02-17 17:40:30 +00:00
olly
d1e4a63ae0 Zero out trailing bytes in CryptoInfo.iv
CryptoInfo.iv length is always 16. When the actual initialization vector
is shorter, zero out the trailing bytes.

Issue: #6982
PiperOrigin-RevId: 295575845
2020-02-17 17:40:30 +00:00
ibaker
0444e0b338 Add Util.toHexString
PiperOrigin-RevId: 295539969
2020-02-17 17:13:48 +00:00
aquilescanta
a1f666cb9d Make DrmInitData.SchemeData.uuid public
To ease implementation of MediaParser.

PiperOrigin-RevId: 294912244
2020-02-13 15:46:22 +00:00
olly
440468603a Add Format peak and average bitrate (hidden for now)
Issue: #2863
PiperOrigin-RevId: 294531127
2020-02-13 15:44:03 +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
olly
c7b6a2e045 DataSpec: Add customData field.
PiperOrigin-RevId: 294520836
2020-02-13 15:43:45 +00:00
olly
14d3ed09d5 Add DataSpec.Builder
PiperOrigin-RevId: 294518763
2020-02-13 15:43:35 +00:00
Fillmore, Christopher
d94a40ac77 Add responseBody field to InvalidResponseCodeException
Issue #6853

Previously the body of an HTTP response was not included in an
InvalidResponseCodeException. This change adds a field to store
the response body, and updates DefaultHttpDataSource to populate
this value.
2020-02-12 16:40:47 -05:00
olly
147f70bf5b Format: Move language into common fields section
Language is already applicable to image formats as well.
It can also apply to video formats. For example when the
video contains burnt in subtitles. Also, some animation
studios produce multiple variants of animations, in which
text within the scene itself (e.g., a signpost) is
replaced to be language specific.

PiperOrigin-RevId: 294500227
2020-02-11 22:10:35 +00:00
olly
39c65c658e DataSpec: Make DataSpecTest more useful
- Replace tests specific to HTTP request headers with tests that
  more generally test constructor correctness.
- Add test specifically around the constructor that infers the
  HTTP method from postBody, since that's a non-trivial bit of
  constructor logic.

Note: In general, I'm not sure this type of test (i.e., testing a
bit of trivial copying through a constructor) is worth the cost
of writing and maintaining them. That said, checking the new
uriPositionOffset is calculated correctly is non-trivial, as is
the HTTP method inference, so keeping them for now.
PiperOrigin-RevId: 294488684
2020-02-11 22:10:26 +00:00
olly
829282fa12 Replace DataSpec.absoluteStreamPosition with uriPositionOffset
This is a preliminary step toward adding a DataSpec.Builder,
which is needed for sanity when adding DataSpec.customData.

The existing absoluteStreamPosition field is very error prone,
because anyone using a Builder to adjust the request position
will need to remember to adjust two values:

dataSpec
    .buildUpon()
    .setAbsoluteStreamPosition(x)
    .setPosition(x)
    .build();

Furthermore, the difference between position and
absoluteStreamPosition is irrelevant in nearly all cases. In
the core library, the difference is only relevant when initializing
AES encryption/decryption to write/read cache files.

Replacing absoluteStreamPosition with uriPositionOffset will
simplify the code block above to:

dataSpec
    .buildUpon()
    .setPosition(x)
    .build();

PiperOrigin-RevId: 294485644
2020-02-11 22:10:17 +00:00
christosts
5725acb789 Defer MediaCodec queueing to background thread
The DedicatedThreadAsyncMediaCodecAdapter supports enqueueing
input buffers in a background Thread.

PiperOrigin-RevId: 294202744
2020-02-11 17:11:50 +00:00
olly
7d19a85c59 DataSpec: Cleanup
PiperOrigin-RevId: 294183213
2020-02-11 17:11:19 +00:00
krocard
9875c5d2b4 AudioCapabilities: Missing int class annotation
PiperOrigin-RevId: 293565660
2020-02-11 17:09:23 +00:00
olly
8ac5698aac Remove deprecated Format.createSampleFormat
PiperOrigin-RevId: 292888026
2020-02-03 14:44:56 +00:00
ibaker
b6bd57ab12 Replace most usages of @TargetApi with @RequiresApi
We keep @TargetApi where the method is a safe no-op on
older versions due to an in-line version check.

PiperOrigin-RevId: 292878727
2020-02-03 11:21:21 +00:00
olly
3a702cf53a Change Format.createTextSampleFormat for common uses cases
PiperOrigin-RevId: 292863614
2020-02-03 11:20:56 +00:00
olly
0be3451c39 Change Format.createImageSampleFormat for common use case
PiperOrigin-RevId: 292570360
2020-02-03 11:20:40 +00:00
olly
a7c6cb4abb Add some missing local @Nullable annotations
PiperOrigin-RevId: 292564056
2020-02-03 11:20:31 +00:00
olly
d287e13d9e Add Format.createSampleFormat for common use case
PiperOrigin-RevId: 292562678
2020-01-31 17:52:51 +00:00
olly
04218bdeb8 Remove deprecated Format constructors
PiperOrigin-RevId: 292554283
2020-01-31 17:52:42 +00:00
aquilescanta
6377e277c7 Move DrmSession into the core module
PiperOrigin-RevId: 292112214
2020-01-30 19:30:12 +00:00
olly
9161fe2328 Make LongArray tests a bit more concise
This also makes them look more like the equivalent tests for
the list / array cases.

PiperOrigin-RevId: 291890150
2020-01-28 16:55:59 +00:00
aquilescanta
bb9b3fd45e Fix some typos
PiperOrigin-RevId: 291750515
2020-01-28 16:55:41 +00:00
Pierre-Hugues Husson
1d65afdd16 Add minimal support of DVB AIT
This is used by broadcast channels to provide interactive contents.
2020-01-28 16:07:02 +01:00
kimvde
accbc5bba5 Add binarySearchFloor() for LongArrays
PiperOrigin-RevId: 291397882
2020-01-27 11:05:03 +00:00
andrewlewis
91517dc957 Split out extractor and common modules
PiperOrigin-RevId: 291378636
2020-01-24 18:15:19 +00:00