725 Commits

Author SHA1 Message Date
olly
196f5f7917 Include P8 in setOutputSurfaceWorkaround
Also disable use of dummy surface for devices that require the
workaround. It's only useful in the case that we can use
setOutputSurfaceWorkaround, so if it's disabled the dummy surface
has no purpose (it actually makes things worse by consuming past
the key-frame prior to the current position, which doesn't happen
if you have no surface at all).

Issue: #3724

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182750068
2018-01-23 19:20:16 +00:00
eguven
b3d1635ac4 Fix CacheDataSource and SimpleCache issues
This fixes a very specific case where the data read has non-cached gaps
and a read-only CDS switches to read from upstream in a gap then the
cached data is deleted. When the CDS reaches the end of the gap, it
tries to open the next source. As there is no cached data, it tries to
continue with the already opened upstream data source but as it reached
end of the gap range, the code starts looping.

Also fixes infinite lock which occurs when in the previous case CDS isn't
readonly. It locks the content while filling the gap in the cache. At the
end of the gap, as the following data is deleted it tries to lock the
content for writing but the content is already locked by itself.

The last fix is preventing removal of CachedContent entry from
CachedContentIndex while associated key is locked.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182595426
2018-01-23 19:18:09 +00:00
tonihei
4ba17bb690 Remove potential flakiness from ExoPlayerTest caused by multi-threading.
Some tests in ExoPlayerTest issue commands to the player from the test thread
while the player is actively playing media (playWhenReady=true). Due to the
indeterminate time taken to enqueue the commands on the playback thread, they
may arrive when the player already proceeded to another window or finished
playback.

To ensure the tests are always deterministic, this change pauses playback in
the tests where this may happen before issuing the commands.
Also, for tests where we need to wait for a new window before issuing the
next command, a new action is added which allows to play until a specified
position.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182535096
2018-01-23 19:16:38 +00:00
aquilescanta
fe1e4fa1f2 Fix preparation of media sources with empty timeline
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182533415
2018-01-23 19:13:39 +00:00
tonihei
9de0123e84 When seeking while player is idle, ensure EPII's position is in sync with EPI.
As soon as the seek gets acknowledged by EPII, EPI returns the actual position
from the playback info again which is set by EPII. Thus, EPII needs to update
the position to reflect the changes expected by EPI.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182515106
2018-01-23 19:10:45 +00:00
olly
4828f275c7 Make play button behave differently in IDLE and ENDED states
- In IDLE, the button will now call a preparer. This allows
  removal of the separate retry button from the demo app.
- In ENDED, the button will seek back to the default position
  and play.
- Behavior is made consistent with LeanbackPlayerAdapter.

Issue: #3689

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182506855
2018-01-23 19:07:52 +00:00
tonihei
7cacbfedc5 Mitigate OOM at poorly interleaved Mp4 streams.
When determining the next sample to load, the Mp4Extractor now takes
into account how far one stream is reading ahead of the others.
If one stream is reading ahead more than a threshold (default: 10 seconds),
the extractor continues reading the other stream even though it needs
to reload the source at a new position.

GitHub:#3481
GitHub:#3214
GitHub:#3670

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182504396
2018-01-23 19:06:28 +00:00
olly
68387f98ee Simplify demo app by moving EventLogger into core
It seems good to have EventLogger available from the library.
In particular because when app developers use it and then
submit bug reports, it makes it much easier to work out what
happened. It will also allow EventLogger to be used across
our (now multiple) demo apps.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182389407
2018-01-23 19:03:31 +00:00
tonihei
029c95832c Add queue abstraction to ExoPlayerImplInternal.
This gets rid of the manual tracking of this queue with reading, playing,
and loading period holders. Still keeping these names for queue access methods.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182378944
2018-01-23 19:01:51 +00:00
olly
c577d9d351 Let SimpleExoPlayerView/LeanbackPlayerAdapter bind with any Player
Also sanitize naming (PlayerView/PlayerControlView).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182364487
2018-01-23 19:00:20 +00:00
aquilescanta
0697fb3955 Fail on HLS+TS loss of sync
Issue:#3632

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182202289
2018-01-23 18:51:40 +00:00
olly
0708aa87ba Fix stray calculation in PGS decoder
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182183184
2018-01-23 18:50:09 +00:00
aquilescanta
be304486e0 Fix HLS' mime type propagation
Issue:#3653

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182064250
2018-01-23 18:47:13 +00:00
olly
a4114f59b6 Seek at chunk level when seeking to chunk start positions
This avoids issues that can arise due to slight discrepancies between
chunk start times (obtained from the manifest of segment index) and
the timestamps of the samples contained within those chunks.

