15321 Commits

Author SHA1 Message Date
Oliver Woodman
797fa7f872 Make TsExtractor use ParsableByteArray where possible.
- TsExtractor is now based on ParsableByteArray rather than BitArray.
  This makes is much clearer that, for the most part, data is byte
  aligned. It will allow us to optimize TsExtractor without worrying
  about arbitrary bit offsets.
- BitArray is renamed ParsableBitArray for consistency, and is now
  exclusively for bit-stream level reading.
- There are some temporary methods in ParsableByteArray that should be
  cleared up once the optimizations are in place.

Issue: #278
2015-02-10 22:13:01 +00:00
Oliver Woodman
7c66b6ed3b HLS optimization #1 (refactor).
This is the start of a sequence of changes to fix the ref'd
github issue. Currently TsExtractor involves multiple memory
copy steps:

DataSource->Ts_BitArray->Pes_BitArray->Sample->SampleHolder

This is inefficient, but more importantly, the copy into
Sample is problematic, because Samples are of dynamically
varying size. The way we end up expanding Sample objects to
be large enough to hold the data being written means that we
end up gradually expanding all Sample objects in the pool
(which wastes memory), and that we generate a lot of GC churn,
particularly when switching to a higher quality which can
trigger all Sample objects to expand.

The fix will be to reduce the copy steps to:

DataSource->TsPacket->SampleHolder

We will track Pes and Sample data with lists of pointers into
TsPackets, rather than actually copying the data. We will
recycle these pointers.

The following steps are approximately how the refactor will
progress:

1. Start reducing use of BitArray. It's going to be way too
complicated to track bit-granularity offsets into multiple packets,
and allow reading across packet boundaries. In practice reads
from Ts packets are all byte aligned except for small sections,
so we'll move over to using ParsableByteArray instead, so we
only need to track byte offsets.

2. Move TsExtractor to use ParsableByteArray except for small
sections where we really need bit-granularity offsets.

3. Do the actual optimization.

Issue: #278
2015-02-10 12:25:13 +00:00
ojw28
ccac9fad4e Merge pull request #287 from google/dev
dev -> dev-webm-vp9-opus
2015-02-09 17:29:44 +00:00
Oliver Woodman
b0a3c30a90 Improve EIA608 caption support.
- Also make text renderers respect the decodeOnly flag.
- Also fix AC3 passthrough to always allocate direct buffers.
2015-02-09 17:28:07 +00:00
Oliver Woodman
32f0eb1278 Enhance mp4 parsing. 2015-02-09 17:25:39 +00:00
ojw28
876fa41b43 Merge pull request #283 from google/dev
dev -> dev-webm-vp9-opus
2015-02-06 12:01:24 +00:00
Oliver Woodman
147bbe6d55 Simplify demo application.
- Remove simple variant. Maintaining both simple + full is
  unnecessary effort.
- Remove need to specify content id in Sample definition,
  except where it's actually required (for DRM requests in
  the Widevine GTS samples)
2015-02-06 11:52:14 +00:00
Oliver Woodman
bfa1de68d8 Move common MP4 parsing code to CommonMp4AtomParsers and Mp4Util.
Also add parseMp4vFromParent and return the track's duration in parseTrak.

This is in preparation for adding a non-fragmented MP4 extractor.
2015-02-06 11:43:37 +00:00
Oliver Woodman
a968e5535b Continue playback of tracks with longer duration than the timesource.
If the timesource track renderer ends, but other track renderers
haven't finished, the player would get stuck in a pending state.
This change enables automatic switching to the media clock in the
case that the timesource renderer has ended, which allows other
renderers to continue to play.
2015-02-06 11:32:46 +00:00
Oliver Woodman
03ef3d148f Add MP4V mimetype. 2015-02-06 11:32:08 +00:00
Oliver Woodman
fbf75e1263 Fix SubtitleView to redraw if text changes but bounds stay the same. 2015-02-06 11:31:13 +00:00
Oliver Woodman
7505944497 Separate leaf/container children in ContainerAtom.
Add a utility for converting named atom types to integers.

Add atom types for non-fragmented MP4 parsing.
2015-02-03 12:44:18 +00:00
Oliver Woodman
5bfc5f373b Bug fixes for ByteArrayDataSource. 2015-02-03 12:43:09 +00:00
Oliver Woodman
0ef28abbec Modified Webvtt parser to handle cue identifiers and tags.
Issue: #268
2015-02-03 12:41:49 +00:00
Vignesh Venkatasubramanian
3338a09c70 Update .gitignore to ignore VP9/Opus specific files. 2015-02-02 14:43:55 -08:00
Vignesh Venkatasubramanian
10070a2d93 Add demo app for WebM Native Extensions
Add a demo app that can be used as a reference for how to use the native VP9 and
Opus Extensions.
2015-02-02 14:43:55 -08:00
Vignesh Venkatasubramanian
7113d2ab6f Add Opus Native Extension
Add Opus Native Extension that can be used to playback Opus using the native
libopus library.
2015-02-02 14:43:50 -08:00
Vignesh Venkatasubramanian
dd726001a8 Add VP9 Native Extension
Add VP9 Native Extension that can be used to playback VP9 using the native
libvpx library.
2015-02-02 14:41:34 -08:00
Oliver Woodman
c1a2f3d0c2 Add AOSP header. 2015-02-02 19:54:56 +00:00
Oliver Woodman
7b9b7c6e3b Handle non-indexed representations.
These may occur in VOD streams where a representation's data
is small enough not to require segmentation or an index. For
example subtitle files.

