1711 Commits

Author SHA1 Message Date
olly
f56b05f0d7 Bump version to r2.0.4
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136697697
2016-10-20 12:20:10 +01:00
aquilescanta
bebbf29a78 Fix NPE when trying to play H265 in Ts files
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136607848
2016-10-20 12:20:10 +01:00
olly
586e6257cd Add explicit TargetApi annotation to remove lint error
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136597149
2016-10-19 17:00:33 +01:00
olly
3a5cb43541 Fix use of API level 19 method
Issue: #1965

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136595233
2016-10-19 17:00:33 +01:00
olly
aa1002a0d6 Rollback "Add REQUIRE_HTTPS flag"
*** Reason for rollback ***

Flag doesn't enforce what it says it enforces, due to redirects

*** Original change description ***

Add REQUIRE_HTTPS flag

Note that it's not possible for the library to enforce that
the flag is adhered to, since it's possible for applications
to inject custom implementations of DataSource (there's no
requirement they even extend HttpDataSource for network
requesting implementations). It's possible for applications
to replace pretty much anything in the library, so there's
no other place we could put the flag where we could make
this guarantee. Hence this is a best-effort that will work
when...

***

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136583459
2016-10-19 17:00:03 +01:00
aquilescanta
aecbbdd36c Replace IndexOutOfBounds Exception for BehindLiveWindowException
This is a problem when two invocations of getNextChunk that retrieve
chunks (i.e. not playlists) occur too apart in time. In that case
the last loaded chunk has a media sequence that is behind the current
playlist.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136501291
2016-10-19 17:00:03 +01:00
olly
1cfc432bb8 Add REQUIRE_HTTPS flag
Note that it's not possible for the library to enforce that
the flag is adhered to, since it's possible for applications
to inject custom implementations of DataSource (there's no
requirement they even extend HttpDataSource for network
requesting implementations). It's possible for applications
to replace pretty much anything in the library, so there's
no other place we could put the flag where we could make
this guarantee. Hence this is a best-effort that will work
when using HttpDataSource implementations that we provide.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136500947
2016-10-19 17:00:03 +01:00
eguven
06fb29c939 Support caching of multi segment DASH, HLS and Smooth Streaming.
Use sha1 of content uri if a custom cache key or content id isn't provided.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136351830
2016-10-19 16:58:09 +01:00
olly
cecb1f5f76 Bump version + update release notes
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136339035
2016-10-17 15:43:57 +01:00
aquilescanta
e873b4b6ab Change prepare() for maybePrepare() in HlsSampleStreamWrapper
This will allow asynchronous preparation.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136176854
2016-10-17 15:43:57 +01:00
klampert
dca4d16bef Release surfaces created to wrap SurfaceTextures
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136163292
2016-10-14 18:57:30 +01:00
olly
6acf59c4fc Fix Widevine L3 provisioning in V2
1. HttpMediaDrmCallback.executeProvisionRequest needs to specify
   an empty byte[], else we do a GET instead of a POST.
2. Content-Type should not be set when making the provision
   request, since there's no body.
3. DataSource implementations must correctly handle a non-null
   body with zero length. CronetDataSource was not handling this
   case. DefaultHttpDataSource was, but made a code modification
   to make it a little clearer. OkHttpDataSource seems to handle
   the case correctly, and it doens't look like the code can be
   made clearer.

Issue #1925

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136042641
2016-10-14 10:42:43 +01:00
olly
a22390c29b Parse CEA-708 codec for rawCC
Note that actually handling CEA-708 is not yet implemented,
and so this is a no-op change from a behavior point of view.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136038439
2016-10-14 10:42:43 +01:00
aquilescanta
e685edc179 Make interface implementation consistent among ExtractorOutputs
The method track(int id) currently has different behaviours across
implementations. This CL maps ids to track outputs, which means
that successive calls with the same id will return the same
TrackOutput instance. Also fixes TsExtractor inconsistent behavior
after a seek.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136026721
2016-10-14 10:42:43 +01:00
aquilescanta
ff712aead5 Try not adapting before failing with BehindLiveWindowException in Hls
Issue:#1782

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=136025847
2016-10-14 10:42:43 +01:00
olly
64262085a7 Block when surface being replaced is non-null
A blocking call is necessary where we want to guarantee that
the player wont access the surface after the method call has
returned. We currently only do this for the case:

Surface->Null

But we should also do it for the case:

SurfaceA->SurfaceB

Since the caller may reasonably do something like destroy
SurfaceA immediately after it's been replaced.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135921296
2016-10-14 10:42:43 +01:00
aquilescanta
f18373eeb2 Decouple TsExtractor's readers from TrackOutputs
This allows the injectable reader factory to be a stateless factory, allows
the seeking to be consistent and will allow multiple CC channel support later
on.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135909712
2016-10-14 10:42:43 +01:00
olly
996fe47f8c Fix NPE releasing HlsMediaPeriod
Issue: #1907

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135798950
2016-10-11 18:16:28 +01:00
olly
29f3eb5e5a Fixes for retries
- Fix issue in ExoPlayerImpl where the timeline was null'd
  but onTimelineChanged was not fired.
