801 Commits

Author SHA1 Message Date
olly
d533a83ae4 Partial revert of DRM fixes
----------------------------------
Original change description:

DRM fixes

- Parse multiple kids from default_KID. It's specified as a whitespace
  separated list of UUIDs rather than a single UUID.
- Opportunistically proceed with playback in cases where the manifest
  only defines a single SchemeData with the common PSSH UUID. In such
  cases the manifest isn't saying anything about which specific DRM
  schemes it supports.

Issue: #3630

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181137621
2018-01-15 11:27:48 +00:00
olly
73892f21b1 Ubernit line re-order
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181137491
2018-01-15 11:26:22 +00:00
tonihei
c991b80c85 Rmeove unused variable in Mp4Extractor and HeifExtractor.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181135589
2018-01-15 11:24:57 +00:00
tonihei
4867748c50 Add assertions to check that media sources are not prepared twice.
This lets apps fail-fast when they try to reuse media source instances.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180934445
2018-01-15 11:23:31 +00:00
eguven
4b018b4d19 Document how unset length request are cached
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180929422
2018-01-15 11:22:07 +00:00
eguven
373935aeb6 Make CacheDataSource detect cache availability change
In certain conditions CacheDataSource switch to reading from upstream
without writing back to cache. This change makes it detect the change of
these conditions and switch to reading from or writing to cache.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180901463
2018-01-15 11:16:25 +00:00
Drew Hill
aaf469ce06 code review changes and fix for discontinuity 2018-01-14 11:00:32 -05:00
Drew Hill
821ea0e58b moved floatresample into defaultaudiosink and added new constructor in defaultaudiosync to use that resample when audio input is 24/32bit pcm and the new flag is enabled 2018-01-06 00:26:18 -05:00
Drew Hill
ca0c090c1a add support in mediacodecaudiorenderer for 24bit pcm to float 2018-01-05 23:31:38 -05:00
Drew Hill
b610e11443 PGS subtitle decoding support 2018-01-05 23:10:51 -05:00
andrewlewis
c89cc81b71 Configure MediaCodecs for realtime priority
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180782164
2018-01-04 15:55:27 +00:00
andrewlewis
8e8e53c42d Add support for Dolby TrueHD passthrough
Issue: #2147

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180678595
2018-01-04 15:50:59 +00:00
olly
7314e9bddc DRM fixes
- Parse multiple kids from default_KID. It's specified as a whitespace
  separated list of UUIDs rather than a single UUID.
- Opportunistically proceed with playback in cases where the manifest
  only defines a single SchemeData with the common PSSH UUID. In such
  cases the manifest isn't saying anything about which specific DRM
  schemes it supports.

Issue: #3630

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180675056
2018-01-04 15:49:34 +00:00
tonihei
2bc734afec Replace message delay with send at time in playback loop.
This removes the need to calculate the time needed to run the doSomeWork
method. Consequently, we can use both the real Clock/Handler and the
FakeClock without changing the way the playback loop works and without
violating the interfaces of Clock or Handler.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180665647
2018-01-04 15:48:11 +00:00
olly
7b9f71b44d Don't kill the process if SimpleDecoder.decode throws.
Issue: #3645

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180659855
2018-01-04 15:44:00 +00:00
eguven
d3ba207a4b Refactor CacheDataSource
Simplified and clarified the code.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180649983
2018-01-04 15:39:36 +00:00
olly
bf3d6028fa Make SsaDecoder more robust against malformed content
Issue: #3645

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180559196
2018-01-03 13:34:36 +00:00
olly
0821f578e8 Remove HandlerWrapper.Factory
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180558741
2018-01-03 13:34:36 +00:00
tonihei
22f8ee37d4 Clean-up of player message handling.
Some readability fixes for PlayerMessage and the handling in
ExoPlayerImplInternal.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180544294
2018-01-03 13:34:36 +00:00
olly
88abb153bb Force audio renderers to report same position when not started
Whilst the previous behavior was WAI and had the advantage of
updating the position to be more exact when known, there were
a couple of disadvantages:

1. If seeking to the very end of a period in a playlist when
   paused, the position adjustment could trigger a position
   discontinuity to the next period.
