2644 Commits

Author SHA1 Message Date
olly
a39715d323 Improve logging
- Make sure logging of UnknownHostException indicates the failure reason
- Indent stack traces inside event blocks in EventLogger
- Don't log media URLs

PiperOrigin-RevId: 302007601
2020-03-30 18:27:14 +01:00
Oliver Woodman
4e6383aeae Merge pull request #7051 from Cizor:dev-v2
PiperOrigin-RevId: 299357049
2020-03-30 14:25:27 +01:00
Oliver Woodman
c3f9f0e5fe Merge pull request #7010 from dbrain:fix_nullability
PiperOrigin-RevId: 297187116
2020-03-30 13:47:20 +01:00
Oliver Woodman
8591e69b6a Remove duplicate SCTE-35 format and add sample to TsExtractorTest
It's not clear why we're currently outputting the format in both init()
and consume() - it seems likely that this was accidentally introduced
in <unknown commit>
when we started outputting the format in consume() but didn't remove it
from init().
2020-03-30 13:46:24 +01:00
ibaker
1818921a20 Catch-and-log all subtitle decode errors
issue:#6885
PiperOrigin-RevId: 295931197
2020-03-30 13:41:41 +01:00
andrewlewis
ed1eade980 Update stale comment in TrimmingAudioProcessor
The part about leaving the pending trim start byte count unmodified
if the processor was just configured is not correct.

PiperOrigin-RevId: 295745371
2020-03-30 13:40:36 +01:00
olly
23e4236227 Add missing IntDef to switch
PiperOrigin-RevId: 295692163
2020-03-30 13:39:30 +01:00
Oliver Woodman
b14d879947 Tweak Javadoc 2020-02-18 14:47:58 +00:00
olly
d93b57c009 Zero out trailing bytes in CryptoInfo.iv
CryptoInfo.iv length is always 16. When the actual initialization vector
is shorter, zero out the trailing bytes.

Issue: #6982
PiperOrigin-RevId: 295575845
2020-02-18 12:14:34 +00:00
kimvde
a967ff3204 Fix DefaultExtractorsFactory Javadoc
PiperOrigin-RevId: 295540885
2020-02-18 12:11:29 +00:00
olly
cd0999e733 Bump version to 2.11.3
PiperOrigin-RevId: 295695297
2020-02-18 12:10:24 +00:00
andrewlewis
646e690d9f Add GL demo app
Demonstrates rendering to a GLSurfaceView while applying a GL shader.

Issue: #6920
PiperOrigin-RevId: 293551724
2020-02-13 16:52:20 +00:00
aquilescanta
19c8858341 Prepare and release DrmSessionManager in Renderers
Issue: #6951
PiperOrigin-RevId: 294187695
2020-02-13 15:53:05 +00:00
olly
890fd4efb8 Don't re-init codec if DRM session is unchanged
This condition is trying to detect when it might be necessary
to switch from a non-secure to a secure codec. This is not
possible if the DRM session is unchanged, unless a different
codec is required for some other reason (e.g., H264 -> H265),
which is anyway handled by canKeepCodec below.

PiperOrigin-RevId: 292909126
2020-02-03 14:46:08 +00:00
olly
b7c5f5cde6 Avoid unnecessary decoder instantiations on key rotation
Issue: #6903
PiperOrigin-RevId: 292884280
2020-02-03 11:24:25 +00:00
olly
45cb55ce09 Lock down SampleQueue to reasonable extension points
PiperOrigin-RevId: 292542298
2020-02-01 19:40:07 +00:00
olly
fd88115728 HLS: Fix key rotation
Passing EXT-X-KEY DrmInitData through the FragmentedMp4Extractor
doesn't work for streams with key rotation, because an extractor
instance is used for multiple segments, but is only passed the
EXT-X-KEY DrmInitData corresponding to the first segment.

This change removes passing DrmInitData through the extractor,
and instead passes it via FormatAdjustingSampleQueue. This is
in-line with how manifest DrmInitData is handled during DASH
playbacks.

Issue: #6903
PiperOrigin-RevId: 292323429
2020-02-01 19:39:06 +00:00
olly
850aef4f67 SampleQueue: Let subclasses easily invalidate format adjustment
This is a nice-regardless improvement to SampleQueue, which will
likely to used to fix the referenced issue. It makes it possible
for SampleQueue subclasses to support dynamic changes to format
adjustment in a non-hacky way.

Issue: #6903
PiperOrigin-RevId: 292314720
2020-02-01 19:38:06 +00:00
olly
12bb35867e Expand dangal workaround to all API levels
It doesn't seem worth keeping the cap, since the device
will presumably stop receiving major version updates at
some point anyway.

Issue: #6899
PiperOrigin-RevId: 291899439
2020-02-01 19:37:20 +00:00
tonihei
c79cb1bfe0 Add ID3 genres added in Wimamp 5.6 (2010).
All these genres are currently causing a warning and are not added to the Metadata.Entry.

