520 Commits

Author SHA1 Message Date
andrewlewis
117dd6f33f Mark optional parameters @Nullable
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193530582
2018-05-07 05:39:18 +01:00
olly
d4aceef8a8 Add getPlaybackError to Player/ExoPlayer interface
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193400443
2018-05-07 05:31:37 +01:00
hoangtc
fb5e31d3d6 Simplify logic to handle FLAC files with ID3 header.
LibFlac internally can skip ID3 tags correctly. Therefore, we don't need to keep track of the whole ID3 header section and skip through this section in Java code. We can just set the whole stream to the native library, and it will handle skipping ID3 tags correctly.

The only thing that the Java part need to do is peeking and parsing ID3 tags (if present), in order to populate the track format metadata.

GitHub: #4055.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193327602
2018-05-07 05:30:29 +01:00
olly
e99b8802eb Update translations
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193044028
2018-05-07 05:27:02 +01:00
olly
45ed7c304c Update moe equivalence
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=193016758
2018-05-07 05:25:36 +01:00
Oliver Woodman
d4eb2e5b85 Resync internal/external codebases 2018-04-16 11:36:59 +01:00
hoangtc
0b0868889e Supports FLAC files with high sample rate (176400 and 192000).
Also add testing media to verify FLAC extension can play these sample rates.

Github: #3769.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192783193
2018-04-16 10:51:50 +01:00
andrewlewis
fdbf16ed6d Allow setting the ad media load timeout in ImaAdsLoader
Issue: #3691

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192769801
2018-04-16 10:50:32 +01:00
aquilescanta
10d727e810 Use misc status code string when a Cast status code description is not available
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192609475
2018-04-16 10:36:07 +01:00
andrewlewis
ee8fc74d65 Update IMA to 3.8.5 and Play Services to 12.0.0
Issue: #3911

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192404702
2018-04-16 10:29:23 +01:00
ojw28
d075945487
Merge pull request #3977 from Khang-NT/dev-v2
Remove duplicate code MediaSessionConnector.java
2018-04-11 00:33:31 +01:00
hoangtc
986095a4a3 Support FLAC files with ID3 headers.
Support parsing ID3 tags at the beginning of FLAC files, even though FLAC spec
does not require this.

GitHub: #4055.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=192127929
2018-04-11 00:28:35 +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
tek
26cb32ab6a Migrating to new "android" handler from deprecated "androidlocalizer".
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191788495
2018-04-08 16:39:57 +01:00
tonihei
6b82d1c2bd Add setters to MediaSource factories for custom window tag.
This field (formerly "id") is almost impossible to use so far. Having setters
in the factories allows to specify custom tags for all media sources.

Also added a ExoPlayer.getCurrentTag() method to retrieve the tag of the
currently playing media source in a convenient way.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191738754
2018-04-07 19:12:21 +01:00
olly
cb01b281df Add proguard configuration for Cast extension
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191422866
2018-04-03 15:43:53 +01:00
olly
c861b506a3 OkHttp extension - Improved configuration
- Upgrade to latest version
- Use api dependency, since application code that uses the
  extension more has to use OkHttp directly to make an
  OkHttpClient instance
- Add proguard configuration

Issue #4059

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191422594
2018-04-03 15:42:26 +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
olly
4c69826b9c Actually use IMA proguard configuration (oops!)
Issue: #3723

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=191407560
2018-04-03 15:29:01 +01:00
andrewlewis
8d47209a46 Make video playback smoother at the beginning
Video renderers assume that the player position is advancing linearly while in
the started state. MediaCodecVideoRenderer schedules frames for rendering in the
future in the expectation that the player position is advancing.

This assumption is not currently true when using a position from the AudioTrack:
the player position can be fixed for (in the worst case) up to about 100 ms
before it starts increasing. This leads to an effect where the first frame is
rendered then a few other frames are rendered, then there's a pause before
frames start being rendered smoothly.

Work around this issue by checking whether the position has started advancing
before scheduling frames to be rendered in the future.

It might be preferable to make the audio renderer only become ready when its
timestamp can start advancing, but this is likely to be complicated.