2. We de-duplicate seeks to the current playback position.
   The position adjustment can prevent this from being
   effective. This is particularly important with the new
   SeekParameters support. When seeking to nearest sync point
   it's often possible to de-duplicate seeks, but we cannot
   do so if the playback position adjusts away from the sync
   point's time.

Issue: #2439
Issue: #2882

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180540736
2018-01-03 13:34:36 +00:00
tonihei
ad80784c19 Fix parameter order in DefaultLoadControl constructor.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180254437
2018-01-03 13:34:36 +00:00
tonihei
410e614cfd Run custom messages executed on playback thread immediately.
This ensures message order if multiple custom messages running on the
playback thread and direct player commands are called immedately after
each other.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179925852
2018-01-03 13:34:36 +00:00
andrewlewis
f2bb2d27be Add support for extracting 32-bit float WAVE
Issue: #3379

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179925320
2018-01-03 13:34:36 +00:00
tonihei
61b9e846a8 Allow setting a Clock for the main playback thread.
This allows to inject a FakeClock for tests. Other playback components
(e.g. some media sources) still use SystemClock but they can be amended
in the future if needed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179921889
2018-01-03 13:34:36 +00:00
tonihei
c6529344db Introduce Handler interface allowing to switch to other Handlers.
Especially this removes the need for the Clock interface to directly
implement Handler methods. Instead, we have a separate Handler interface
and the FakeClock is able to construct such a Handler.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179918255
2018-01-03 13:34:36 +00:00
hoangtc
35d4cbf99f Fix a bug that makes ClippingMediaSource not stop in some occasions.
If ClippingMediaSource contains a child MediaSource with embedded metadata
stream, and the embedded stream is being used, it can lead to
ClippingMediaSource not be able to stop after the clipping end point. The
reason being the metadata stream cannot read anymore sample, but it's also not
end of source at that point. This CL fix this by changing the condition to
check if the child stream cannot read anymore sample and it has read past the
clipping end point.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179918038
2018-01-03 13:34:36 +00:00
olly
6f4110f3f8 Fix buffer re-evaluation edge cases
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179917833
2018-01-03 13:34:36 +00:00
tonihei
ec71c05e8b Add possiblity to send messages at playback position.
This adds options to ExoPlayer.sendMessages which allow to specify a window index
and position at which the message should be sent. Additionally, the options can be
configured to use a custom Handler for the messages and whether the message should
be repeated when playback reaches the same position again.

The internal player converts these window positions to period index and position
at the earliest possibility. The internal player also attempts to update these
when the source info is refreshed. A sorted list of pending posts is kept and the
player triggers these posts when the playback position moves over the specified
position.

Issue:#2189

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179683841
2018-01-03 13:34:36 +00:00
tiffanywong
3b633f81b2 Automated g4 rollback of changelist 179563355.
*** Original change description ***

Add possiblity to send messages at playback position.

This adds options to ExoPlayer.sendMessages which allow to specify a window index
and position at which the message should be sent. Additionally, the options can be
configured to use a custom Handler for the messages and whether the message should
be repeated when playback reaches the same position again.

The internal player converts these window positions to period index and position
at the earliest possibility. The internal player also at...

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179666357
2018-01-03 13:34:36 +00:00
tonihei
6c2d1e1966 Add possiblity to send messages at playback position.
This adds options to ExoPlayer.sendMessages which allow to specify a window index
and position at which the message should be sent. Additionally, the options can be
configured to use a custom Handler for the messages and whether the message should
be repeated when playback reaches the same position again.

The internal player converts these window positions to period index and position
at the earliest possibility. The internal player also attempts to update these
when the source info is refreshed. A sorted list of pending posts is kept and the
player triggers these posts when the playback position moves over the specified
position.

Issue:#2189

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179563355
2018-01-02 21:36:07 +00:00
olly
539d291fce Fix some lint/analyze errors
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179406910
2018-01-02 21:30:14 +00:00
olly
d9bee4d29c Bump version to 2.6.1
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179227114
2017-12-15 20:47:57 +00:00
olly
0287f13c0a Fix analyze/lint errors
- Lint doesn't like a static import of something not available on
  the minimum API level.
- The method linked to in the Javadoc was incorrect (wrong signature).
  I couldn't really work out why it was there, so I got rid of it
  rather than updating.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179222587
