3715 Commits

Author SHA1 Message Date
eguven
eda408dc09 Move inflate method to Util class
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207857927
2018-08-13 13:41:32 +01:00
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
ca473c86c7 Simplify DefaultDataSourceChain to use addTransferListener
Also locally cache length in BaseDataSource and use zero cost
castNonNull to make sure there's no performance regression.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207715734
2018-08-07 16:29:18 +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
andrewlewis
829f55e9cd Make AudioCapabilities constructor public
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207707035
2018-08-07 16:25:58 +01:00
olly
cab1d02c0c Allow setting constant bitrate flags in DefaultExtractorsFactory
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207566605
2018-08-07 16:25:01 +01:00
olly
ecee873b64 Mini cleanup of improved seeking support for release
* Make dedicated section in RELEASENOTES
* Clean up AMR FACTORY

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207550281
2018-08-06 17:18:51 +01:00
olly
dc8dc0e392 Declare all InternalState values in switch statement
Lint likes all constants for an IntDef to be declared explicitly
in switch statements.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207545682
2018-08-06 17:18:51 +01:00
olly
44101fc00b Use shifting for flag constants
Lint likes flags to be declared in this way, for safety, apparently

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207545382
2018-08-06 17:18:51 +01:00
hoangtc
077f2c3036 Supports seeking for TS Streams.
This CL adds support for seeking witin TS streams by using binary search. For
any seek timestamp, it tries to find the location in the stream where PCR
timestamp is close to the target timestamp, and return this position as the
seek position.

Github: #966.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207529906
2018-08-06 14:35:12 +01:00
olly
7fcd6b6d65 Minimal fix for non-default cenc name prefixes in DASH manifests
For now, just allow any prefix (and don't check the namespace).
Checking the namespace requires turning on the XmlPullParser
namespace awareness feature, but this can only be done before
parsing, and I think requires us to specify the namespace when
querying other attributes. This would also risk breaking services
who currently don't set namespaces correctly.

It's possible we'll run into similar issues with the few other
tags (e.g. mspr:pro). We should revisit enabling namespace
awareness if/when we see this.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207526883
2018-08-06 13:25:33 +01:00
aquilescanta
18d2a2ea2a Use LoadErrorHandlingPolicy in SingleSampleMediaSource
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207525746
2018-08-06 13:24:15 +01:00
eguven
bf6b647088 Rename spherical/Utils class to GlUtil
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207525621
2018-08-06 13:22:51 +01:00
olly
454b106921 Fix freezing playing multi-period DASH with EventStreams
EventSampleStream.readData required eventStreamUpdatable to be
false for END_OF_STREAM to be returned, but it was only being
set to false when the manifest became static. This change also
sets it to false if the period is not the last one in a dynamic
manifest. It also renames it the parameter to appendable, since
that's what it really represents. Events may still be removed
from the start of the EventStream as the period starts moving
out of the live window.

Issue: #4492

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207517265
2018-08-06 11:38:33 +01:00
hoangtc
c3d8ad2488 Add supports for Seeking in ADTS format using a constant bitrate seekmap.
- Use ConstantBitrateSeeker to implement seeking for ADTS format. Since most
ADTS streams are VBR, we use the average bitrate of the first 1000 frames as
the average bit rate.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207509651
2018-08-06 11:33:06 +01:00
andrewlewis
f3ad87d653 Update MP4RA URL
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207278934
2018-08-06 11:32:02 +01:00
hoangtc
0cdeb555d1 Use a custom video renderer for MetadataRetrieverImpl.
Currently, MetadataRetrieverImpl uses MediaCodecVideoRenderer to renderering
frames to capture. It suffers from 2 issues:
- MediaCodecVideoRenderer has a lot of logic to time frame release, including
drop frames if late or try to keep up with feeding speed etc... These are not
necessary at all for frame retrieval.
- MediaCodecVideoRenderer always tries to render 1 frame after video surface
update. This may some times lead to the wrong image being rendered for
MetadataRetriever.
This CL replaces this with a custom video renderer, that does not time frame
releases, and only render first frame after position reset / renderer
re-enabling.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207276937
2018-08-06 11:30:48 +01:00
andrewlewis
b3b8356766 Fix DefaultTimeBar accessibility class name
See https://support.google.com/accessibility/android/answer/7661305.

Also fix/suppress nullability warnings.

Issue: #4611

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207245115
2018-08-06 11:28:03 +01:00
olly
4c7fbd67ea Suppress WrongConstant lint error
The error is spurious, and is due to an incorrect annotation in
the framework.

[Internal: b/32137960]

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207234603
2018-08-06 11:26:39 +01:00
olly
f549cf5635 Fix Aes128DataSourceTest portability issue
For background on why doing this works, see below. I don't want to change
how we get our Cipher instance in non-test code, since PKCS7 always works
on Android. It's only when the tests are running on a non-Android host
machine that they can fail. An alternative would be to make it an androidTest,
but androidTests are slow.

------

Background:

"While Java considers PKCS5 and PKCS7 padding to be the "same" (and
one should always use the string "AES/CBC/PKCS5Padding" because
"AES/CBC/PKCS7Padding" will cause NoSuchAlgorithmException to be thrown
when initializing an AES block cipher using the Java crypto API), I
consider this a gross misnaming in the Java platform because the pure
technical definitions of these paddings are not the same."