Issue: #3841

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190937429
2018-03-29 17:55:01 +01:00
andrewlewis
78ff4af6a7 Clean up AudioProcessor implementations
- Ensure that no memory is used by audio processors that are always inactive, by
  only allocating in flush() if active. If data was already allocated but a
  processor becomes inactive we assume that the allocation may be needed in
  future so do not remove it (e.g., in the case of ResamplingAudioProcessor).
- Make SilenceSkippingAudioProcessor set up its buffers in flush(), and clarify
  that it is always necessary to call flush() if configure() returns true.
- Make reset() reset all state for all processors.
- Use @Nullable state or empty arrays for inactive audio processor buffers.
- Miscellaneous style/consistency cleanup.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190895783
2018-03-29 13:47:19 +01:00
olly
0989f272f2 Fix "FLAC decoder input buffer too small" issue
Issue: #3514

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190752950
2018-03-29 13:32:05 +01:00
tonihei
11dbe6d04b Update Ffmpeg README with supported NDK versions disclaimer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=190751660
2018-03-29 13:30:24 +01:00
bachinger
6674f63b8b Omit fast forward and rewind actions when current window is not seekable
Issue: #4001

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=189722812
2018-03-28 00:12:21 +01:00
Khang Nguyen
41d8aa8e54 Remove duplicate code MediaSessionConnector.java
Fix updateMediaSessionMetadata() called twice;
2018-03-12 19:48:52 +07:00
andrewlewis
e9f36f06ec Force rendering a frame every 100 ms
Also remove logic for tracking the next output buffer in LibvpxVideoRenderer, as
this allowed many consecutive frames to be rendered that were actually late
after dropping to keyframe. It looks better to show frames at a consistent
100 ms rate.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188144739
2018-03-07 15:32:35 +00:00
bachinger
ae421bb50c Add separate interface RatingCallback to handle user ratings.
To support Google Assistant media apps need to support the action
ACTION_SET_RATING. Before this change developers have to use a QueueEditor for
this which does not have any other mandatory actions required for Assistant.
With this change developers can implement the rating action with the
PlaybackPreparer which they need to implement anyway to support Assistant.

https://developer.android.com/guide/topics/media-apps/interacting-with-assistant.html#transport_controls

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188056722
2018-03-07 15:29:17 +00:00
olly
73048f18c1 Remove "r" from instructions for extension modules
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=188038757
2018-03-07 15:24:33 +00:00
jschlag
cc48b5568c handle errors from vpx_codec_control_ calls in vpx_jni
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187872692
2018-03-07 15:16:28 +00:00
olly
73b6b20fa3 Improve decoder retention logic.
1. Allow retaining a decoder without any reconfiguration, in addition
   to retaining with reconfiguration (and not retaining)
2. Fix retention logic for video decoders to take into account changing
   ColorInfo
3. Allow retention of audio decoders when possible

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187500285
2018-03-02 09:27:48 +00:00
tonihei
75c3bfb55c Rename Listener for timeline update to avoid confusion with MediaSourceEventListener.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187313128
2018-03-02 09:21:28 +00: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
2f4a3d2e5d Replace ConcatenatingMediaSource with DynamicConcatenatingMediaSource.
The non-dynamic media source has a strict subset of features of the dynamic one and
thus can be replaced.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187299432
2018-03-02 09:16:00 +00:00
tonihei
b2c445776a Allow parallel reuse of media sources.
This is achieved by adding a BaseMediaSource which keeps a reference count of the
number of times the source has been prepared and forwards to the actual implementations
only once, such that only minimal changes are needed for each media source.

Issue:#3498

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187186691
2018-03-02 09:08:28 +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
olly
099cc384a8 Move scheduler into its own top level package
The util package is, in practice, for things that are misc enough
to not warrant their own package. If something is deserving of a
package, it's IMO best placed somewhere else (I know you could
argue it's a util, but you could argue that about almost anything
else as well).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187010018
2018-02-26 15:41:18 +00:00
andrewlewis
c4f82514bf Fix ImaAdsMediaSource isTopLevelSource
AdsMediaSource must be top-level. Currently the (deprecated) ImaAdsMediaSource
can't be used because it prepares its contained AdsMediaSource as a child
source.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186990882
2018-02-26 15:41:18 +00:00
olly
fba2b46a8b Fix bad @see Javadoc in CastPlayer
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=186305613
2018-02-20 16:29:55 +00:00
andrewlewis
56c9d023fa Fix content progress updates and position faking
Occasionally the player could transition from playing content to playing an ad
after IMA called playAd. The discontinuity triggered faking the content
position, and the fake position was passed to IMA when content resumed causing
the wrong ad group to be loaded. Fix this by only faking the position if the
player transitions before playAd.

