4663 Commits

Author SHA1 Message Date
christosts
c3d6be3afd Add HTTP request parameters (headers) to DataSpec.
Adds HTTP request parameters in DataSpec. Keeps DataSpec behavior to be immutable as before.

PiperOrigin-RevId: 265087782
2019-09-02 14:37:24 +01:00
tonihei
46bf710cb3 Do not compare bitrates of audio tracks with different languages.
The last selection criteria is the audio bitrate to prefer higher-quality
streams. We shouldn't apply this criterium though if the languages of the
tracks are different.

Issue:#6335
PiperOrigin-RevId: 265064756
2019-09-02 14:37:12 +01:00
olly
7cefb56eda Update comment to indicate correct int value of "FLAG_ALLOW_CACHE_FRAGMENTATION" in ExoPlayer2 upstream DataSpec
Currently the value of FLAG_ALLOW_CACHE_FRAGMENTATION is defined as "1 << 4" but commented as "8". Either the value of FLAG_ALLOW_CACHE_FRAGMENTATION should be "1 << 3", or the comment should be 16. Here I am modifying the comment since it does not affect any current behavior.

PiperOrigin-RevId: 265011839
2019-09-02 14:36:05 +01:00
andrewlewis
886fe910a8 Avoid potential ArrayStoreException with audio processors
The app is able to pass a more specialized array type, so the Arrays.copyOf call
produces an array into which it's not valid to store arbitrary AudioProcessors.

Create a new array and copy into it to avoid this problem.

PiperOrigin-RevId: 264779164
2019-09-02 14:35:52 +01:00
ibaker
c60b355f9c Add support for the AOM scheme_id for ID3-in-EMSG
https://developer.apple.com/documentation/http_live_streaming/about_the_common_media_application_format_with_http_live_streaming

PiperOrigin-RevId: 264126140
2019-09-02 14:35:00 +01:00
ibaker
47e0580d80 Unwrap SCTE-35 messages in emsg boxes
PiperOrigin-RevId: 263768428
2019-09-02 14:34:35 +01:00
ibaker
d3d192e36e Extend EventMessage.toString to include durationMs
This field is used in .equals(), so it makes sense to include it in toString() too.

PiperOrigin-RevId: 263768329
2019-09-02 14:34:30 +01:00
ibaker
9ec346a2e1 Modify EventMessageDecoder to return null if decoding fails (currently throws exceptions)
This matches the documentation on MetadataDecoder.decode:
"@return The decoded metadata object, or null if the metadata could not be decoded."

PiperOrigin-RevId: 263767144
2019-09-02 14:34:19 +01:00
ibaker
5100e67c83 Support unwrapping nested Metadata messages in MetadataRenderer
Initially this supports ID3-in-EMSG, but can also be used to support SCTE35-in-EMSG too.

PiperOrigin-RevId: 263535925
2019-09-02 14:33:45 +01:00
ibaker
2de1a204e2 Add Metadata.toString that prints the contents of entries
entries are used in .equals(), so it's good to have them printed in toString() too (for test failures) and it makes logging easier too.

PiperOrigin-RevId: 263335503
2019-09-02 14:33:26 +01:00
ibaker
dcac4aa67f Add description to TextInformationFrame.toString() output
This field is used in .equals(), we should print it in toString() too

PiperOrigin-RevId: 263335432
2019-09-02 14:33:21 +01:00
tonihei
90b62c67fb Change default video buffer size to 32MB.
The current max video buffer is 13MB which is too small for high quality
streams and doesn't allow the DefaultLoadControl to buffer up to its default
max buffer time of 50 seconds.

Also move util method and constants only used by DefaultLoadControl into this
class.

PiperOrigin-RevId: 263328088
2019-09-02 14:33:14 +01:00
tonihei
a381cbf536 Make reset on network change the default.
PiperOrigin-RevId: 262886490
2019-09-02 14:32:54 +01:00
olly
921ff02c90 Only read from FormatHolder when a format has been read
I think we need to start clearing the holder as part of the
DRM rework. When we do this, it'll only be valid to read
from the holder immediately after it's been populated.

PiperOrigin-RevId: 262362725
2019-09-02 14:32:40 +01:00
ibaker
a08b537e8e Simplify EventMessageEncoder/Decoder serialization
We're no longer tied to the emsg spec, so we can skip unused fields
and assume ms for duration.

Also remove @Nullable annotation from EventMessageEncoder#encode, it
seems the current implementation never returns null

