530 Commits

Author SHA1 Message Date
Oliver Woodman
acd1b9acff Enable ContentProtect elements at the Representation level 2015-03-31 11:28:51 +01:00
Oliver Woodman
5a5935cb72 Fix HLS playlist parsing of boolean attributes.
The regex included quotation marks like X="YES", but the manifests
don't actually contain them, for examples X=YES.
2015-03-30 15:56:39 +01:00
Oliver Woodman
85be2aed0a Add ability to release via Bintray. 2015-03-25 23:50:27 +00:00
Oliver Woodman
b73b9a0509 Add workaround for #252 (but don't enable it by default). 2015-03-25 12:08:45 +00:00
Oliver Woodman
e54d07c1b0 Fix issue with new extractor input 2015-03-17 12:36:46 +00:00
Andrew Lewis
5e4a35fa7e Add Mp4SampleExtractor, for reading unfragmented MP4 files. 2015-03-13 18:10:37 +00:00
Andrew Lewis
6d8c4dd416 Add workaround for slow okhttp InputStream.close() on API levels 19/20. 2015-03-13 18:06:00 +00:00
Oliver Woodman
a22ccf9254 Another baby step to unified extractors.
- Have extractors read from an ExtractorInput. Benefits of this are
  (a) The ability to do a "full" read or skip of a specified number
  of bytes, (b) The ability to do multiple reads in your extractor's
  read method. The ExtractorInput will throw an InterruptedException
  if the read has been canceled.

- Provides the extractor with the ability to query the absolute
  position of the data being read in the stream. This is needed for
  things like parsing a segment index in fragmented mp4, where the
  position of the end of the box in the stream is required because
  the index offsets are all specified relative to that position.
2015-03-13 11:47:51 +00:00
Oliver Woodman
1111dd73a0 Further simplify HlsExtractor interface.
- Move to builder naming.
- Propagate formats to the TrackOutput instances, rather than having
  them be read through the Extractor. There was actually some weird
  indexing going on here before (which happened to work, but wasn't
  well defined).
2015-03-13 11:44:27 +00:00
Oliver Woodman
12807a7d4b Simplify encryption handling in HLS. 2015-03-12 19:44:06 +00:00
Damien Merenne
94dd9c41f4 Fix AES decryption of HLS streams.
As per http://tools.ietf.org/html/draft-pantos-http-live-streaming-04#section-5.2,
the initializaton vector (IV) of the AES decryption algorithm should be set to:
- the IV attribute value if present,
- the sequence number otherwise.

Currently, the IV is set once and use over all next media sequences
where the IV attribute is not set. The fix is to use the provided IV if
given or use the current media sequence number.
2015-03-12 13:34:58 +01:00
Oliver Woodman
5ca2e0fd95 First step toward extractor unification.
- It's probably easiest to think of this as a standalone HLS change, which is splitting out the "loading" and "consuming" sides of HlsExtractor and a good structural change in its own right. To do this, HlsExtractorWrapper becomes a final class implementing the consuming side. HlsExtractor becomes an interface defining the loading side.

