1005 Commits

Author SHA1 Message Date
olly
d804446b34 Implement seeking via a single code path.
When a seek is performed, renderers currently perform the
actions that they need to take in two places: Some changes
are performed in seekTo implementations. Other changes are
performed when discontinuities are read from the source.

In HLS we need to perform what is effectively a seek
originating in the source. To support this, this CL allows
discontinuities read from the source to modify the playback
position. All actions that renderers perform as a result
of a seek are moved to be performed when a discontinuity is
received.

Best way to understand CL:
- Look at SampleSource interface change and then at the
  concrete implementations, to make sure they've been
  changed properly.
- Look at SampleSourceTrackRenderer change.
- Look at concrete renderers. The general pattern is that
  code previously performed in seekTo and READ_DISCONTINUITY
  is merged into onDiscontinuity().

Note: This will be further untangled in V2.

Issue #676
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112720746
2016-01-22 12:11:16 +00:00
andrewlewis
3f0244e214 Read gapless playback metadata in files with Xing metadata.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112699916
2016-01-22 12:11:16 +00:00
andrewlewis
4bea0b184f Fix warnings in OggVorbisExtractorTest and VorbisBitArrayTest.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112699244
2016-01-22 12:11:16 +00:00
andrewlewis
9d89d48f56 Fix ParsableByteArrayTest.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112693523
2016-01-22 12:11:16 +00:00
andrewlewis
bed89730a7 Fix path to Mockito for Eclipse.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112691130
2016-01-22 12:11:15 +00:00
andrewlewis
588d5a6e55 Parse encoder delay and padding from ID3 metadata in MP3.
Based on AOSP's MP3Extractor.cpp and ID3.cpp.

Issue: #497
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112685664
2016-01-22 12:11:15 +00:00
andrewlewis
25fb2a826e Merge MP3 sniffing/synchronization functionality.
As part of this change, Extractor.sniff may read/skip (not just peek) if it
returns true. This allows Extractors to avoid parsing the input a second time in
read.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112683272
2016-01-22 12:11:15 +00:00
andrewlewis
e6637c50c2 Fix a couple of compilation warnings.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112676296
2016-01-22 12:11:15 +00:00
Oliver Woodman
89ce1ccedf OggVorbisExtractor (WIP - Seeking not yet enabled) 2016-01-22 11:46:37 +00:00
Oliver Woodman
88fa1495c4 Use consistent naming for Xing headers/tags.
Also fix a couple of style nits.
2016-01-22 11:40:27 +00:00
Oliver Woodman
cef1f12f1d Add readString to ParsableByteArray 2016-01-22 11:40:02 +00:00
Oliver Woodman
eda8ac4e01 Add eventSourceId to onAvailableRangeChange events 2016-01-22 11:38:06 +00:00
andrewlewis
783467b8fb Work around broken MP3 decoder.
Issue: #398
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112412961
2016-01-18 19:22:47 +00:00
olly
a049382cd7 Treat seeks in HLS live to be at t=0, as in ExtractorSampleSource.
This makes sense until we need to support seeking in the live window.

Issue: #676
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112402026
2016-01-18 19:22:47 +00:00
olly
cef0f7a0b1 Apply flush workaround on S5 Mini devices with Exynos chipset.
Also apply the workaround for the secure variant of OMX.SEC.avc.dec.
Note that it's not necessary to do the same for the RK decoder in
the method below, since that workaround is targeted at SDK_INT<=17
and secure decoders only came along in 18.

Issue: #603
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112395376
2016-01-18 19:22:47 +00:00
ojw28
c01d0096ab Merge pull request #1155 from bartsidee/1095-dev
link track language attribute in Smoothstream parser
2016-01-16 15:37:07 +00:00
Bart van den Ende
8e1f14cbc3 resolve #1095 get language for all types, not just audio 2016-01-16 12:35:32 +01:00
Bart van den Ende
d5425bb64a resolve #1095 store the language as normalised attribute so we can access it from the track parser 2016-01-16 12:35:23 +01:00
Bart van den Ende
19cf24234c resolve #1095 map the audio track language to the element parser instead of the track parser 2016-01-16 12:35:04 +01:00
Oliver Woodman
9ab6c96169 Make TtmlColorParser comment a little clearer. 2016-01-15 19:18:19 +00:00
Oliver Woodman
c60dac7c46 Further tweaks to TTML color parsing. 2016-01-15 19:13:58 +00:00
Oliver Woodman
7974a61476 Fix TtmlColorParser test.
Also simplify the implementation slightly.
2016-01-15 19:06:27 +00:00
Oliver Woodman
b5c8595655 Resolve merge conflict 2016-01-15 18:53:30 +00:00
andrewlewis
284b7e7f28 Comment (e-)AC-3/DTS descriptor tags.
Also, use terminology from ATSC spec in Ac3Util comment.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112254908
2016-01-15 18:49:03 +00:00
andrewlewis
0900c53564 Set the passthrough buffer size based on encoded format bit rates.
After this change, AC-3 uses about 20 KB and DTS uses 49 KB.