PiperOrigin-RevId: 290594810
2020-01-27 19:06:36 +00:00
olly
b137cfbd99 Tidy up DownloadService restart. Final change for #6798.
- Add additional Listener methods to DownloadManager, to inform of
  changes to whether the downloads are paused or waiting for requirements.

- Only schedule the Scheduler if we really are waiting for requirements.

- Only restart the service if we're no longer waiting for requirements,
  and if there are queued downloads that will now be restarted.
  Previously the service would be restarted whenever the requirements
  were met, regardless of whether there was any work to do.

- Restart service if it might be stopping, as well as if it's already
  stopped. Also restart service if there's a download state change to a
  state for which the service should be started, if.

Issue: #6798
PiperOrigin-RevId: 290270547
2020-01-17 16:16:52 +00:00
olly
0a2373c300 2.11.2 release notes and version bump
PiperOrigin-RevId: 290269098
2020-01-17 16:16:36 +00:00
krocard
49349f0f28 Do not hold a codec in OnFrameRenderedListener
Doing so prevent Codec which is a big object with
JNI to be garbage collected.

As the codec can not be hold in the listener, there
is no way to call release, as it must be called on
the same codec.
As a result the release method is also removed.
The downside is that at runtime some callbacks may be
dropped but it should be a short transitive state.

This also simplifies lifecycle of the listener as
the client does not have to know if release needs
to be called or not.

An alternative would have been to hold a weak ref,
but I deemed it too complicated for the
runtime gain.

PiperOrigin-RevId: 290231659
2020-01-17 16:14:51 +00:00
Oliver Woodman
ea4711630f Fix build 2020-01-17 14:30:48 +00:00
olly
f146bad439 HLS: Fix slow seeking into long MP3 segments
Issue: #6155
PiperOrigin-RevId: 290117324
2020-01-17 14:02:33 +00:00
kimvde
0456b638e3 FlacExtractor: handle case where last frame < MAX_FRAME_HEADER_SIZE
PiperOrigin-RevId: 290079840
2020-01-17 14:02:29 +00:00
krocard
e202560dc9 Tunneling timestamp use Message instead of Runnable
This avoids allocating a Runnable.

PiperOrigin-RevId: 290079660
2020-01-17 14:02:16 +00:00
olly
0ac22d3401 Start service in foreground if allowed
This fixes an issue where a DownloadService implementation
that allows foreground but doesn't provide a scheduler would
not be restarted in the case that it was still in memory but
classed as idle by the platform.

It also speeds up service restart in the case that a
scheduler is provided.

Issue: #6798
PiperOrigin-RevId: 290068960
2020-01-17 14:01:50 +00:00
olly
f35cb8ae49 Split SampleQueue.advanceTo for advance & seek use cases
This method has two use cases:

1. Seeking. Calls are immediately preceded by a call to rewind(), and
   the returned value isn't important unless it's ADVANCED_FAILED (i.e.
   the caller is only interested in success and failure).
2. Advancing. The return value is important unless it's ADVANCED_FAILED,
   in which case the caller wants to treat it as 0.

This change creates separate methods for each use case. The new seekTo
methods automatically rewind and return a boolean. The updated advanceTo
method returns 0 directly in cases where ADVANCED_FAILED was returned.
Arguments that were always hard-coded to true by callers have also been
removed.

This change is a step toward one possible solution for #6155. How we'll
solve that issue is still up for discussion, but this change seems like
one we should make regardless!

Issue: #6155
PiperOrigin-RevId: 290053743
2020-01-17 14:01:45 +00:00
olly
dfa4d55f50 Fix DownloadService resumption
- DownloadManagerHelper now passes all downloads to the
  DownloadService when the service is attached (and once
  the downloads are known). The service then starts the
  foreground notification updater if necessary. This fixes
  the ref'd issue.
- Don't call getScheduler() if the service is background
  only. This was already documented to be the case on the
  DownloadService constructor.
- If the service is started in the foreground on SDK level
  26 and higher, satisfy the condition to move the service
  to the foreground in onStartCommand rather than in stop().
  It's much more obviously correct, and should produce the
  same end result.

Issue: #6798
PiperOrigin-RevId: 290050024
2020-01-17 14:01:38 +00:00
Oliver Woodman
c269ffe1e6 Merge pull request #6603 from TiVo:fix-tunneling-stuck-release
PiperOrigin-RevId: 290041295
2020-01-17 14:00:33 +00:00
Oliver Woodman
38bc7355c7 Merge pull request #6678 from phhusson:feature/enable-multi-metadata-tracks
PiperOrigin-RevId: 290032841
2020-01-17 13:59:48 +00:00
olly
5bdcb5fd56 DASH: Output Format before InitializationChunk load completes
This optimization allows a ChunkSampleStream to output track
formats as soon as they're parsed during an InitializationChunk
load, rather than waiting until after the InitializationChunk
load is completed.