Ref: https://stackoverflow.com/questions/10193567/java-security-nosuchalgorithmexceptioncannot-find-any-provider-supporting-aes-e

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207234518
2018-08-06 11:25:34 +01:00
jdong
2815ff1b02 Tiny cleanup: remove an extra "thread" in the comment for ExoPlayer interface.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207124509
2018-08-06 11:24:01 +01:00
aquilescanta
a7e9ebcf68 Build codecs string from SPS data in H.264
Issue:#4555

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=207096569
2018-08-06 11:22:37 +01:00
aquilescanta
cc2a8bb854 Fix encryption data extraction when default values should be used
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206963956
2018-08-06 11:19:51 +01:00
aquilescanta
d458b90cc7 Parameterize load error handling in ExtractorMediaSource
Issue:#2844
Issue:#3370
Issue:#2981

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206927295
2018-08-06 11:18:37 +01:00
olly
d0d6856725 Apply setOutputSurfaceWorkaround to required FireOS devices
Amazon like to use Device.MODEL, so key on that instead for
these workarounds.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206917935
2018-08-01 14:01:45 +01:00
hoangtc
0fbe083d4e Return empty track groups and track selections when user seeks to unprepared period
When user seeks to an unprepared period, since there is no period being played, currently the track groups and track selections are still the ones from previous period. This CL changes it so that when such seeking happens, PlaybackInfo's track groups and track selections are changed to empty.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206916109
2018-08-01 13:59:35 +01:00
eguven
45c1e9eef3 Add missing Nullable annotation Player.EventListener.onTimelineChanged
Issue: #4593

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206911927
2018-08-01 13:49:21 +01:00
andrewlewis
5715960304 Add Context to SimpleExoPlayer factory methods
This is needed for implementing (optional) support for audio focus handling in a
later change.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206899837
2018-08-01 13:49:21 +01:00
andrewlewis
429bf4d099 Expand passthrough channel count workaround to all devices
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206893078
2018-08-01 13:49:21 +01:00
hoangtc
f08ad55892 Supports seeking for MPEG PS Streams.
This CL adds support for seeking within PS streams by using binary search. For
any seek timestamp, it tries to find the location in the stream where SCR
timestamp is close to the target timestamp, and return this position as the
seek position.

Github: #4476.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206787691
2018-08-01 13:49:21 +01:00
hoangtc
377314a69f Remove unnecessary DefaultKeyStatus, DefaultKeyRequest and DefaultProvisionRequest.
Currently, we have KeyStatus, KeyRequest and ProvisionRequest as interface, so we can use
custom implementation for purpose such as wrapping native objects. However, these interfaces and the corresponding default classes are only used to bundle data, and in all existing implementation (including native code), it's just as efficient to just use the Java default implementation. Therefore we can just get rid of the interfaces, and change
the interfaces into classes with the default implementation.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206765389
2018-08-01 13:49:20 +01:00
andrewlewis
7ead310219 Use maximum bitrates for encoded output buffer sizes
There is some risk associated with this change, as audio track buffers come from
shared memory and limits may be device-specific. I've tested these sizes on
Nvidia Shield TV and Nexus Player on various builds. The maximum size allocated
is about 800 KB. We could implement support for retrying creating the audio
track if it fails to initialize, but it seems preferable to avoid the extra
complexity required to do that unless we know it's necessary to work around
device-specific limitations.