PiperOrigin-RevId: 262135009
2019-09-02 14:32:33 +01:00
ibaker
bb6b0e1a5a Expose a method on EventMessageDecoder that returns EventMessage directly
PiperOrigin-RevId: 262121134
2019-09-02 14:32:27 +01:00
tonihei
acdb19e99d Clean up documentation of DefaultTrackSelector.ParametersBuilder.
We don't usually refer to other classes when documenting method parameters
but rather duplicate the actual definition.

PiperOrigin-RevId: 262102714
2019-09-02 14:32:21 +01:00
tonihei
c4ac166f2f Add allowAudioMixedChannelCountAdaptiveness parameter to DefaultTrackSelector.
We already allow mixed mime type and mixed sample rate adaptation on request,
so for completeness, we can also allow mixed channel count adaptation.

Issue:#6257
PiperOrigin-RevId: 261930046
2019-09-02 14:32:10 +01:00
ibaker
9f486336be Migrate literal usages of 1000 to (new) C.MILLIS_PER_SECOND
This only covers calls to scaleLargeTimestamp()

PiperOrigin-RevId: 261878019
2019-09-02 14:31:21 +01:00
ibaker
97183ef558 Add inband emsg-v1 support to FragmentedMp4Extractor
This also decouples EventMessageEncoder's serialization schema from the emesg spec (it happens to still match the emsg-v0 spec, but this is no longer required).

PiperOrigin-RevId: 261877918
2019-09-02 14:31:15 +01:00
tonihei
d1ac2727a6 Update stale TrackSelections in chunk sources when keeping the streams.
If we keep streams in chunk sources after selecting new tracks, we also keep
a reference to a stale disabled TrackSelection object. Fix this by updating
the TrackSelection object when keeping the stream. The static part of the
selection (i.e. the subset of selected tracks) stays the same in all cases.

Issue:#6256
PiperOrigin-RevId: 261696082
2019-08-05 20:36:04 +01:00
tonihei
936a7789c9 Check if controller is used when performing click directly.
Issue:#6260
PiperOrigin-RevId: 261647858
2019-08-05 20:35:56 +01:00
olly
b0c2b1a0fa Bump annotations dependency
PiperOrigin-RevId: 261353271
2019-08-02 19:08:20 +01:00
olly
cd7fe05db7 Constraint seek targetGranule within bounds + simplify tests
PiperOrigin-RevId: 261328701
2019-08-02 17:31:26 +01:00
olly
f497bb9610 Move DefaultOggSeeker tests into a single class
PiperOrigin-RevId: 261320318
2019-08-02 17:31:20 +01:00
olly
3c8c5a3346 Fix DefaultOggSeeker seeking
- When in STATE_SEEK with targetGranule==0, seeking would exit
  without checking that the input was positioned at the correct
  place.
- Seeking could fail due to trying to read beyond the end of the
  stream.
- Seeking was not robust against IO errors during the skip phase
  that occurs after the binary search has sufficiently converged.

PiperOrigin-RevId: 261317035
2019-08-02 17:31:07 +01:00
andrewlewis
80bc50b647 Revert to using header bitrate for CBR MP3s
A previous change switched to calculation of the bitrate based on the
first MPEG audio header in the stream. This had the effect of fixing
seeking to be consistent with playing from the start for streams where
every frame has the same padding value, but broke streams where the
encoder (correctly) modifies the padding value to match the declared
bitrate in the header.

Issue: #6238
PiperOrigin-RevId: 261163904
2019-08-02 17:26:19 +01:00
Oliver Woodman
88b68e5902 Fix ExoPlayerTest 2019-08-01 21:06:56 +01:00
olly
f5e92134af Shorten data length if it exceeds length of input
Issue: #6241
PiperOrigin-RevId: 261126968
2019-08-01 21:05:24 +01:00
olly
6d20a5cf0c WavExtractor: Skip to data start position if position reset to 0
PiperOrigin-RevId: 260970865
2019-08-01 21:04:45 +01:00
olly
c373ff0a1c Don't print warning when skipping RIFF and FMT chunks
They're not unexpected!