2017-12-15 20:27:20 +00:00
olly
3cc08d0ea3 Fix typo
Issue #3594

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179167738
2017-12-15 12:13:56 +00:00
tonihei
edbb979551 Allow to configure maximum buffer size in DefaultLoadControl.
This adds a parameter to configure a maximum buffer size in bytes. If left
at its default of C.LENGTH_UNSET, the target buffer is determined using a
overridable method based on the track selection. Also adding a parameter
to decide whether to prioritize time or size constraints.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179048554
2017-12-15 12:09:45 +00:00
aquilescanta
0ccf816a5c Add a bitmask for text tracks' selection flags in DefaultTrackSelector
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179039563
2017-12-15 12:07:01 +00:00
olly
37a275f67e Enable SeekParameters functionality for ExtractorMediaSource
Also fix ClippingMediaSource to consider the start position an
artificial key-frame, and to properly offset the value returned
by getAdjustedSeekPositionUs.

Issue: #2882

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179032243
2017-12-15 12:05:41 +00:00
tonihei
a17375b7d3 Resend playback info update when skipping very short periods.
Skipping short periods in a while loop is conceptually a new operation
and thus we need to send out the updated playback info in between for
the listeners to receive multiple period transition discontinuities.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=179027334
2017-12-15 12:04:20 +00:00
olly
073c92ed36 Don't send playback info updates when released.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178916145
2017-12-15 12:01:37 +00:00
tonihei
2cbf0ef0ab Move playback state, isLoading, and track selector result to PlaybackInfo.
This is a no-op change replacing the local variables in ExoPlayerImplInternal
with the new ones in PlaybackInfo.

***
Use playbackState, isLoading and trackSelectorResult from playbackInfo in ExoPlayerImpl.

***
Move duplicated listener notification in ExoPlayerImpl to new method.

Also split reset method in one parts which creates the new playback info
and one part which notifies the listeners. The increment of the pending
operation counter needs to happen in between.

***
Use only one pending operation counter in ExoPlayerImpl.

This also allows to move onSeekProcessed into the notification chain.

***
Replace playback info changing messages to ExoPlayerImpl by single message type.

As they are all handled in the same way, they can be summarized to one message.

***
Only send playback info change notifications once per playback thread message.

This ensures that all concurrent changes actually reach ExoPlayerImpl concurrently.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178907165
2017-12-15 12:00:16 +00:00
olly
a5cd0b87bc Update SingleSampleMediaSource with factory/listener changes
- Convert the Builder into a Factory
- Have it use MediaSourceEventListener
- Also made some misc related fixes to other sources

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178906521
2017-12-15 11:58:48 +00:00
tonihei
318618d7a2 Fix seek/prepare/stop acks when exception is thrown.
1. The player doesn't acknowledge phantom stops when an exception is thrown anymore.
2. It also makes sure it doesn't reset the pendingPrepareCount unless it's actually
immediately acknowledging these prepares.
3. It ensures a seek is acknowledged even though an exception is thrown during seeking.

Added tests (which previously failed) for all three cases.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178876362
2017-12-13 12:53:39 +00:00
andrewlewis
a4ae206ebe Support non-extractor ads in AdsMediaSource and demo apps
Issue: #3302

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178615074
2017-12-12 19:17:58 +00:00
olly
2e3667eeff Expose ability to get adjusted seek position from MediaPeriod
Issue: #2882

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178606133
2017-12-12 19:16:34 +00:00
andrewlewis
8c7fe8a258 Make ExtractorMediaSource.Builder a factory for ExtractorMediaSources
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178605481
2017-12-12 19:15:14 +00:00
andrewlewis
f8834dacc6 Use surfaceless context in DummySurface, if available
Issue: #3558

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178604607
2017-12-12 19:12:35 +00:00
andrewlewis
e419154b86 Make DashMediaSource.Builder a factory for DashMediaSources
This is in preparation for supporting non-extractor MediaSources for ads in
AdsMediaSource.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178377627
2017-12-12 19:08:25 +00:00
olly
2b0b39ca38 Public API for setting seek parameters
Issue: #2882

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178370038
2017-12-12 19:05:42 +00:00
olly
fede9c39c6 Treat captions that are wider than expected as middle aligned
Issue: #3534

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178364353
2017-12-12 19:04:22 +00:00
olly
439c3022d9 Blacklist Moto Z from using secure DummySurface.
Issue: #3215

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178218535
2017-12-12 18:57:25 +00:00