Issue: #3803

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206749222
2018-08-01 13:49:20 +01:00
eguven
02e9972630 Add 360 video samples to the demo app
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206747144
2018-08-01 13:49:20 +01:00
aquilescanta
9ec14d1ada Fix SCTE-35 timestamp adjustment
Issue:#4573

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206737252
2018-08-01 13:49:20 +01:00
andrewlewis
e2bf474c1e Extend Nexus Player mono workaround to Oreo
The platform fix was merged into O MR1, not O. Nexus Player has
not received this build.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206734342
2018-08-01 13:49:20 +01:00
andrewlewis
19d24ac633 Remove extra brackets
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206725219
2018-08-01 13:49:20 +01:00
andrewlewis
ded2b2eb2a Allow outputting audio to a WAV file
Add TeeAudioProcessor that doesn't modify the input audio but writes it to an
AudioBufferSink, and WavFileAudioBufferSink for writing audio to a .wav file.

This is intended to be used for diagnostics and debugging.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206717458
2018-08-01 13:49:20 +01:00
andrewlewis
68add98c23 Fix detection of TrueHD syncframe in MatroskaExtractor
MatroskaExtractor was checking for INDEX_UNSET as the sample count for buffers
not containing syncframes, but actually 0 was returned for these. Theoretically
this could prevent us starting to play a TrueHD stream as we wait until we can
read the sample count from a syncframe before accepting the audio in
DefaultAudioSink, but it seems that rechunking avoided this issue arising in
practice.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206575462
2018-08-01 13:49:20 +01:00
tonihei
656c2172dd Fix event reporting for merging and looping media sources.
The looping media source doesn't convert the media period id to the externally
visible media period id. And the merging media source reports media period
creations multiple times which will break listeners assuming a media period
with a specific id will only be created once.

Also amend the doc for MediaSource.createPeriod to reflect that media periods
created in parallel do not actually have the same id.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206327241
2018-08-01 13:49:20 +01:00
tonihei
a237ae1810 Fix period transition with non-zero start position.
Period transitions with non-zero start position happen too early as the
playing period is advanced as soon as the renderer offset is reached not
taking into account that the start position needs to be added to that.

Issue:#4583

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206310328
2018-08-01 13:49:20 +01:00
andrewlewis
6a2f94ec4b Document top-level limitation of AdsMediaSource
Issue: #4591

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206307948
2018-08-01 13:49:20 +01:00
andrewlewis
0c0c5942ab Fix incorrect channel configuration for 8 ch pre-M
AudioTrack checks the channel configuration against a mask of allowed channels.
Before Android M the check in getMinBufferSize would always fail for 8 channel
output.

For Android L constants are available to build the required channel
configuration for a conventional 7.1 setup and these constants are part of the
allowed channels mask, so switch to using them.

Before Android L the constants for 7.1 aren't in the allowed channels mask, so
discard channels to give a 5.1 stream.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206307892
2018-08-01 13:49:20 +01:00
eguven
30fecb71d2 Fix TouchTrackerTest
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206304655
2018-08-01 13:49:20 +01:00
aquilescanta
4eee474555 Remove minLoadableRetryCount from HLS components
Remove minLoadableRetryCount from HLS components in favor of
LoadErrorHandlingPolicy#getMinimumLoadableRetryCount.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206298419
2018-08-01 13:49:20 +01:00
tonihei
d3c2cb2aa4 Update remaining DataSource's with new addTransferListener method.
The new method allows to add TransferListeners after the DataSource
has been created. Most implementations just forward to their wrapped
upstream DataSource. Implementation which directly read data implement
BaseDataSource instead.

Also removes the temporary default no-op implementation in DataSource.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206289986
2018-08-01 13:49:20 +01:00
Oliver Woodman
3b61a400c5 Remove stray file 2018-07-26 19:06:33 +01:00
tonihei
133f5f16b8 Pass MediaPeriodId to DeferredMediaPeriod when actual period is created.
This helps to distinguish between the MediaPeriodId the deferred media period is being
created with and the MediaPeriodId which is used to create the actual underlying period.

This serves two purposes:
1. The error reporting of ad prepare errors uses the correct media period id (the
   externally visible ad media period id).
2. The transition to using media period uid instead of indices is simplified.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206160463
2018-07-26 18:27:46 +01:00
tonihei
49ef1f3f8c Fix nullness warnings in Util and Assertions, and provide own castNonNull.
Using our own no-op castNonNull prevents linking into checkerframeworks library.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206152148
2018-07-26 18:27:46 +01:00
andrewlewis
217247f113 Remove naming assumption for passthrough decoders
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206119357
2018-07-26 18:27:46 +01:00
andrewlewis
5da703a588 Fix some nullness warnings in audio classes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206021873
2018-07-26 18:27:46 +01:00