Commit graph

877 commits

Author SHA1 Message Date
Oliver Woodman
e48851d8cc Share PTS timestamp adjustment across format changes.
When switching format in HLS, we instantiate a new extractor, which
adjusts TS presentation timestamps so that they align properly with
the start of the first segment in the new format. Some HLS streams
appear to have slightly misalignment that causes a glitch when using
this approach.

It's better to re-use the same timestamp adjustment across formats,
and only reset it when seeking or when there's an actual discontinuity.
This is because the HLS spec guarantees PTS timestamp alignment across
different formats.

We'll also need something like PtsTimestampAdjuster to share between
separated audio and WebVTT tracks, which also contain PTS timestamps
that are aligned, and will need to share a common adjustment.

Issue: #692
2015-09-10 18:23:57 +01:00
Oliver Woodman
7d38d2ef3c CuePainter fixes for caption styling.
- Don't allow "nothing has changed" optimization in the case
  that only styling has changed (TextUtils.equals will return
  true in this case, but we shouldn't optimize).
- Add functionality to suppress embedded styling; seems useful
  to have.
- Added "this." for clarity.
2015-09-10 18:22:44 +01:00
Oliver Woodman
68f2dc5998 Remove MultiTrackChunkSource (multi track now supported directly). 2015-09-10 18:22:07 +01:00
Oliver Woodman
e6ca2df514 Fix end-of-stream for live streams.
Issue: #764
2015-09-10 18:21:21 +01:00
Oliver Woodman
89fcafec5b Correctly set a format duration. 2015-09-10 18:20:07 +01:00
Oliver Woodman
820433de06 Call stop() to fully play out remaining audio!
Issue: #707
2015-09-10 18:19:09 +01:00
Oliver Woodman
9bcc00f369 Fix reported buffered position for HLS across format switches. 2015-09-10 18:16:42 +01:00
Oliver Woodman
a7ba393d54 When multiple BaseURL elements are present, prefer the first one.
Issue: #771
2015-09-10 18:16:23 +01:00
Oliver Woodman
4a29be498b Correctly use "current-manifest-live" v.s. "stream-is-live"
When a live stream ends, what typically happens is that the manifest
is refreshed and the refreshed version is not marked as live/dynamic.
When this happens we:

1. Don't want the duration of the track to change.
2. Still want to consider the possibility that we may have fallen behind
   the live window.
3. Don't want to allow futher manifest refreshes.

This change uses the right thing in the right place.
2015-09-10 18:15:15 +01:00
Oliver Woodman
143a4deee8 If no buffers were queued, handle EoS directly.
Issue: #707
2015-09-10 18:12:32 +01:00
Oliver Woodman
59a789b340 Include missing durations in AC3/DTS formats. 2015-09-10 18:11:18 +01:00
Ian Bird
4b69fad6b7 Ignore extra returns in Subrip parsing 2015-09-09 11:56:10 +01:00
Oliver Woodman
5c0745cedf Add some generally useful error propagation logic for HLS.
Issue #765
2015-09-07 13:59:55 +01:00
Oliver Woodman
5d1052f6ec Allow specifying the AudioTrack's stream type.
Issue: #755
2015-09-07 13:58:54 +01:00
Oliver Woodman
ab2aac9d3f Infer mime types from DASH manifest. 2015-09-07 13:58:31 +01:00
Oliver Woodman
9592a8a4ff Fix IFR parsing 2015-09-07 13:57:45 +01:00
Oliver Woodman
8c3f93d6bf Start to fix media mime types.
- Admit we don't know the mime type (using unknown mime types) rather
  than passing the container mime type.
- Pass the correct mime type for opus, vp9 and vp8, and remove the incorrect
  container checks in the corresponding extensions.
2015-09-07 13:56:54 +01:00
Oliver Woodman
4104a8def9 Handle raw TTML in DASH correctly. 2015-09-07 13:55:35 +01:00
Oliver Woodman
7a0f00ce41 No-op setting volume to current volume. 2015-09-01 14:23:35 +01:00
Oliver Woodman
3c65df92c2 Allow multiple sources for text.
Issue #753
2015-09-01 14:23:10 +01:00
Oliver Woodman
ecd48da1de Multi-track support for DASH.
- With this change, you can select from the individual video formats in
the demo app, as well as the regular "auto" (adaptive) track.
- DashRendererBuilder no longer needs to create MultiTrackChunkSource
instances for the multiple tracks to be exposed.
2015-09-01 14:22:18 +01:00
Oliver Woodman
6cf261aed7 Move default SmoothStreaming track selection to library. 2015-09-01 14:20:23 +01:00
Oliver Woodman
4b2991267e Some renaming to make format use slightly clearer. 2015-09-01 14:19:40 +01:00
Oliver Woodman
fae6c65367 Be robust against manifests that don't define top level duration explicitly.
I think such manifests are invalid, and I haven't seen any examples,
but given it's trivial to fill in the duration if the periods define
durations, it seems worth being robust.
2015-09-01 14:19:06 +01:00
Oliver Woodman
2f4c96781d Refactor handling of period start times and durations.
- It's not possible to determine a period's duration just from the
corresponding Period element in a DASH manifest. It's necessary
to look at the start time of the next period (or the duration of the
manifest for the last period) to determine how long a period is. We
don't currently do this in the parser, and hence set duration incorrectly.
We also set period start times incorrectly because we don't set it to
equal to sum of the durations of prior periods in the case where it's
not explicitly defined.

- We're currently propagating these (incorrect) values all over the place
through data-structures that we build when parsing the Period element.

- This CL removes this redundancy, storing only the start time of each
period in Period elements, and not propagating it elsewhere. It's then
used when required in DashChunkSource.
2015-09-01 14:18:28 +01:00
Oliver Woodman
cb85dc25aa Clean up max dimension handling. 2015-09-01 14:17:21 +01:00
Oliver Woodman
a953e7217f Fix naming/documentation for SmoothStreaming. 2015-09-01 14:16:02 +01:00
Oliver Woodman
a704b3d338 Tweak video renderer. 2015-09-01 14:15:20 +01:00
Oliver Woodman
f8824ac390 Support dynamic TimeRange for DASH live. 2015-09-01 14:14:10 +01:00
Oliver Woodman
d5f8d1a1b1 Don't crash updating a representation without an index. 2015-09-01 14:13:22 +01:00
Oliver Woodman
ebeafe23c0 Refactor multi-period Period updates.
The main change here is to add PeriodHolder.updatePeriod, which is
analogous to RepresentationHolder.updateRepresentation.
2015-09-01 14:12:52 +01:00
Oliver Woodman
b55a80dbf9 Fixed potential issue in which a live-edge latency greater than the duration of the manifest would result in the latest available time being lower than the earliest available time. 2015-09-01 14:12:22 +01:00
Oliver Woodman
476cefa7cc Remove extra constructors. 2015-09-01 14:11:50 +01:00
Oliver Woodman
96734144ba Extract DTS samples in DASH, MP4 and Matroska. 2015-09-01 14:07:28 +01:00
Oliver Woodman
bca2d16cc1 Specify locale when using String.format. 2015-09-01 14:06:16 +01:00
Oliver Woodman
adf82c7f5e Correctly read mimeType for ISO 13818-7 objectTypeIndication values.
Issue: #731
2015-09-01 14:05:43 +01:00
Oliver Woodman
83568ca52f Support MKV embedded SubRip captions. 2015-09-01 14:04:58 +01:00
Oliver Woodman
009d4d0c2c Fix retries if failure occurrs when reading seek map.
The following sequence was problematic:

1. See start of a cluster having not output a seek map. Decide
   to seek for the cues. Enter CUES_STATE_BUILDING state.
2. Error occurs before seek map is output.
3. ExtractorSampleSource isn't prepared yet, so restarts from the
   start of the stream.
4. See start of the same cluster having not output a seek map.
   This time cuesState is CUES_STATE_BUILDING, so we just carry
   on. We then fill the buffer with sample data, despite the
   source not being prepared, at which point we get stuck.

It's unclear to me why cuesState needed three states, so I've rm'd
the BUILDING state. Step (4) above will now do the same thing as
in step (1). If the failure repeats, we'll eventually fail, which
is WAI.
2015-09-01 14:03:45 +01:00
Oliver Woodman
b3ba7e16c1 Close DefaultHttpDataSource connections quietly. 2015-09-01 14:02:16 +01:00
Oliver Woodman
10badcc430 Support multi-track in MKV/WebM extractor.
Issue: #514
2015-09-01 14:01:43 +01:00
Oliver Woodman
e07c35815e Don't move to next subtitle too soon.
Second time lucky. We should just move to the next subtitle
when it's started. Simples.
2015-09-01 14:01:06 +01:00
Oliver Woodman
530aa265ff Fix playback of MKV audio tracks that use default channel/frequency vals.
Also do some significant cleanup to the extractor.
2015-09-01 14:00:37 +01:00
Oliver Woodman
64c0e5c997 Use XING headers without size/table of contents.
These MP3s are unseekable but allow calculating the VBR duration correctly.

Treat streams as live only if they are unseekable and lack a duration.

Issue: #713
2015-09-01 13:59:34 +01:00
Oliver Woodman
6799d6dad0 Fixed issue where calling valueAt on a SparseArray with an index greater than the size of the SparseArray would sometimes return the class' internal DELETED object and cause a ClassCastException. 2015-09-01 13:58:57 +01:00
Oliver Woodman
7bf1d89168 Fixed overlapping captions. 2015-09-01 13:58:22 +01:00
Oliver Woodman
9231520ee8 Some misc cleanup.
- Remove unused method in DashChunkSource.
- Remove inputEncoding parameter for subtitle parsers. We're
  ignoring it in all but one of the parsers, and for the one
  that does use it, it'll only ever receive null, since that's
  all we're passing.
- Make TextTrackRenderer advance to the next subtitle even if
  the current one hasn't finished, in the case that they overlap.
  This shouldn't ever really happen, but it seems best to trust
  the start time of the new sample rather than the last event
  time of the previous one.
2015-09-01 13:57:51 +01:00
Oliver Woodman
8e9aadc5e5 Workaround for vorbis EOS flush bug (23361053).
I'm assuming this will be fixed in API level 24.
2015-09-01 13:56:10 +01:00
Oliver Woodman
879da81218 Expose more sensible HLS track information.
- Video track is always marked as adaptive, the resolution is
  stripped out (since it's otherwise just set to whatever the
  resolution of the first selected variant is), and the max
  dimensions are set.

Issue #514
2015-09-01 13:55:02 +01:00
Oliver Woodman
0efaec59b8 Implemented limited support for multi-period DASH manifests.
Limitation: Successive periods must expose the same adaptation
sets and representations.

GitHub Issue: #557
2015-09-01 13:54:00 +01:00
Oliver Woodman
f69f948991 Fixed issue in which ContainerMediaChunk would throw an NPE for self-initializing chunks. 2015-09-01 13:52:30 +01:00
Patrik Åkerfeldt
c373800492 Enable override of open/close in StreamingDrmSessionManager
Make it so that extensions of StreamingDrmSessionManager may override open/close.
2015-08-27 09:20:57 +02:00
Oliver Woodman
25fe9db5d1 Set the sync flag on all audio samples in WebM.
Issue: #690
2015-08-19 16:35:32 +01:00
Oliver Woodman
cde1c27e2b Make Opus codec-specific data match the platform.
Issue: #690
2015-08-19 16:34:59 +01:00
Oliver Woodman
02f1efd118 Add bitrate to MediaFormat.
Issue: #514
2015-08-19 16:34:20 +01:00
Oliver Woodman
ff201db981 Allow renderers to pull tracks from multiple sample sources.
This is needed for several use cases:

- ExtractorSampleSource with option to play both embedded and out-of-band
  subtitles.
- HLS multi-audio and out-of-band-webvtt.
2015-08-19 16:33:01 +01:00
Oliver Woodman
ea7caf4f91 Bit of a hack to pass through original MediaFormat from FrameworkSampleSource. 2015-08-19 16:32:33 +01:00
Oliver Woodman
c9d9808013 Make getRendererEnabled behavior the same as it used to be, until it's removed. 2015-08-19 16:32:01 +01:00
Oliver Woodman
679fa8de03 Only use passthrough for passthrough MIME types. 2015-08-19 16:31:28 +01:00
Oliver Woodman
e770e5c24b Multi-track - The (nearly) final step.
- Migrate demo app to use new APIs.
- Add multi-track support for ExtractorSampleSource case.
- Add multi-track support for SmoothStreaming use case.

The final step is to add support back for the DASH use case and
delete MultiTrackChunkSource. This is blocked on multi-period support
landing, in order to prevent a horrendous merge conflict. We also
need to update HLS to expose sensible track information.

Issue: #514
2015-08-19 16:29:30 +01:00
hori-ryota
3714751b95 Fixed bug of AES URI Pattern for hls 2015-08-19 18:22:33 +09:00
Oliver Woodman
3b9ca40b05 Add ISO 14496-30 embedded TTML (stpp) subtitle support.
Issue: #689
2015-08-17 17:15:53 +01:00
Oliver Woodman
38f2413290 Allow ChunkSource an opportunity to fail preparation.
When ChunkSource implementations implement multi-track for DASH and SS,
format selection will move inside of ChunkSource. If we, for example, fail
to query the decoder to determine which tracks are playable, we need an
opportunity to fail (i.e. say we're not prepared, so that maybeThrowError
is called, from which we can throw).

This may go away in the future if we remove the distinct preparation step
and treat tracks/formats as things that can change dynamically, but for now
this is what we have.

Issue #514.
2015-08-17 17:14:21 +01:00
Oliver Woodman
d49d5a1765 Fix reading HEVC in MPEG TS.
Fix reading the first slice flag, which before could cause a read out of bounds
if the NAL unit started at the end of the buffer.

Handle non-VCL NAL units by flushing a pending sample when starting to read one.
2015-08-17 17:13:23 +01:00
Oliver Woodman
37ebec6e82 Skip more than one ID3 header.
Issue: 713
2015-08-17 17:12:33 +01:00
Oliver Woodman
90f9f7314d Allow MediaFormat to express that it's adaptive (not yet used).
Also:
- Better document MediaFormat.
- Document getFormat to indicate what it's good (and not good) for.
2015-08-17 17:11:37 +01:00
Oliver Woodman
6e527c550f Expose new multi-track APIs in the ExoPlayer interface + plumb
multi-track support upstream to the ChunkSource interface.

This change does not yet make use of the newly exposed APIs. This
will come in a subsequent CL.

Issue #514.
2015-08-17 17:09:55 +01:00
Oliver Woodman
bf77f3b289 Simplify subtitle parsing.
- Currently all subtitles we parse contain timestamps relative to the sample
  timestamp, however we add the sample timestamp in inconsistent ways (sometimes
  in the Subtitle, sometimes in the SubtitleParser). This change converges on
  a single approach. It also paves the way for passing absolute offsets to use
  instead, and being able to apply them in a consistent way in a single place
  (PlayableSubtitle). This functionality will be required for ISO 14496-30 TTML
  embedded subtitles.

Issue: #689
2015-08-13 20:36:50 +01:00
Oliver Woodman
fbf590fdf6 Fix reading PCM configuration in HEVC SPS. 2015-08-13 20:35:52 +01:00
Oliver Woodman
6b44c6e6b1 Fix single sample loading + seeking in HLS.
Issue #587
2015-08-13 20:32:09 +01:00
Oliver Woodman
d3995eaa7a Fix rotation handling as far as is possible.
Issue: #91
2015-08-13 11:18:15 +01:00
Oliver Woodman
8db1331021 Propagate MediaFormat instead of TrackInfo.
Issue #514.
2015-08-11 18:23:22 +01:00
Oliver Woodman
f7ffeb75cf Parse pixel aspect ratio from SPS for use when there's no pasp atom.
Issue: #697
2015-08-11 18:18:19 +01:00
Oliver Woodman
69466adbe3 Remove unused exception class. 2015-08-11 18:17:33 +01:00
Oliver Woodman
02c7525ff7 Remove custom VTT logic. 2015-08-11 18:16:56 +01:00
Oliver Woodman
dbaeecc4da Improve DASH manifest parsing.
- Parse all attributes that may exist in either the AdaptationSet or
  in the child Representation elements at both levels.
- Correctly infer TYPE_TEXT for Representation elements whose mimeType
  is application/mp4 and whose codecs attribute indicates a known text
  codec type.

Issue: #689
2015-08-11 18:12:43 +01:00
Oliver Woodman
d6152dc36a Use MediaFormat.language in hashCode and equals. 2015-08-11 18:11:35 +01:00
Oliver Woodman
7d306ae593 Add language to MediaFormat + parse it from mdhd box.
+ Move conversion from framework -> exo format to FrameworkSampleSource.
+ Improve MediaFormat conversion test.
2015-08-11 18:10:46 +01:00
Oliver Woodman
b2206866f0 Use audio passthrough if possible, falling back to on-device codecs.
Remove MPEG TS stream filtering based on AudioCapabilities.

Pass AudioCapabilities to MediaCodecAudioTrackRenderer so it can choose between
passthrough/raw and decoding for AC-3 tracks.
2015-08-11 18:08:23 +01:00
Oliver Woodman
6085d185fa Internal plumbing for multi-track support.
- Generalize rendererEnabledFlags to be selected track indices through
  ExoPlayerImpl/ExoPlayerImplInternal.
- Selecting an out-of-bound track index (e.g. -1) is equivalent to
  disabling a renderer prior to the generalization.
- A prepared TrackRenderer that exposes 0 tracks is equivalent to a
  TrackRenderer in the STATE_IGNORE state prior to the generalization.

Issue #514.
2015-08-11 18:06:21 +01:00
Oliver Woodman
13f4a3e3bd Common base class for SampleSource based TrackRenderers.
This will allow multi-track support when consuming from a SampleSource to
be added in a single class, rather than in 6. Prep for Issue #514.
2015-08-11 18:04:00 +01:00
Oliver Woodman
150b3cdb19 Call AudioTrack.flush() before AudioTrack.release().
On NVIDIA Shield, recreated passthrough AudioTracks have incorrect playback head
positions, due to shared state with the previously destroyed passthrough
AudioTrack. Calling AudioTrack.flush() before AudioTrack.release() ensures this
state is cleared.

This is a safe change so I have not made it a device-specific workaround. The
combined time for flush and release is less than 10 ms (with flush normally
taking less than two ms).
2015-08-11 18:00:42 +01:00
Oliver Woodman
f129812b70 Clean up AudioCapabilities. 2015-08-11 17:59:24 +01:00
Oliver Woodman
adf98b0fcc Make seekTo(currentPosition) a no-op in ExoPlayer.
- Also avoid boxing when passing the seek position to the background
  thread.

Issue: #654
2015-08-11 17:55:19 +01:00
Oliver Woodman
ce26e601ed Fix typo in H265Reader.
See H.265/HEVC specification subsection 7.3.4.
2015-08-11 17:47:02 +01:00
Oliver Woodman
ab3f623767 Workaround broken devices.
Issue #464
Issue #665
2015-08-07 17:28:03 +01:00
Oliver Woodman
a7d843f90d Increment version to 1.4.2 2015-08-04 16:07:54 +01:00
Oliver Woodman
039cddd6c0 Don't require comma in EXTINF tags 2015-08-04 13:50:15 +01:00
Oliver Woodman
d3ce56f9bc Fix commented code 2015-08-03 15:18:23 +01:00
Oliver Woodman
574e554e01 Make classes/methods final to prevent uncontrolled extension. 2015-08-03 15:18:09 +01:00
Oliver Woodman
ed51b58242 Fix backoff for SingleSampleSource. 2015-07-30 17:16:19 +01:00
Oliver Woodman
5f51a4ff83 Cleanup - Make RollingSampleBuffer append methods more consistent. 2015-07-30 17:13:24 +01:00
Oliver Woodman
0d42032ada Aes128DataSource should be final. 2015-07-30 10:05:54 +01:00
Oliver Woodman
a56c00268d Remove ability to disable frame accurate seek.
Everything I've seen that uses ExoPlayer sets it to true, and
setting it to false is poorly supported / likely to result in
bad initial A/V sync after each seek.
2015-07-30 10:05:04 +01:00
Oliver Woodman
e90ad9c47d Make Aes128DataSource private to the HLS package.
Issue: #662
2015-07-29 22:35:48 +01:00
Oliver Woodman
1f0e6a5c46 Simplify subtitle loading with a SingleSampleSource.
Issue: #587
2015-07-29 21:58:59 +01:00
Oliver Woodman
98ecc209be Improvements to Mp4Extractor and FragmentedMp4Extractor.
- Make Mp4Extractor more robust when resuming from read failures.
- Made FragmentedMp4Extractor handle atoms with extended sizes.

Issue #652
2015-07-29 21:49:19 +01:00
Oliver Woodman
2f0aec43ec Don't print warning if we get a SeekMap when reading DASH chunks.
Both FragmentedMp4Extractor and WebmExtractor now invoke seekMap() with
SeekMap.UNSEEKABLE if there isn't an index in the stream, so DASH playbacks
will end up printing this warning every 5 seconds or so. This is obviously
not desirable, so this CL just removes the warning! The alternative would
have been to print a warning if the value is anything other than UNSEEKABLE,
but it doesn't really seem worth it.
2015-07-29 21:48:17 +01:00
Oliver Woodman
08dc691ff7 Allow playback of unseekable fmp4 media.
This is useful to allow playback of individual segments from a
DASH stream as regular fmp4 files. These segments don't typically
contain a segment index. For playback to start, we need to invoke
seekMap with the UNSEEKABLE index. We do this if we haven't seen
a segment index when we encounter an mdat box (if one were present,
it would have been located earlier than this point).
2015-07-27 16:20:40 +01:00
Oliver Woodman
9e0ca9e7f0 Add support for reading MPEG 4 SP in matroska streams.
Issue: #641
2015-07-23 14:50:57 +01:00
Oliver Woodman
03305c92cf Modified timing of manifest fetches to compensate for drift due to fetch time. 2015-07-23 13:44:52 +01:00
Oliver Woodman
7ea199638e Content/Asset data sources - Handle >2^31 byte files correctly.
Issue #641
2015-07-23 13:44:11 +01:00
Oliver Woodman
b57b80f723 Multiple small fixes for subtitles/mp4.
1. [Cleanup] Remove unused Track types, including TYPE_TIME_CODE.
2. Add subtitle track type, which is different to the existing text type.
3. Set duration on the media formats for text and subtitle tracks. This
   was causing the player to report unknown media duration for mp4 files
   containing such tracks.
4. Make TextTrackRenderer do the right thing when not started.

Issue: #635
2015-07-23 13:43:48 +01:00
Oliver Woodman
b44de0d250 Improve sniffer error reporting.
- Make UnrecognizedInputFormatException public so the app can more easily handle
  it when it is propagated to onPlayerError.
- Format the description using the simple class names for the extractors.
- Don't retry loading after it's thrown, but just throw immediately.
2015-07-23 13:14:06 +01:00
Oliver Woodman
4c1fb0c977 Don't catch API 19 exception from newInstance. 2015-07-23 13:12:57 +01:00
Oliver Woodman
a44a78c72d Fix some HEVC and H.263 nits. 2015-07-23 13:12:01 +01:00
Oliver Woodman
9dc1bfbbe7 Support POST requests with DefaultHttpDataSource/DataSpec 2015-07-23 13:10:59 +01:00
Oliver Woodman
6b03e6a17c Fix MP4+MKV sniffing to handle empty atoms / EBML elements.
Issue: #641
2015-07-22 18:46:46 +01:00
ojw28
648f224d98 Merge pull request #639 from IanDBird/mkv-hevc
Add support for HEVC video in Matroska files
2015-07-22 16:14:11 +01:00
ood_tsen
cf2e539a31 add support s263 2015-07-22 21:08:38 +08:00
Oliver Woodman
85e0bca33d Add support for choosing an extractor based on sniffing the container.
- ExtractorSampleSource takes an array of extractors to test for suitability.
- Extractors now implement a sniff() method that returns whether they can
  extract samples in the input stream's format.
- Switch demo app samples to use format detection.

Issue: #438
2015-07-21 17:39:38 +01:00
Oliver Woodman
87daa912d7 Remove dead code (failed==false in all cases) 2015-07-21 17:36:07 +01:00
Oliver Woodman
3b34b0682c Handle the last MP3 sample being truncated without throwing.
Issue: #599
2015-07-21 17:35:09 +01:00
Oliver Woodman
ed2b65654c Cleanup UdpDataSource. 2015-07-21 17:34:37 +01:00
Ian Bird
646b39622f Add support for HEVC video in Matroska files 2015-07-21 15:24:35 +01:00
Oliver Woodman
a2f10399e7 Improve error propagation 2015-07-21 10:07:49 +01:00
Oliver Woodman
5df6854fea Noop tweak to DefaultHttpDataSource 2015-07-21 10:05:22 +01:00
Oliver Woodman
e7950555d3 Generalize MulticastDataSource to UdpDataSource 2015-07-21 10:05:04 +01:00
Oliver Woodman
eb4920bb2a Better compatibility with MKV test streams.
1. Fix seeking in test2.mkv by handling non-default timescale
   after duration.
2. Fix handling of missing cues in test6.mkv by allowing playback
   to continue (but all seeks will reset to t=0).

Issue #631
2015-07-21 10:01:15 +01:00
Oliver Woodman
7bc1241e06 Reflect subtitle parsers. 2015-07-21 09:59:22 +01:00
Oliver Woodman
6082bb6769 Always use timed video frame release on V21+. 2015-07-21 09:58:38 +01:00
Oliver Woodman
508e1cabe1 Always null inputStream, even if closing it failed. 2015-07-21 09:57:51 +01:00
Oliver Woodman
d8c874f7d8 Correct grammar 2015-07-17 12:01:32 +01:00
Oliver Woodman
0279a9f791 Bump version to 1.4.1 2015-07-17 11:49:48 +01:00
Oliver Woodman
119c473606 Temporary fix to prevent premature failures during HLS playbacks II. 2015-07-17 11:48:42 +01:00
Oliver Woodman
7c2d635565 Minor fixes for Javadoc warnings 2015-07-16 21:48:14 +01:00
Oliver Woodman
8a7d68da6c Don't render empty cues 2015-07-16 20:22:35 +01:00
Oliver Woodman
ebe9ae6b13 In continueBuffering, return whether a particular track has samples.
Issue: #595
2015-07-16 19:30:14 +01:00
Oliver Woodman
17c1b630b8 Bump version to 1.4.0 2015-07-16 18:26:50 +01:00
Oliver Woodman
67b4775681 Temporary fix to prevent premature failures during HLS playbacks 2015-07-16 17:59:41 +01:00
Oliver Woodman
85256bef41 Add support for MP3 audio in Matroska files.
GitHub issue: #589
2015-07-15 19:55:35 +01:00
Oliver Woodman
79db618ba6 Add support for header stripping in Matroska streams.
Issue: #589
2015-07-15 18:53:32 +01:00
Oliver Woodman
6c2b3c875d Handle unbounded ranges in DASH manifests. 2015-07-15 18:52:57 +01:00
Oliver Woodman
2b0f68a0ab Rm Timescale from AudioTrack. Not required. 2015-07-15 11:27:10 +01:00
Oliver Woodman
72d42fbc9f Fix an issue where retrying WebM extraction failed.
The ID_SEGMENT can only be read once, as seeing the element a second time is
assumed to indicate that the file contains multiple segment elements (which is
not supported).

This change allows the element to be read twice if it is at the same position,
so that retrying loading from the start can succeed.
2015-07-15 11:15:21 +01:00
Oliver Woodman
4282d7c22b Update MediaCodecTrackRenderer.
1. Workaround for decoders that fail to handle the END_OF_STREAM flag.
2. Revert processing of final output buffer if it's non-empty. This
   introduced another bug (#596)

Reverts: b88012f51f
Issue: #417
Issue: #596
2015-07-15 11:11:41 +01:00
Oliver Woodman
884e7a4170 Optimize captions.
SubtitleLayout no longer trigger re-layouts of the view hierarchy.
Instead, the SubtitleLayout just invalidates itself. This is made
possible by making SubtitleLayout a regular View that draws each Cue
directly onto the canvas, rather than having SubtitleLayout be a
ViewGroup with a child View for each Cue.
2015-07-15 11:10:53 +01:00
Oliver Woodman
c1e1497d13 Change how subtitles are laid out in the demo app.
The SubtitleLayout is now properly aligned with the surface.
This means the subtitles remain on top of the video in portrait
mode, rather than being huge and below it.
2015-07-15 11:09:20 +01:00
Oliver Woodman
fe52a486f4 Inject Allocator into ExtractorSampleSource. 2015-07-15 11:05:15 +01:00
Oliver Woodman
b4879236b5 Document usage of MATCH_LONGEST_US.
Handling of this constant is already in place everywhere, this
just documents that its use is allowed.
2015-07-15 11:01:44 +01:00
Andrew Lewis
2358004951 Add device-specific workarounds for VP8 and MP3.
Avoid using the VP8 decoder on Samsung Galaxy S4 Mini.
Issue: #548

Avoid using the MP3 decoder on Sony Xperia Z/API level 16.
Issue: #377
2015-07-10 11:47:24 +01:00
Andrew Lewis
c47c6816e4 Detect frames using first_slice_segment_in_pic_flag. 2015-07-10 11:46:30 +01:00
Oliver Woodman
ead8abf09f Fixed incorrect caption sizes after device orientation change. 2015-06-30 13:50:14 +01:00
Oliver Woodman
35a9f2635c Use Locale.US in calls to String.format.
Issue: #585
2015-06-30 13:49:03 +01:00
Oliver Woodman
588be2bd4b Fix intermittent decoder crash when playing MP3 inside MP4 2015-06-26 16:53:52 +01:00
Oliver Woodman
3bcd9ca6c3 Simplify HLS MP3 support. 2015-06-26 14:44:10 +01:00
Oliver Woodman
0c577ce2ce Merge branch 'tresvecesseis-dev' into dev 2015-06-26 14:41:59 +01:00
Oliver Woodman
7fb5b86579 Merge branch 'dev' of git://github.com/tresvecesseis/ExoPlayer into dev 2015-06-26 14:41:47 +01:00
Oliver Woodman
faff85784b Use the right overload of createAudioFormat in Ac3Util. 2015-06-26 14:40:13 +01:00
Oliver Woodman
a4ff13d7da Set a MIME type based on the esds ObjectTypeIndication.
Issue: #576
2015-06-26 14:37:48 +01:00
Oliver Woodman
a626a5e5d4 Take period start time into account when calculating segment times. 2015-06-26 14:35:57 +01:00
Oliver Woodman
2b27137e9e Fix bug that caused failure when all renderers disabled.
Prior to this change, there was a bug where playback would
fail with the following steps:

1. Start playback.
2. Pause playback.
3. Disable all renderers.
4. Enable at least one renderer.
5. Resume playback.
2015-06-26 14:33:08 +01:00
Oliver Woodman
33d55631ed Fix handling of pixel aspect ratio change.
The new logic assumes that an input format change will be
followed by an output format change, but I think this is
pretty much guaranteed. If this weren't to happen then the
new pixel aspect ratio wont be picked up, but I think it's
extremely unlikely (it would require the format to stay
exactly the same except for the pixel aspect ratio, which
would be bizarre).
2015-06-26 14:31:13 +01:00
Oliver Woodman
c7635c9dbd Add some audio hooks.
This makes it easier to add an extension for adjusting
audio playback rate.
2015-06-26 14:29:45 +01:00
Oliver Woodman
b88012f51f Process final output buffer if it's non-empty.
Issue: #417
2015-06-26 14:28:50 +01:00
Oliver Woodman
fb31fe0fe4 Fix stale comment 2015-06-26 14:27:17 +01:00
Oliver Woodman
b394c46128 Add utility method to query whether device is an AndroidTV. 2015-06-26 14:26:54 +01:00
Oliver Woodman
a1ab1fc2a2 Detect WebVTT file header according to the spec:
1. An optional U+FEFF BYTE ORDER MARK (BOM) character.
2. The string "WEBVTT".
3. Optionally, either a U+0020 SPACE character or a U+0009 CHARACTER
   TABULATION (tab) character followed by any number of characters that
   are not U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters.
4. Exactly one WebVTT line terminators to terminate the line with the file
   magic and separate it from the rest of the body.

Issue: #580
2015-06-26 14:26:31 +01:00
Oliver Woodman
712756c3e8 Cleanup regex in MPD parser 2015-06-26 14:24:37 +01:00
Oliver Woodman
98d446aa6d Allow seeding of RandomEvaluator.
This is useful for reproducibility in playback tests.
2015-06-26 14:24:00 +01:00
Oliver Woodman
c06f844ee1 SUPER! 2015-06-25 20:57:21 +01:00
Oliver Woodman
ed856b2a71 Test 2015-06-25 19:17:00 +01:00
Oliver Woodman
5e65b40864 Merge branch 'dev' of git://github.com/tresvecesseis/ExoPlayer into tresvecesseis-dev 2015-06-25 18:51:20 +01:00
Andrew Lewis
e328546607 Make reusable fakes for extractor+track outputs.
Improve Mp4Extractor test.

Add support for Xiph lacing in Matroska files.

Add support for EBML lacing in Matroska files.

Handle the initial sticky intent for HDMI audio plug.
2015-06-23 17:57:41 +01:00
Oliver Woodman
bc14e87cfb Tighten package visibility 2015-06-22 15:57:06 +01:00
Oliver Woodman
4092e8ca0f Fix GitHub issue #572 2015-06-22 15:50:18 +01:00
Oliver Woodman
91b47cfe6b Tweak 2015-06-22 11:08:00 +01:00
Oliver Woodman
2f268a9962 Fix final issues with HLS 404 handling #537 2015-06-22 11:04:23 +01:00
Oliver Woodman
97aaee6d15 Fix crash introduced by previous change. 2015-06-19 20:05:34 +01:00
Oliver Woodman
b8df8ecb47 Final fixes for correctly handling chunk load failures in HLS.
An accumulation of several fixes:

1. Change to HlsExtractorWrapper is just a move + documentating
   things that were already true + adding a precondition in the
   configureSpliceTo method.

2. Change in HlsSampleSource.readData ensures that configureSpliceTo
   and hasSamples aren't called on an extractor that isn't prepared.

3. The other change in HlsSampleSource ensures the correct "previous"
   TsChunk is used. If a TsChunk fails to load and is replaced, the
   previous chunk should be the one before that whose load completed
   successfully.

4. Determine switchingVariantSpliced based on the actual format of the
   previous chunk, so it's set correctly in the case of a TsChunk load
   failure and subsequent replacement.
2015-06-19 19:55:12 +01:00
Oliver Woodman
203f3ab732 Get the current extractor properly.
This fixes the case where we need to switch from one variant to
another during preparation, having loaded zero samples, because
the first chunk for that variant gave us a 404 error. In this
case the first extractor will have no samples, and there will
be a second extractor that does.
2015-06-19 13:31:16 +01:00
Oliver Woodman
55862a77b1 Remove dead code 2015-06-18 18:53:22 +01:00
Oliver Woodman
51a8635ba2 Make HlsChunkSource sane again.
There was a mess where we were indexing into both a list of variants
and a (differently ordered and possibly of differing length) list of
formats. This sanitises everything.
2015-06-18 18:01:47 +01:00
Oliver Woodman
e0316d1c16 Refine TTML parsing logic + setup for adding styling information.
1. Refine the way TtmlNode handles whitespace collapsing when constructing
   the output text. Can of worms.
2. Start using SpannableStringBuilder. This will allow attaching of spans
   in getText as nodes are encountered, which is how we'll be incorporating
   styling information into the result.
2015-06-18 17:31:14 +01:00
Oliver Woodman
efa92ac168 Tiny cleanup 2015-06-18 14:30:08 +01:00
Oliver Woodman
160a88baf9 Steps toward enabling seeking in DASH live 2015-06-18 14:28:54 +01:00
Oliver Woodman
8e58a3f5f5 Steps toward full multi-track support.
1. Remove requirement for TrackRenderer implementations to report
   current position, unless they are time sources.
2. Expose whether renderers have media to play. The immediate benefit
   of this is to solve the referenced GitHub issue, and also to only
   display the appropriate Audio/Video/Text buttons in the demo app
   for the media being played. This is also a natural step toward
   multi-track support.

Github issue: #541
2015-06-18 14:27:24 +01:00
Oliver Woodman
2c29d88330 Remove unnecessary call to seekTo. 2015-06-18 14:22:17 +01:00
Oliver Woodman
0ee8c07fe5 Better handle duration + disabled renderers
- Fix bug where duration of initially disabled tracks wasn't correctly
  incorporated into the overall duration reported by the player.
- Don't transition to STATE_ENDED unless the position has reached the
  duration, if the duration is known. This allows for "playback" to
  continue when all renderers are disabled, rather than jumping straight
  to STATE_ENDED.
2015-06-18 14:21:32 +01:00
Oliver Woodman
072c63c33e Handle stbl atoms with no samples.
Github issue: #554
2015-06-18 14:18:09 +01:00
Oliver Woodman
8c98c588e8 Add support for fixed-size lacing in Matroska streams. 2015-06-18 14:17:32 +01:00
Oliver Woodman
4c4782c72d Pass whole PSSH box to MediaDrm (except in the WV+L case).
This fixes SmoothStreaming on AndroidTV, and also removes a
warning that gets logged when using Widevine/FMP4.
2015-06-18 14:16:37 +01:00
Oliver Woodman
d0ba265290 Fix some MPD parsing issues.
- contentType can be defined on an AdaptationSet.
- language can be defined either in AdaptationSet or in a contained
  ContentComponent.
- The id from the AdaptationSet should come from the AdaptationSet.
2015-06-18 14:13:54 +01:00
Oliver Woodman
54d207f3ce Default caption parsers to non-strict parsing. 2015-06-18 14:12:33 +01:00
Oliver Woodman
39adcabf7d Blacklist variants if media or encryption loads fail, in addition
to if the playlist load fails.

NB - I'm aware the casting is a bit messy, but I don't want a common
interface because I'm hopeful that TsChunk will go away at some point.

Issue: #537
2015-06-18 14:11:33 +01:00
Sergio Moreno Mozota
dd3a4a9139 fix audio channels CodecSpecificDataUtil bugs
* fix channel number encoding using the AUDIO_SPECIFIC_CONFIG_CHANNEL_COUNT_TABLE
  * allocate the correct number of bits (4) int the CodecSpecificDataUtil struct
2015-06-17 23:00:31 +02:00
Oliver Woodman
ecf7d1be9e Fix HLS track selection 2015-06-16 13:50:22 +01:00
Oliver Woodman
854fa928fb Fix read H.264 in WebM when the NAL unit length field length is not 4. 2015-06-15 18:01:46 +01:00
Oliver Woodman
49f4fe7810 Rename URL->URI for manifest fetching 2015-06-15 17:43:53 +01:00
Oliver Woodman
ded106053c Remove spurious blank line 2015-06-15 17:43:06 +01:00
Oliver Woodman
164d8b4242 Rework application of Mpd.Location + fix test. 2015-06-15 17:38:51 +01:00
Thanh Pham
c0ecc22359 Fetch next Dash manifest using URL in Location directive if exists 2015-06-15 21:43:25 +07:00
Oliver Woodman
a70c1f1a4b Remove requirement to specify downstream renderer count.
This makes it so that it's no longer necessary to specify the number
of downstream renderers to HlsSampleSource, FrameworkSampleSource and
ExtractorSampleSource, by forcing the downstream renderers to register
with the SampleSource instances in their constructors. This eliminates
a common source of subtle client bugs where the passed value is incorrect.
2015-06-12 17:52:56 +01:00
Oliver Woodman
15dc87b037 Add flag to force spurious audio timestamps to fail playback.
For enabling during device test runs.
2015-06-12 17:46:41 +01:00
Oliver Woodman
e8fd3025e3 Fix propagation of sample encryption key for webm 2015-06-12 17:45:27 +01:00
Oliver Woodman
ead25a9dfe Call incrementalPrepare directly from prepare 2015-06-12 17:44:44 +01:00
Oliver Woodman
02c978e16c Further cleanup subtitle implementations. 2015-06-12 17:44:01 +01:00
Oliver Woodman
bdd1968abe Allow reading of response headers from HttpDataSource implementations 2015-06-12 17:36:48 +01:00
Oliver Woodman
3661726401 Allow multiple chunk loads to prepare a HLS stream.
Issue: #530
2015-06-10 18:30:00 +01:00
Oliver Woodman
1b1769bb6d Further simplify SRT support 2015-06-10 18:03:34 +01:00
Oliver Woodman
fbbf3f27fd Simplify Subrip support 2015-06-10 17:48:01 +01:00