3991 Commits

Author SHA1 Message Date
ojw28
ec2fbe5d1e
Merge pull request #3495 from simophin/patch-1
Guard against out-of-range timestamp
2017-11-27 20:43:15 +00:00
tonihei
818d5a0b00 Add final to boolean used within Runnable.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176997767
2017-11-27 13:54:08 +00:00
tonihei
a4fbb45325 Remove race condition when stopping FakeExoPlayer.
A message to stop the playback and to quit the playback thread was posted in release().
The stop message removed all other already queued messages which might include
the second message to quit the thread. That led to infinite waiting in the
release method because the playback thread never got the quit signal.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176997104
2017-11-27 13:52:56 +00:00
andrewlewis
70169af6a0 Update version strings
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176989632
2017-11-27 13:51:34 +00:00
andrewlewis
8833a2930c Take into account the playback speed for loading
Update the default AdaptiveTrackSelection and DefaultLoadControl to use playback
speed information.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176989168
2017-11-27 13:50:19 +00:00
andrewlewis
a9ed6b191d Switch from currentTimeMillis to elapsedRealtime
currentTimeMillis is not guaranteed to be monotonic and elapsedRealtime is
recommend for interval timing.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176853118
2017-11-27 13:49:04 +00:00
tonihei
c4385c738f Temporarily fix flakiness of testPlayEmptyTimeline.
Fixed by explicitly waiting for the timeline update. This shouldn't be
necessary and will be removed as soon as the correct order of events
can be guaranteed (timeline change -> state change -> onSeekProcessed).

The waiting for the timeline update is implemented by introducing the
feature that the test runner also waits until the action schedule has
finished before stopping the test.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176848540
2017-11-27 13:47:48 +00:00
andrewlewis
36255c42cf Test setPlaybackParameters before preparation completes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176837939
2017-11-27 13:46:33 +00:00
andrewlewis
de476ba4e6 Propagate the player error to ExoPlayerTestRunner
In a test run where no exceptions were thrown on the main thread and the test
did not time out, exceptions from onPlayerError were not correctly propagated to
the test thread (handleException would be called with null).

Fix ExoPlayerTestRunner.onPlayerError to propagate the actual exception from the
player.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176825907
2017-11-27 13:45:19 +00:00
baiming
5cd8869646 Really fix the NPE in ExoPlayer.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176821463
2017-11-27 13:44:05 +00:00
simophin
77d8c13621
Guard against out-of-range timestamp
We've found that in our production environment, the AAC stream's timestamp exceeds the 33bit limit from time to time, when it happens, `peekId3PrivTimestamp` returns a value that is greater than `TimestampAdjuster.MAX_PTS_PLUS_ONE`, which causes a overflow in `TimestampAdjuster.adjustTsTimestamp` (overflow inside `ptsToUs`) after playing for a while . When the overflow happens, the start time of the stream becomes negative and the playback simply stucks at buffering forever.