- The bigger picture is that, hopefully, HlsExtractor will become a lightweight extractor interface that can be used throughout the library. Because it doesn't need to implement the consuming side, we'll save on having to re-implement the consuming side for every extractor (we'll probably need one consuming side implementation for HLS/DASH/SmoothStreaming, and a second one for everything else, both of which will use SampleQueue). It's expected that the HlsExtractor interface will need to change to accommodate all use cases.

- The next step in unification will be to try and have FragmentedMp4Extractor implement HlsExtractor (which will need renaming). Once this is done, I'll try and move the chunk package over to use the HlsExtractor interface.
2015-03-11 19:21:33 +00:00
Oliver Woodman
becc6fca4c Enhance SampleQueue/RollingSampleBuffer to support other use cases.
- This is a step toward hopefully converging HLS and CHUNK packages.
- Add support for encrypted samples.
- Add support for appending from a DataSource.
2015-03-11 15:49:53 +00:00
Oliver Woodman
5d0457152d Remove need for InlinedApi with a few more C constants. 2015-03-11 15:48:12 +00:00
Oliver Woodman
56a509d8e4 Clean up handling of encrypted samples in fmp4/webm extractors.
- The fmp4 extractor was reading from sampleEncryptionData even
  for not-encrypted samples, which I'm pretty sure isn't right.
  Fixed this. For all encrypted content I've seen, this change
  will be a no-op because isEncrypted is always true if there's
  an encryptionBox present.
- Made webm extractor only set cryptoInfo if isEncrypted is true.
- Align variable naming in the two extractors, for clarity.
2015-03-10 21:44:20 +00:00
Oliver Woodman
5e11b9f008 Add DrmInitData (missed from a previous commit). 2015-03-10 19:48:41 +00:00
Oliver Woodman
eba16e55b0 Support delayed loading by Loader. 2015-03-10 19:43:25 +00:00
Oliver Woodman
8c1088559e Generalize getPsshInfo to properly accomodate WebM.
- Rather than returning a map, return a DrmInitData object,
  with mapped and non-mapped implementations.
- Include a suitable mimeType to pass to the MediaDrm. Previously
  we were incorrectly passing the mimeType of the samples,
  where-as MediaDrm expects the container mimeType. Note that
  it doesn't matter whether the mimeType starts with "video" or
  "audio", hence using video mimeTypes everywhere.
2015-03-10 19:42:48 +00:00
Oliver Woodman
eec6458b43 Add handling of Extended Western European character set for CEA-608. 2015-03-10 19:37:47 +00:00
Oliver Woodman
4192ac56af WebM Extractor support for Encrypted content. 2015-03-10 19:36:37 +00:00
Oliver Woodman
1ebaaaebd5 Parse EXT-X-MEDIA tags with SUBTITLES type.
Not yet used by anything.

Issue: #151
2015-03-10 19:07:19 +00:00
Oliver Woodman
be103106cb HLS: Better stream selection at start of playback.
- Correctly handle bandwidth NO_ESTIMATE case.
- Don't consider switching without a previous chunk.
2015-03-10 19:06:07 +00:00
Oliver Woodman
489e99158f Remove getDurationUs from the SampleExtractor interface.
Set the duration on the MediaFormat instead.
2015-03-10 19:04:38 +00:00
Oliver Woodman
f3f9c845cd Add test for DefaultSampleSource. 2015-03-10 19:02:24 +00:00
Oliver Woodman
cdf19430ef Remove TrackInfo from the SampleExtractor interface. 2015-03-10 19:01:11 +00:00
Oliver Woodman
fbd0a57e5c Push tests. 2015-03-06 16:39:00 +00:00
Oliver Woodman
462fea3eaf Correctly resolve Uris according to RFC3986.
Issue: #327
2015-03-05 11:56:00 +00:00
Oliver Woodman
457557b56f Parse ISO8601 timestamps using UTC timezone. 2015-03-04 11:02:43 +00:00
Oliver Woodman
a1d4a5e154 Continue waiting for keys until the codec is flushed.
It was possible for a codec input buffer to be filled with two frames' worth of
data, if seekTo was called after populating a buffer, if waitingForKeys was true
and seeking did not trigger a flush. This caused the CryptoInfo to be configured
as if the input buffer contained a large amount of reconfiguration data as
cleartext.

Move resetting waitingForKeys to flushCodec, so that we don't try to read the
next sample from the source until the first one has been consumed or discarded.
2015-03-03 18:16:22 +00:00
Oliver Woodman
baea1cd12d Add ftyp atom def 2015-03-03 17:17:02 +00:00
Oliver Woodman
b9addf28b2 Formatting tweaks for enhanced ID3 support + support in demo app. 2015-03-03 17:16:13 +00:00
Oliver Woodman
0c6566bce7 Add flags to DataSpec. Support GZIP option.
Also remove uriIsFullStream. It's not doing anything particularly
useful, so I think it makes sense to remove it from the public API;
it's unlikely anyone is using it.

Issue: #329
2015-03-03 17:14:48 +00:00
Oliver Woodman
3868b1d4cb Clean up media playlist blacklisting / fix nits.
It seems fairly safe to assume a playlist wont be blacklisted
within 1ms of the device booting :).
2015-03-03 17:11:21 +00:00
J. Oliva
b03c8a713b Mime type string always finish with a single 0 byte
Mime type string always finish with a single 0 byte
2015-02-28 00:47:42 +01:00
J. Oliva
88475e4fee Fixed issue in the calculation of size of objectData
- Fixed issue in the calculation of size of objectData
- Indentation fixes
2015-02-27 22:09:05 +01:00
J. Oliva
1739af685a Removed indexOfNot method
Removed the unused method indexOfNot
2015-02-27 11:02:37 +01:00
J. Oliva
f33cdd97e6 Fixed an issue when looking for termination string in UTF-16 and UTF-16BE
Modified parse method to take into account different lengths for the
termination character (1 for UTF-8 and ISO-8859-1; 2 for UTF-16 and
UTF-16BE).
2015-02-27 10:57:43 +01:00
J. Oliva
c135bb7a57 Fixes for correctly supporting UTF-16 and UTF-16BE charsets
For fields encoded using UTF-16 or UTF-16BE charsets when looking for
termination character we have to look for two zero consecutive bytes.