- Add the ability to not reset the timeline. This is useful
  for retries where you know the timeline will be the same
  as it was previously.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135797577
2016-10-11 18:16:28 +01:00
olly
83107cc25d Fix missing release calls on loadingPeriodHolder
playingPeriodHolder can be null in the case that the first
period is still being prepared. We need to make sure we
release the period that's being prepared in such cases,
which is loadingPeriodHolder.

Issue: #1914

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135793472
2016-10-11 18:16:28 +01:00
olly
907b9bf4f6 Sanitize threading in CronetDataSource
- Move nearly all logic onto the calling thread (i.e. the thread
  calling open/read/close), to make threading correctness more
  obvious.
- Document which variables are read/written from which thread, and
  why the call sequences are safe.
- Fix thread safety issue that I think could probably cause data
  corruption in the case of a read timeout followed by another
  request into the DataSource.

Also:

- Relaxed content length checking to be consistent with the other
  http DataSource implementations, and avoided parsing the headers
  where they're not used.
- Fixed missing generics in CronetDataSourceFactory.
- Added TODO to work with servers that don't support partial range
  requests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135702217
2016-10-11 18:16:28 +01:00
olly
4fab402274 Fix missing generics
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135700280
2016-10-11 18:16:28 +01:00
olly
d922a21160 Select the cenc sinf atom explicitly
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135692709
2016-10-11 18:16:28 +01:00
olly
91f8328a5f UI component improvements
- Make sure no events are posted on PlaybackControlView
  if it's not attached to a window. This can cause leaks.
  The target hide time is recorded if necessary and
  processed when the view is re-attached.
- Deduplicated PlaybackControlView.VisibilityListener
  invocations.
- Fixed timeouts to be more intuitive (I think).
- Fixed initial visibility of PlaybackControlView when
  used as part of SimpleExoPlayerView.
- Made some more attributes configurable from layout xml.

Issue: #1908
Issue: #1919
Issue: #1923

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135679988
2016-10-11 18:16:28 +01:00
olly
6c12ec629a Some minor UI refinements
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135353593
2016-10-06 15:05:34 +01:00
[]inger
08965c03d0 Avoid memory leaks by removing callbacks from surface when SimpleExoPlayer is released.
Without this developers which reuse a SurfaceHolder with multiple instances of
SimpleExoPlayer need to call simpleExoPlayer.setVideoSurfaceHolder(null) to get
the SimpleExoPlayer.ComponentListener removed from the surface holder. If they
don't, the component listener is still registered and as a member class leaks
an instance of simpleExoPlayer.

Issue #1855

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135292439
2016-10-06 15:04:57 +01:00
olly
d334dfdcba Fix merging of selected streams.
Playback would fail if a renderer is toggled from consuming from
one child to another in a single step.

Issue: #1900

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135270356
2016-10-05 21:21:47 +01:00
[]inger
053dc27a3e Introduce resize mode for AspectRatioFrameLayout.
https://github.com/google/ExoPlayer/issues/1827

Three different modes available: fit (default), fixed_width, fixed_height
Developers need to use wrap_content for the dimension which is not fixed:

app:resize_mode="fixed_width"
android:layout_width="320dp"
android:layout_height="wrap_content"

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135264861
2016-10-05 21:21:13 +01:00
olly
2cf339e095 Bump version to 2.0.2 + document inclusion of OkHttp extension
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135260806
2016-10-05 21:20:34 +01:00
olly
89c438078e Fix retry crash in edge case
Configuration of retry currently fails if all of the
following are true, which is highly unlikely but does
occur in the ref'd issue.

1. Loading/extraction fails
2. Neither length of stream of a seek map is known
3. At least one track has been output by the extractor

Issue: #1899

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135228687
2016-10-05 18:07:48 +01:00
olly
1b90b7c12c Factor out common variables for publishing
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135215320
2016-10-05 18:07:13 +01:00
olly
7c3fe15426 Add convenience getPlayer methods to UI components
Issue: #1895

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135211179
2016-10-05 18:06:34 +01:00
olly
b3c6f1caae Finish cleaning DataSource implementations.
- Enfroce read returns 0 if readLength==0 everywhere.
- Fixes and simplifications for CronetDataSource.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135138232
2016-10-04 23:42:55 +01:00
olly
f8ed4cfdee Clean up some DataSource implementations
- Make read return 0 if readLength==0
- Return RESULT_END_OF_INPUT properly in the case that
  bytesRemaining is unset (this was broken previously,
  but only applies for assets > 2^31 bytes, so it's
  unlikely anyone ever hit this issue)

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135136541
2016-10-04 23:42:20 +01:00
aquilescanta
e288880aaf Fix Ac3 extractor sniff
Issue:#1875

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135100986
2016-10-04 23:40:53 +01:00
olly
b29b4f7e1a MergingMediaPeriod + subtitle fixes
- Correctly null out streams[j] in the case that a renderer
  is being disabled.