I fully understand that the 33bit is a spec requirement, thus I asked our stream provider to correct this mistake. But in the mean time, I'd also like ExoPlayer to handle this situation more error tolerance, as in other platforms (iOS, browsers) we see more tolerance behavior.
2017-11-24 17:27:35 +13:00
olly
91bcde033c Fix release notes (change was cherry-picked)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176768835
2017-11-23 15:18:24 +00:00
olly
5d70b9e02d Partialy revert "Make ExtractorMediaSource timeline dynamic until duration is set"
This change broke playback through playlists.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176764830
2017-11-23 15:16:58 +00:00
olly
874d1be852 stopInternal should release MediaSource
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176763841
2017-11-23 15:15:16 +00:00
olly
2537e883d6 Move HlsSampleStreamWrapper to use ArrayList
Also prevent skip when there's a pending reset, and add a
TODO to split/fix chunk discard and downstream format change
reporting.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176760955
2017-11-23 15:13:51 +00:00
tonihei
7eb0af7c0e Replace LinkedList with ArrayList in ChunkSampleStream.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176759080
2017-11-23 15:12:23 +00:00
olly
2086c129fc Suppress discontinuities that don't change the position
This is mostly useful for suppressing the initial position
discontinuity reported by ClippingMediaPeriod.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176758972
2017-11-23 15:10:52 +00:00
tonihei
ba5f35995f Send discontinuity at adjustments after shuffle/repeat mode changes.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176749136
2017-11-23 15:09:04 +00:00
olly
1442c047cf Update gradle wrapper
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176693785
2017-11-23 15:06:12 +00:00
olly
d537c21888 Test ClippingMediaSource handles initial dynamic timelines
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176666247
2017-11-22 18:29:52 +00:00
olly
e04bdcea50 Relax requirement that MergingMediaSource children are not dynamic
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176664332
2017-11-22 18:28:39 +00:00
olly
494a41c8b2 Improve ClippingMediaSource "cannot clip" behavior
This brings ClippingMediaSource clip failures in line with
what MergingMediaSource does when it cannot merge.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176660123
2017-11-22 18:27:16 +00:00
olly
d909dc1863 Report correct discontinuity from ClippingMediaPeriod
It currently always reports 0, but it should report the position
passed through selectTracks. Reporting should also be disabled if
there's a seekToUs call.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176644228
2017-11-22 18:25:55 +00:00
olly
b5480e0e97 Relax requirement that ClippingMediaSource children are not dynamic
Tests to follow (want to fix breakages first).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176642610
2017-11-22 18:24:27 +00:00
jrochest
4193a1f705 Guard against null TrackSelections in updateTrackSelectionPlaybackSpeed.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176629070
2017-11-22 18:22:58 +00:00
hoangtc
e575af3ac3 Parse DASH manifest's publish time.
Parse DASH manifest's publishTime node as defined by ISO/IEC 23009-1:2014,
section 5.3.1.2.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176525922
2017-11-22 18:21:13 +00:00
tonihei
6607f49be6 Fix reporting of format changes in ChunkSampleStream.
Until recently, changing primary track formats were reported when the
corresponding media chunk was discarded which always happened immediately
after the sample has been read.

Now, media chunks may be discarded later on or in batches, leaving the
current reporting mechanism broken because changes may never be reported.