Issue: #268
2015-02-02 19:54:08 +00:00
Oliver Woodman
d1fe33cdf8 Add DefaultSampleSource and SampleExtractor interface.
SampleExtractor will initially only be implemented by FrameworkSampleExtractor
which delegates to a MediaExtractor, but eventually it will also be implemented
by additional extractors.

The sample extractor can be used as a source of samples via DefaultSampleSource.
2015-02-02 14:59:30 +00:00
Oliver Woodman
6f3ccc3615 Handle byte-order-mark prefix to WebVTT file.
Issue: #268
2015-02-02 14:56:33 +00:00
Martin Bonnin
e33e1d7922 cleaner test 2015-01-27 18:37:27 +01:00
Martin Bonnin
c228017fe4 rename hasQueuedOneInputBuffer to hasQueuedInputBuffer 2015-01-27 18:35:40 +01:00
Oliver Woodman
ed0b02d09b Package restructuring to accommodate incoming features (sorry).
This may be painful in terms of applications having to change their
imports. Sorry about that.
2015-01-27 17:00:46 +00:00
Andrey Udovenko
27c0e7d776 Merge pull request #267 from google/dev-hls
Merge dev-hls -> dev
2015-01-27 11:48:15 -05:00
Oliver Woodman
b7be7bc01b Fix handling of PTS wraparound. 2015-01-27 15:12:33 +00:00
Oliver Woodman
ee83468084 Blacklist playlists that 404/410. 2015-01-27 15:11:44 +00:00
ojw28
c6c6f2d83e Merge pull request #266 from google/dev
dev -> dev-hls
2015-01-27 15:10:34 +00:00
Martin Bonnin
424b29f996 remove REINIT_STATE_DO_REINIT_NOW state, reinit directly when needed. 2015-01-27 10:44:02 +01:00
Oliver Woodman
ce2f681bd3 Add directories for extensions + additional demos 2015-01-26 16:18:41 +00:00
Oliver Woodman
db5cc21c33 Revert test 2015-01-26 15:18:27 +00:00
Oliver Woodman
fda8f6d35a Test 2015-01-26 15:12:17 +00:00
Oliver Woodman
7b41741db0 Revert test. 2015-01-26 15:01:25 +00:00
Oliver Woodman
76f44eeb13 Test. 2015-01-26 15:01:00 +00:00
Oliver Woodman
f1a7784eb1 Fix DASH Live edge calculation.
Also added clamping to getSegmentNum in one case where
it was not already implemented, and defined this behavior
property in the getSegmentNum javadoc.

Issue: #262
2015-01-26 14:49:33 +00:00
Oliver Woodman
a64df69f85 Refine last segment calculation.
This makes the calculation correct for the case where periodDurationMs
does not divide exactly into durationMs.
2015-01-26 14:08:38 +00:00
ojw28
e538181112 Merge pull request #264 from IhorZak/dev
Fixed wrong calculation of last segment number when using segment templa...
2015-01-26 14:08:08 +00:00
Ihor Zakhozhyi
1a363849e2 Fixed wrong calculation of last segment number when using segment template without segment timeline. 2015-01-25 18:49:53 +02:00
ojw28
95341440da Merge pull request #263 from google/dev
dev -> dev-hls
2015-01-23 14:32:21 -08:00
Oliver Woodman
14d1317ce0 Replace tabs with spaces. 2015-01-23 22:25:39 +00:00
Oliver Woodman
4f65e94e93 Add Javadoc to ParsableByteArray. 2015-01-23 22:23:59 +00:00
Oliver Woodman
59b04df4c3 Fix incorrect max height calculation. 2015-01-23 22:18:54 +00:00
Oliver Woodman
6520557dc0 Add (not technically necessary 0xFF guard for clarity).
Without this, the byte is cast as follows (in bits) if the top
byte is set:

10000010 -> 1000000000000000000000000000010

This works because we then always shift at least one bit left,
and only look at the bottom 8 bits of the result. It's confusing
though. It's clearer if the cast to int gives just adds zeros to
the front, like:

10000010 -> 0000000000000000000000010000010
2015-01-23 09:08:41 -08:00
ojw28
06ddb036c8 Merge pull request #260 from mine260309/dev-hls
Fix a signed right shift issue in BitArray.readUnsignedByte()
2015-01-23 08:09:27 -08:00
Lei YU
80602b1684 Make BitArray.readUnsignedByte() a bit more clear by using int value instead of byte to prevent unnecessary convert from int to byte. 2015-01-23 23:52:46 +08:00
Lei YU
a9b2120fc9 Fix an issue in BitArray.readUnsignedByte() returns incorrect value when bitOffset is not zero and data[byteOffset + 1] starts with bit 1.
This is caused by signed right shift, the fix is simply to make it unsigned right shift.
2015-01-23 16:44:23 +08:00
Andrey Udovenko
b30f55f147 Process only type == 0 captions. #156 2015-01-22 12:53:33 -05:00
Martin Bonnin
79708f43f8 handle the case when flushCodec() is called while reiniting the decoders 2015-01-22 10:24:51 +01:00
ojw28
ef396933f8 Merge pull request #255 from google/dev
dev -> dev-hls
2015-01-21 15:52:31 -08:00