Otherwise, as many characters encoded with UTF-16 or UTF-16BE has one
of their 2 bytes set with the value zero, we will be truncating text
fields.
2015-02-26 21:54:29 +01:00
J. Oliva
ebbd022a52 Added new ID3 frames
- Added support for ID3 frames of types GEOB and PRIV.

 - GEOB type is commonly used by dynamic ads provider to include in the
stream information about the ads to be played.
 - PRIV type is commonly used for time synchronization (example:
synchronizing playback of a live stream and its webvtt captions) and
also by analytics companies to include tracking information in the
stream.

- Added a sample stream from Apple that contains ID3 metadata.
2015-02-26 16:49:05 +01:00
ojw28
ea95db2375 Merge pull request #316 from jeoliva/blackplaylist_management
Better management of blacklisted playlists
2015-02-25 14:33:26 +00:00
Oliver Woodman
006986cc58 Make NetworkLoadable use an injected HttpDataSource.
Note: I'm fairly confident that NetworkLoadable.Parser implementations
can live without the inputEncoding being specified. But not completely
100%...

Issue: #311
Issue: #56
2015-02-25 13:39:15 +00:00
Oliver Woodman
2ce17b601f Correctly bound search into segment indices.
The return value here assumed that the time being searched for
was beyond the start time of the last segment. This fix also
handles the case where the time is prior to the start of the
first segment.
2015-02-25 13:34:31 +00:00
Oliver Woodman
d2da3bbf8a Simplify NetworkLoader/Parser/ManifestParser
The only downside of this change is that MediaPresentationDescriptionParser
is no longer stateless.
2015-02-25 12:09:06 +00:00
Oliver Woodman
0fdcb3347c continueBuffering should return true when ended.
This issue didn't have any material impact on playbacks, but
fixing it anyway to be technically correct.
2015-02-25 11:48:55 +00:00
Oliver Woodman
d6ebd49c63 Two small fixes for HLS.
1. Clear prefixFlags when a NAL unit is found.
2. continueBuffering should return true if loading is finished.
2015-02-25 11:37:39 +00:00
J. Oliva
2ac7046ffc Clear stale blacklisted playlist when getting next variant index
Calling clearStaleBlacklistedPlaylist within getNextVariantIndex method.
2015-02-23 22:42:53 +01:00
J. Oliva
4fe62b9b0a Clear stale blacklist in getChunkOperation
Clear stale blacklist in getChunkOperation before getting next variant.
This ensures:
1.- Player resilience to failures, always trying to look for a working
playlist that allows player to non stop playback.
2.- High quality blacklisted playlists can be reused in case they go up
after a failure. Player always trying to provide the best user
experience.
2015-02-23 20:40:37 +01:00
J. Oliva
f8a9da90e8 Renaming methods and code formating
- Method evaluatePlayListBlackListedTimestamps renamed to
clearStaleBlacklistedPlaylists
- Code formatted to be consistent with style elsewhere.
2015-02-23 20:06:49 +01:00
J. Oliva
20a40f5d11 Better management of blacklisted playlists
Added an expiration time field to playlists blacklisted to allow
Exoplayer to continue playback when playlists that failed were
recovered from a bad state.

In live environments, some times occur that primary encoder stop
working for a while. In that cases, HLS failover mechanism in the
player should detect the situation and “switch” to playlists served by
the backup encoder (in case a backup encoder exists). This was well
managed before these changes.

However, and to ensure a playback experience that can recover itself
from temporary issues, we cannot blacklist a playlist forever. When
streaming live events using HLS, it is quite typical that the player
needs to switch from primary to backup playlists, and from backup to
primary ones, from time to time to have playback working when temporary
issues in the network/encoder are happening. Most of the issues are
recoverable, so what I have implemented is a mechanism that makes
blacklisted playlist to be available again after a while (60 seconds).

Evaluation of this algorithm should happen just when something fails.
If player is working with a backup playlist, it shouldn’t switch to the
primary one at least something fail.
2015-02-23 15:14:09 +01:00
Oliver Woodman
6d14fc3330 Implement UTC time synchronization for DASH Live.
Support is provided for the following schemes:

urn:mpeg:dash:utc:direct:2012
urn:mpeg:dash:utc:http-iso:2014
urn:mpeg:dash:utc:http-xsdate:2012
urn:mpeg:dash:utc:http-xsdate:2014
2015-02-20 15:10:25 +00:00