- Read discontinuities from all children, not just enabled
  ones. This fixes a failure when reading a discontinuity
  with all renderers disabled.
- Add in some assertions to make incorrect stream selection
  failures obvious and immediate.
- Relocate subtitles so they're above the shutter (needed so
  they continue to be visible when video is disabled but
  text is still enabled).

Issue: #1854

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=135089944
2016-10-04 23:39:24 +01:00
aquilescanta
6306c26988 Add support for fragmented MP4 in HLS
This CL adds support for initialization segments in HLS. This is required mainly for(but not limited to) usage of fMP4. The fMP4 support only consists in creating the required extractor if the extension is .mp4, provided the initialization segment is correctly
loaded and passed to the extractor.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134997636
2016-10-04 23:38:47 +01:00
olly
69af389730 Trim allocator on stop/reset by default
This prevents a large amount of memory from being held
in the case that a player instance is released, but the
application is holding dangling references to the player
that are preventing it from being garbage collected.

Issue: #1855

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134992945
2016-10-03 17:44:01 +01:00
olly
f75f3d75b2 Fix sideloaded subtitles
- Fix NPE issue in SingleSampleMediaPeriod.
- Delay handling of EOS in TextRenderer until the last
  subtitle is fully played out.

Issue: #1882

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134979286
2016-10-03 17:43:28 +01:00
cdrolle
37806ee792 Added Basic CEA-708 caption support to ExoPlayer V2, roughly equivalent to the current state of CEA-608. It's still missing window (and the associated positioning and formatting) support, emulating a 3-line rollup.
Currently this has only been tested with the RawCC container, though it should work with anything that makes use of SeiReader (i.e. MPEG2-TS) with minimal changes to SeiReader.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134781660
2016-10-03 17:42:49 +01:00
andrewlewis
c381093a48 Update variable name in comment.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134776852
2016-09-30 14:40:38 +01:00
andrewlewis
ee4d297f22 Fix seeking in the last period.
When reading the last period, the readingPeriodHolder was set to null in
updatePeriods if it was the last period. (This would occur almost immediately
when playing a single-period source.) seekToPeriodPosition suppresses reusing a
loaded/prepared period if the reading period and playing period did not match,
which meant that the whole timeline was recreated when seeking in the last
period.

Leave readingPeriodHolder non-null. This means that at all times either
playingPeriodHolder == readingPeriodHolder (and they could be null or
non-null), or playingPeriodHolder and readingPeriodHolder differ and are both
non-null.

Also fix an issue where streams were never forced to be recreated during track
reselection when reading ahead.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134774238
2016-09-30 14:40:06 +01:00
olly
7971a18a83 Revert back to default cue parameters until we support positioning
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134673236
2016-09-30 14:39:25 +01:00
olly
21626c417e Bump version to 2.0.1
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134662367
2016-09-29 16:30:10 +01:00
olly
8bf0243daf Fix mp3 extraction failure for short frames
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134660133
2016-09-29 16:29:35 +01:00
cdrolle
040fe3b194 Refactored the text.eia608 package to text.cea.
All of the classes in the text.eia608 package have been moved to
text.cea, and renamed with the "cea" prefix instead of "eia". All of
the buffering logic has been extracted from Cea608Decoder (formerly
Eia608Decoder) into the abstract CeaDecoder, which Cea608Decoder
extends. Cea608Decoder also now expects a 3-byte sample (i.e. the
entire cc_data_pkt instead of just the cc_data_1 and cc_data_2 bytes).
Classes like RawCcExtractor and SeiReader, responsible for creating
these samples, have also been updated accordingly.

This change is a necessary precursor to adding support for multi
-channel CEA-608 and CEA-708 captions.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134537482
2016-09-29 16:28:58 +01:00
andrewlewis
825ec70d31 Move preparation from MediaPeriod constructors to prepare().
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134504088
2016-09-28 11:26:12 +01:00
aquilescanta
c7b5c967ff Remove duplicate methods in DefaultTrackSelector
This encourages a single invalidation when setting different parameters.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134436136
2016-09-28 11:26:12 +01:00
aquilescanta
ed5decfafc Add ElementaryStreamReader's factory to inject custom readers in TSExtractor
Issue:#726

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134433012
2016-09-28 11:26:12 +01:00
andrewlewis
4a62b2688c Post onPrepared so it runs after createPeriod has finished.
Issue: #1853

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=134409897
2016-09-28 11:26:12 +01:00