PiperOrigin-RevId: 260907687
2019-08-01 21:04:37 +01:00
andrewlewis
7ec7aab320 Move E-AC3 workaround out of MediaCodecUtil
PiperOrigin-RevId: 244173887
2019-08-01 21:02:52 +01:00
olly
7162bd8153 Propagate non-standard MIME type aliases
Issue: #5938
PiperOrigin-RevId: 261150349
2019-08-01 21:01:12 +01:00
olly
23ace19369 Standardize ALAC initialization data
Android considers ALAC initialization data to consider of the magic
cookie only, where-as FFmpeg requires a full atom. Standardize around
the Android definition, since it makes more sense (the magic cookie
being contained within an atom is container specific, where-as the
decoder shouldn't care what container the media stream is carried in)

Issue: #5938
PiperOrigin-RevId: 261124155
2019-08-01 20:52:22 +01:00
olly
520275ec71 Make OggSeeker.startSeek take a granule rather than a time
PiperOrigin-RevId: 261102180
2019-08-01 20:52:15 +01:00
olly
740502103f Some no-op cleanup for DefaultOggSeeker
PiperOrigin-RevId: 261102008
2019-08-01 20:52:09 +01:00
bachinger
4438cdb282 return lg specific mime type as codec supported type for OMX.lge.alac.decoder
ISSUE: #5938
PiperOrigin-RevId: 261097045
2019-08-01 20:52:01 +01:00
Oliver Woodman
309d043cee Merge pull request #6239 from ittiam-systems:vorbis-picture-parse
PiperOrigin-RevId: 261087432
2019-08-01 20:51:40 +01:00
olly
e159e3acd0 Mp3Extractor: Avoid outputting non-zero position seek frame as a sample
Checking inputPosition == 0 isn't sufficient because the synchronization
at the top of read() may advance the input (i.e. in the case where there's
some garbage prior to the seek frame).

PiperOrigin-RevId: 261086901
2019-08-01 20:50:53 +01:00
olly
3e99e7af54 Clean up some Ogg comments & document granulePosition
PiperOrigin-RevId: 260947018
2019-08-01 20:50:37 +01:00
olly
b5ca187e85 Mp3Extractor: Avoid outputting seek frame as a sample
This could previously occur when seeking back to position=0

PiperOrigin-RevId: 260933636
2019-08-01 20:50:29 +01:00
olly
58e70e8351 Update javadoc for TrackOutput#sampleData to make it more clear that implementors aren't expected to rewind with setPosition()
PiperOrigin-RevId: 260718614
2019-08-01 20:49:45 +01:00
andrewlewis
f5980a54a3 Ensure the SilenceMediaSource position is in range
Issue: #6229
PiperOrigin-RevId: 260500986
2019-07-29 22:34:21 +01:00
olly
d76bf4bfca Bump version to 2.10.4
PiperOrigin-RevId: 260164426
2019-07-27 23:01:22 +01:00
andrewlewis
95d2988490 Fix handling of channel count changes with speed adjustment
When using speed adjustment it was possible for playback to get stuck at a
period transition when the channel count changed: SonicAudioProcessor would be
drained at the point of the period transition in preparation for creating a new
AudioTrack with the new channel count, but during draining the incorrect (new)
channel count was used to calculate the output buffer size for pending data from
Sonic. This meant that, for example, if the channel count changed from stereo to
mono we could have an output buffer size that stored an non-integer number of
audio frames, and in turn this would cause writing to the AudioTrack to get
stuck as the AudioTrack would prevent writing a partial audio frame.

Use Sonic's current channel count when draining output to fix the issue.

PiperOrigin-RevId: 260156541
2019-07-27 22:57:11 +01:00
Oliver Woodman
0b756a9646 Merge pull request #6042 from Timbals:dev-v2
PiperOrigin-RevId: 258812820
2019-07-26 17:01:18 +01:00
olly
78d6393213 Add A10-70L to output surface workaround
Issue: #6222
PiperOrigin-RevId: 260146226
2019-07-26 16:59:46 +01:00
tonihei
40fd11d9e8 Further language normalization tweaks for API < 21.
1. Using the Locale on API<21 doesn't make any sense because it's a no-op
   anyway. Slightly restructured the code to avoid that.
2. API<21 often reports languages with non-standard underscores instead of
   dashes. Normalize that too.
3. Some invalid language tags on API>21 get normalized to "und". Use original
   tag in such a case.

Issue:#6153
PiperOrigin-RevId: 258773463
2019-07-26 16:58:07 +01:00
tonihei
f82920926d Switch language normalization to 2-letter language codes.
2-letter codes (ISO 639-1) are the standard Android normalization and thus we
should prefer them to 3-letter codes (although both are technically allowed
according the BCP47).

This helps in two ways:
 1. It simplifies app interaction with our normalized language codes as the
    Locale class makes it easy to convert a 2-letter to a 3-letter code but
    not the other way round.
 2. It better normalizes codes on API<21 where we previously had issues with
    language+country codes (see tests).
 3. It allows us to normalize both ISO 639-2/T and ISO 639-2/B codes to the same
    language.

PiperOrigin-RevId: 258729728
2019-07-26 16:57:40 +01:00
aquilescanta
e181d4bd35 Fix DataSchemeDataSource re-opening and range requests
Issue:#6192
PiperOrigin-RevId: 258592902
2019-07-26 16:57:24 +01:00