Also fix the calculation of the expected ad group index for a postroll ad, and
wait for the player to transition back from ad to content before passing a
content progress update.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185994229
2018-02-19 13:21:53 +00:00
andrewlewis
6c3b677ddb Catch exceptions in all IMA callbacks
If an exception is thrown in an IMA callback it crashes the process with lots of
logging from WebView (including several stack traces, etc.). This change wraps
ImaAdsLoader code that might throw, skips any remaining ads (as the errors are
not recoverable, in general) and notifies a new load error callback so that the
application can implement its own handling. The intention is to make the loader
robust to unexpected requests from IMA and avoid crashes.

Also handle IMA loading an ad in an ad group that has no available ads. In rare
cases IMA will try to load an ad for which an error was previously notified, so
this drops those load requests allowing playback of the content to continue.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185985850
2018-02-19 13:20:15 +00:00
andrewlewis
0291bc5e2d Fix content progress reporting if there is no preroll
If there was no preroll and the pending content position was set before the
first midroll, the pending content position was never cleared so loading the ad
was never triggered.

Only set a pending content position if we know that we need to trigger playing
an ad for the current position and IMA will poll for an ad (because there is a
midroll ad group). Clearing the pending content position happens when IMA pauses
content to play the ad.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185818315
2018-02-16 12:09:03 +00:00
andrewlewis
344932af75 Fix handling of ad group load errors
IMA sometimes delivers an ad group load error just after the time of the ad
group, which is problematic now that we set the expected ad group index based on
the last returned content progress.

Only update the expected ad group index once we are within a fixed preloading
threshold of the next ad.

Also fix updating the ad group to use the new ad count, and check for ad group
load errors when we have no expected ad group defensively.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185803086
2018-02-16 12:07:43 +00:00
andrewlewis
da08b65f3b Fix handling of ad tags with only preroll and postroll ads
Content progress is only polled if there are midroll ad groups. If the ad tag
had only preroll/postroll ads, the pending content position was not provided to
IMA, which meant that the postroll ad could never play.

Only set the pending content position if there are midroll ads.

Issue: #3715

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185680803
2018-02-16 12:05:07 +00:00
andrewlewis
43cfb08207 Handle VAST_LINEAR_ASSET_MISMATCH
This error marks the current ad group as unplayable.

Issue: #3801

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185663472
2018-02-16 11:57:22 +00:00
andrewlewis
5b6344a006 Skip ads for which the media failed to prepare
Also make ad group skipping more robust. After calling onError for an ad, IMA
will sometimes trigger an ad group load error, so this needs to be handled in a
way that allows some ads to be loaded already for the ad group.

This change also fixes calculation of the expected ad index to take into account
whether the position is being faked to trigger loading an ad or is the actual
player position.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185655844
2018-02-16 11:55:02 +00:00
andrewlewis
4cb2d255ab Fix handling of ad tags where ad groups are out of order
IMA's cue points may not be in order, so sort them. It looks like IMA events use
time ordered ad indices, so it is not necessary to map between the original cue
point order and the time order.

Issue: #3716

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185495798
2018-02-16 11:48:58 +00:00
olly
77ec24ca58 Translation console import
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185409304
2018-02-16 11:47:49 +00:00
tonihei
c14ef75037 Move (almost all) remaining core library instrumentation tests to Robolectric.
There are 4 tests which can't currently be moved:
 - DownloadManagerTest explicitly uses the main looper which isn't easily
   supported because the test runs on this thread.
 - ContentDataSourceTest uses an AssetFileDescriptor which wraps a
   ParcelFileDescriptor. It seems Robolectric doesn't correctly forward the
   inner wrapped file descriptor leading to NPE.
 - CacheContentIndexTest and SimpleCacheSpanTest both work fine with Gradle
   but fail with seemingly valid test failures on Blaze.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185366678
2018-02-16 11:46:34 +00:00
andrewlewis
b6a46fd3ee Set the expected ad group based on the content position
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=185139106
2018-02-16 11:44:29 +00:00