In DASH VOD, a single InitializationChunk typically loads the
moov and sidx atoms in that order. Hence for long form content
where the sidx is a non-trivial size, this may result in the
track formats being output a non-negligible period of time
sooner than was previously the case. This allows downstream
renderers to start codec initialization sooner, potentially
decreasing startup latency.

For a single test stream on a fast & stable network, this
pretty consistently reduced elapsed time until both audio and
video codecs have been initialized from ~0.5s to ~0.3 seconds
on a Galaxy S8. For 5 test runs without and with these patches,
the eventTime logged by EventLogger for the second decoder
init were:

Without (secs): 0.47 0.47 0.45 0.48 0.46
With (secs)   : 0.32 0.33 0.34 0.31 0.40

PiperOrigin-RevId: 289845089
2020-01-17 13:59:37 +00:00
olly
124510276f Optimize chunks to init their outputs before opening the DataSource
The current order of operations means that the Format is only passed
to the chunk's output after the DataSource has been opened. This
means that establishing the network connection and the downstream
renderers initializing their codecs are effectively serialized to
occur one after the other.

In the new order, the Format is passed to the chunk's output before
the DataSource has been opened. This allows the downstream renderers
to initialize their codecs in parallel with the network connection
being established, and hence latency at the start of playback is
reduced.

PiperOrigin-RevId: 289841854
2020-01-17 13:59:33 +00:00
olly
771aa32825 Use customCacheKey in DownloadHelper.createMediaSource
Issue: #6870
PiperOrigin-RevId: 289658261
2020-01-17 13:59:22 +00:00
olly
32021602ca Rename ID3 tag to Afro-Punk
PiperOrigin-RevId: 289490708
2020-01-17 13:58:22 +00:00
olly
4e4a415d6c DownloadService: No-op cleanup
Issue: #6798
PiperOrigin-RevId: 289424582
2020-01-17 13:58:18 +00:00
olly
61130a593d Deprecate DownloadService state change methods
As discovered whilst investigating #6798, there are cases
where these methods are not correctly. They were added as
convenience methods that could be overridden by concrete
DownloadService implementations, but since they don't work
properly it's preferable to require application code to
listen to their DownloadManager directly instead.

Notes:

- The original proposal to fix #6798 stored the state change
events in memory until they could be delivered. This approach
is not ideal because the events still end up being delivered
later than they should be. We also want to fix the root cause
in a different way that does not require doing this.
- This change does not fix #6798. It's a preparatory step.

Issue: #6798
PiperOrigin-RevId: 289418555
2020-01-17 13:58:11 +00:00
Oliver Woodman
2902452beb Merge pull request #6797 from DolbyLaboratories:dev-v2-ac4-drm
PiperOrigin-RevId: 289092332
2020-01-17 13:57:58 +00:00
olly
ca11e56fe6 Add tests to validate FLAC decoder output
PiperOrigin-RevId: 289091494
2020-01-17 13:57:41 +00:00
olly
91d9405416 Avoid OMX.qti.audio.decoder.flac
Unfortunately devices such as the MI 8 do not provide an alternative
working decoder. Some Vivo devices do provide one though.

PiperOrigin-RevId: 288911897
2020-01-17 13:56:51 +00:00
olly
4e767faa1c Fix extension FLAC decoder to correctly handle non-16-bit depths
PiperOrigin-RevId: 288860159
2020-01-17 13:56:35 +00:00
andrewlewis
b35499f806 Resolve TrueHD spec TODO
PiperOrigin-RevId: 288855515
2020-01-17 13:56:31 +00:00
Oliver Woodman
91d2d8b40e Merge pull request #6836 from DolbyLaboratories:dev-v2-refineAC4
PiperOrigin-RevId: 288772277
2020-01-17 13:56:09 +00:00
kimvde
42897b26c7 FlacExtractor: add condition for zero-length reads
This improves readability by making clearer that reading no bytes from
the input in readFrames() is an expected case if the buffer is full.

PiperOrigin-RevId: 288711841
2020-01-17 13:56:03 +00:00
andrewlewis
e1a110e651 Fix TrueHD chunking in Matroska
Issue: #6845
PiperOrigin-RevId: 288688716
2020-01-17 13:55:49 +00:00
kimvde
7fe55cd468 Use FlacLibrary.isAvailable in FlacExtractor selection
PiperOrigin-RevId: 288667790
2020-01-17 13:55:40 +00:00
olly
eb0acb4155 Fix playback for Vivo codecs that output non-16-bit audio
PiperOrigin-RevId: 288468497
2020-01-17 13:55:02 +00:00
olly
20e7684c6c FlacExtractor: Fix possible skipping of frame boundaries
PiperOrigin-RevId: 288304477
2020-01-17 13:54:47 +00:00
kimvde
be3257e87a Simulate IO exceptions in all FlacExtractor tests
- Simulate IO exceptions in the test using FlacBinarySearchSeeker for
  seeking in FlacExtractorTests. This makes the test slower but covers
  more test cases.

PiperOrigin-RevId: 288285057
2020-01-17 13:54:37 +00:00