Issue: #2882

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182054959
2018-01-23 18:45:44 +00:00
hoangtc
6749623cd1 Handle DASH `emsg' events targeting player.
For live streaming, there are several types of DASH `emsg' events that directly
target the player. These events can signal whether the manifest is expired, or
the live streaming has ended, and should be handle directly within the player.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=182034591
2018-01-23 18:42:49 +00:00
tonihei
cfed8791b0 Send downStreamFormatChanged notification for embedded streams.
This allows listeners to get notified of any change to the embedded tracks.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181969023
2018-01-23 18:38:17 +00:00
olly
ebfd5a7fe0 Don't discard embedded queues beyond primary queue.
ChunkSampleStream.seekToUs assumes that if we can seek within the
primary sample queue, we can also seek within the embedded queues.
This assumption can be violated fairly easily if discardBuffer is
called with toKeyframe=true, since this can cause samples to be
discarded from the embedded queues within the period for which a
seek in the primary sample queue will succeed. This change fixes
the issue.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181965902
2018-01-23 18:36:48 +00:00
Oliver Woodman
141f3aa836 Simplify PGS captions + sync with internal tree 2018-01-15 14:13:30 +00:00
ojw28
dc38e86945
Merge pull request #3673 from drhill/dev-v2_PGS
PGS subtitle decoding support
2018-01-15 13:47:16 +00:00
tonihei
7a56403046 Add missing downstreamFormatChanged to Extractor and SingleSample media source.
These haven't been included in the recent changes but can be reported as
soon as the first sample of each stream is read.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181753141
2018-01-15 11:59:46 +00:00
tonihei
ad3e6ef4cd Add missing onLoadStarted callback to Extractor and SingleSample media period.
We added the other callbacks some time ago, but didn't include onLoadStarted.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181743764
2018-01-15 11:56:53 +00:00
tonihei
f977ba256f Add ad insertion discontinuity reason.
This it to distinguish between actual period transitions and the
transitions occuring to and from ads within one timeline period.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181606023
2018-01-15 11:50:15 +00:00
olly
214d46d957 Set selection flags on image sample formats.
Issue: #3008

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181455340
2018-01-15 11:46:07 +00:00
eguven
1fc250a9f3 Make CacheUtil documentation clearer
Also fixed some other Cache related javadoc.

Issue: #3374

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181440687
2018-01-15 11:44:41 +00:00
olly
ff1bb2f702 Apply SeekParameters to DASH + SmoothStreaming playbacks
Issue: #2882

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181314086
2018-01-15 11:34:48 +00:00
tonihei
4ee971052b Improve Extractor partial read tests.
Partial reads were performed once using a partial size of 1 byte.
This was not enough to detect problems which only occur in combination
with IOExceptions. Partial reads are now only applied when no exception
is thrown.

Moreover, the tests didn't check whether the total number of sampled bytes
is what it is supposed to be. Added a field to the data dumps checking
the total number of bytes in the sampled data.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181296545
2018-01-15 11:33:23 +00:00
eguven
d427a1dd62 Make Cache.getCachedSpans return empty set rather than null
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181161289
2018-01-15 11:30:39 +00:00
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
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