This fix separates the discarding from the reporting such that format changes
can be reported when the media chunk is first read from, while the discarding
operation only discards without reporting format changes.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176519071
2017-11-22 18:19:46 +00:00
andrewlewis
15a1f9a552 Remove DefaultLoadControl buffer time state
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176515168
2017-11-22 18:18:19 +00:00
hoangtc
e619079a0d Let EventMessage encloses its presentationTimeMs.
Currently EventMessage's presentationTimeMs is kept separately in
EventSampleStream. However, EventMessage's presentationTimeMs maybe used in
other places besides EventSampleStream, such as when handling `emsg' messages
targeting the player. This CL let EventMessage object to holds its
presentationTimeMs for such use cases.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176502938
2017-11-22 18:16:58 +00:00
Oliver Woodman
3998ed49ae Mini cleanup 2017-11-21 13:42:12 +00:00
ojw28
1a138ad4dc
Merge pull request #3486 from IanDBird/dev-v2
Fix initializationData check for SSA subtitles
2017-11-21 13:31:06 +00:00
olly
856c2f8d3e Make ExtractorMediaSource timeline dynamic until duration is set
We (eventually - albeit possibly infinitely far in the future)
expect a timeline update with a window of known duration. This
also stops live radio stream playbacks transitioning to ended
state when their tracks are disabled.

As part of this fix, I found an issue where getPeriodPosition
could return null even when defaultPositionProjectionUs is 0,
which is not as documented.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176492024
2017-11-21 13:16:19 +00:00
olly
c49ae53699 Remove unnecessary dependency
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176487991
2017-11-21 13:15:00 +00:00
andrewlewis
31e2cfce9e Pass playback speed to LoadControl and TrackSelection
This allows implementations of those classes to take into account the playback
speed for adaptive track selection and controlling when to resume the player.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176484361
2017-11-21 13:13:35 +00:00
tonihei
a8d867be37 Support multiple transitions to STATE_ENDED in ExoPlayerTestRunner.
Currently testRunner.blockUntilEnded waits for the first transition to
STATE_ENDED or _IDLE before returning. In order to support tests with
player repreparations after one playback finished, this change adds an
option to specifiy the number of expected transitions to ended.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176484047
2017-11-21 13:12:12 +00:00
tonihei
e1d960db68 Unify internal reset method to support state and position resets.
The ExoPlayerImplInternal.reset method now takes the same set of options
as the ExoPlayer.prepare method. This also allows to
- Remove some code duplication within ExoPlayerImplInternal
- Fix calls to prepare(sameSource, resetPosition=true, resetState=false)
  with enabled shuffle mode where the position was not correctly reset to the
  first period index.
- Keep the current timeline when calling stop (in line with ExoPlayerImpl).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176481878
2017-11-21 13:10:45 +00:00
tonihei
fdb53ac8d1 Correct period index counting in ExoPlayerTestRunner.
The initial period index was counted in onPlayerStateChanged. However, we
actually want to save the period index in the newly introduced onPositionDiscontinuity
after preparation.

While being here, also updated deprecated LinkedList to ArrayList.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176479509
2017-11-21 13:09:17 +00:00
tonihei
aac53cac56 Add reason to onTimelineChanged.
Currently onTimelineChanged doesn't allow to distinguish easily between the
different reasons why it's being called. Especially, finding
out whether a new media source has been prepared or the current source
refreshed dynamically was impossible without tightly coupling the player
operations with the listener.

The new reasons provide this disdinction by either indicating a newly
initialized media source, a dynamic update to an existing timeline
or manifest, or a reset of the player (which usually results in an
empty timeline).

The original onTimelineChanged method without reason is kept in the
DefaultEventListener as deprecated to prevent the need to update all
existing listeners in one go.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176478701
2017-11-21 13:07:46 +00:00
olly
13b595ed39 Don't do work after track selection when in ended state
This causes the player to report that it's started loading
when in the ended state.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176371892
2017-11-21 13:06:11 +00:00
olly
275292cb63 Report additional position discontinuities
- Properly report internal discontinuities
- Add DISCONTINUITY_REASON_SEEK_ADJUSTMENT to distinguish
  seek adjustments from other internal discontinuity events

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176367365
2017-11-21 13:04:47 +00:00
olly
c06fe73b66 Bump target API level to 27
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176366693
2017-11-21 13:03:28 +00:00
olly
3656230cb1 Use MediaSourceTestRunner in additional source tests
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176366471
2017-11-21 13:01:59 +00:00
andrewlewis
2a685da4eb Improve robustness of ImaAdsLoader
Remove an assertion that there was a call to pause content between two
content -> ad transitions.

Also, only use the player position for resuming an ad on reattaching if the
player is currently playing an ad, in case IMA pauses content before the player
actually transitions to an ad.

Issue: #3430

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176365842
2017-11-21 13:00:36 +00:00
hoangtc
0de57cbfae Allow more flexible loading strategy when loading multiple sub streams.
Currently for a DASH ChunkSource that consists of multiple sub-streams, we
always use a CompositeSequenceableLoader, which only allows the furthest behind
loader or any loader that are behind current playback position to continue
loading.
This changes allow clients to have more flexibility when deciding the loading
strategy:
- They can construct a different kind of composite SequenceableLoader from
the sub-loaders, and use it by injecting a different CompositeSequeableLoaderFactory accordingly.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176363870
2017-11-21 12:59:11 +00:00
aquilescanta
e45907193c Allow human readable strings as DRM intent extras.
Issue:#3478

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176351086
2017-11-21 12:57:47 +00:00
Ian Bird
a9d91b3387 Fix initializationData check for SSA subtitles 2017-11-21 10:59:10 +00:00
andrewlewis
c4fe0e6482 Add support for Dolby Atmos
Issue: #2465

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176341309
2017-11-20 13:43:31 +00:00
tonihei
75acfc7957 Move media clock handling to its own class.
This class implements MediaClock itself and handles the switching between
renderer and standalone media clock.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176340615
2017-11-20 13:42:06 +00:00
tonihei
3f6b4d18a9 Move MockitoUtils to testutils and use it for all Mockito set-ups.
In particular this allows to have the workaround for
https://code.google.com/p/dexmaker/issues/detail?id=2 in one place only.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176340526
2017-11-20 13:40:28 +00:00
olly
82d0a27fd9 Fix some lint issues.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=176337058
2017-11-20 13:39:03 +00:00