For comparison, 'normal' PCM playbacks use by default (depending on the device
and input format) about 45 KB. For passthrough, the following buffer sizes were
used before this change:
- Nexus Player AC-3: 23 KB
- Nexus Player DTS: 25 KB
- NVIDIA Shield AC-3: 15 KB
- NVIDIA Shield DTS: 16 KB (caused underruns in some DTS-HD playbacks)
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112254836
2016-01-15 18:48:24 +00:00
andrewlewis
9bb124a011 Use uppercase for hex literals.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112252404
2016-01-15 18:47:43 +00:00
aquilescanta
5baf55176b Add support for Cue Settings and Spanned text in MP4WebVTT
Using the provided methods by the previous refactors, it is now possible to use all of the WebVTT features already available.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112243172
2016-01-15 18:47:00 +00:00
olly
d45f0b8b6d Reflow comments in Util.java
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112163984
2016-01-15 18:46:15 +00:00
aptly-io
e6132ed742 Fix RGBA color tuple parsing
The TTML 1 spec. defines an exact RGBA color tuple as #rrggbbaa
See https://www.w3.org/TR/ttml1/#style-value-color

Android's internal representation is ARGB.
The correct parsing therefore requires a bit of extra byte shuffling ...
2016-01-14 23:11:57 +01:00
olly
df7a96a7c4 Map SDK_INT for dev devices.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112162208
2016-01-14 18:14:00 +00:00
olly
e3da2cfb40 Treat .vtt as Webvtt as well as .webvtt.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112161960
2016-01-14 18:13:21 +00:00
olly
949317a41a Minor tweaks to merged pull requests.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112161860
2016-01-14 18:12:28 +00:00
olly
be2aedbd53 Don't consider switching tracks as "joining".
I'm not really sure how best to document this in TrackRenderer;
it's a bit of a weird feature. For now, I've gone with the vague
approach.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112150939
2016-01-14 17:13:32 +00:00
olly
2690f569af Enable track selection + WebVTT for HLS.
See the documentation of buildTracks for the gory details.

Issue: #151
Issue: #676
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112149293
2016-01-14 17:13:32 +00:00
aquilescanta
b6b97a8683 Expose cue settings parser
This CL exposes the cue settings parser in order to allow its usage from the MP4Webvtt extractor. Also fixes a few mistakes from the previous related CL.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112145806
2016-01-14 17:13:32 +00:00
olly
6b9a1b16f1 Fix issues playing FLV content.
* AudioTagPayloadReader was strangely parsing an audioSpecificConfig
  itself, using the parsed values to build a new audioSpecificConfig,
  then passing the newly constructed instance to be parsed by
  CodecSpecificDataUtil. Unfortunately the translation was lossy ;).
* Treat Duration=0 as an unknown duration.

Issue #1137
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112143569
2016-01-14 17:13:32 +00:00
olly
bc1d76a3eb Fix ParsableByteArray.readLine + discard BOM at start of line.
- I think \r and \n are handled the wrong way around?
- We only expect to encounter a BOM sequence at the start of a
  file, but it feels fine to automatically discard it in all
  cases for simplicity. A BOM sequence doesn't mean anything in
  UTF-8. See https://en.wikipedia.org/wiki/Byte_order_mark. Note
  that I think the advice not to remove it on that page relates
  only to the case where the file is being edited + saved.

Issue #1136
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112143407
2016-01-14 17:13:32 +00:00
andrewlewis
5ef1123391 Clarify @param bufferSizeContribution documentation.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=112127698
2016-01-14 17:13:32 +00:00
olly
59cf3e02f5 HlsChunkSource: Expose stuff for WebVtt/Variant selection.
Issue: #151
Issue: #676
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111945466
2016-01-14 17:13:32 +00:00
olly
2a9eeaa893 Fix HlsSampleSource use of LoadControl.
There are multiple issues with HlsSampleSource's use of
LoadControl that become apparent when you attempt to use
the same LoadControl for loads by another source.

* In the "limbo" state HlsSampleSource doesn't start any
  new loads, but doesn't update the LoadControl to tell
  it that it doesn't want to load anything either. This
  can prevent another source from starting the loads that
  it needs to make to complete preparation, causing
  playback to become stuck.
* The LoadControl isn't updated properly when the EOS is
  reached. This can cause playback to become stuck near
  the end of the media.
* If HlsSampleSource is released from being in the "limbo"
  state, it doesn't unregister itself with the control.

Issue: #151
Issue: #676
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111942009
2016-01-14 17:13:32 +00:00
olly
43fcb36924 Use APPLICATION_M3U8 as the mimeType for media playlists.
Given we need to do this in HlsPlaylistParser in the normal
case (i.e. not MEDIA_TAG), we may as well just be consistent
and do it everywhere.

Issue: #151
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111941335
2016-01-14 17:13:32 +00:00
eguven
8c8794878d Fixed demo-misc-vp9-opus-sw DASH check
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111839055
2016-01-14 17:13:32 +00:00
andrewlewis
b7d5ce366a Add a comment to explain the input size calculation.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111833857
2016-01-14 17:13:31 +00:00
rileya
c6cdf7e083 Add limited support for edit lists in fragmented MP4s.
Currently only supports a single offset to the full media timeline
(indicated by a duration of 0). This is most often used to fix the
non-zero starting presentation timestamp introduced when B-frames
are present.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111816916
2016-01-14 17:13:31 +00:00
cblay
aec9657c76 Internal refactor.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111746825
2016-01-14 17:13:08 +00:00
olly
ab9e3bac46 Introduce HlsTrackSelector.
This is equivalent to DashTrackSelector and SmoothStreamingTrackSelector.
This is a step toward allowing HlsChunkSource to expose multiple tracks,
which is a requirement for supporting WebVtt.

This change also enables WebVtt extractor instantiation.

Issue: #151
Issue: #676
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111698833
2016-01-14 17:08:25 +00:00
olly
00f8deda3d Introduce PtsTimestampAdjusterProvider for HLS WebVTT.
This allows the same adjusters to be used by multiple
HlsChunkSource instances. This is necessary because
WebVTT chunks will be loaded by a second chunk source
to the one loading audio/video. In both cases the same
timestamp adjustments will need to be applied.

Each source may transition from one discontinuity sequence
to the next at a slightly different time, so it's necessary
to maintain a separate adjuster for each sequence.

An adjuster can only be initialized correctly using audio/video
and not WebVTT, because the start time in a WebVTT file in
HLS doesn't necessarily correspond to the chunk start time,
which means the timestamp offset calculated by the adjuster
could end up being incorrect. Hence sources providing WebVTT
chunks will set isMasterSource to false. Lovely, right :(?

Issue: #151
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111693126
2016-01-14 17:08:25 +00:00
olly
b9ec51dbed SmoothStreaming track selector feature parity with DASH.
This gives DefaultSmoothStreamingTrackSelector feature parity
with DefaultDashTrackSelector. Note that the code duplication
across these classes will go away eventually, when we rework
track selection as described in Github Issue #1121.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111688784
2016-01-14 17:08:25 +00:00
olly
00e903b32e Don't pass maxWidth/Height for non-video streams.
This is a no-op change for clarity only. maxWidth/maxHeight
don't mean anything for AAC/MP3, so it makes sense to pass
MediaFormat.NO_VALUE in all cases.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111619832
2016-01-07 22:52:51 +00:00
aquilescanta
651996983b Refactored the Webvtt parsing classes
Moved the behaviors related to Cue's to the WebvttCueParser class.
This way, the parsing methods will be more easily accessible to
other classes, such as the MP4Webvtt parser. This class also has
some methods that require state to avoid repetitive avoidable
allocations. The method visibility is subject to changes in
further CLs.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=111616824
2016-01-07 22:52:34 +00:00