1834 Commits

Author SHA1 Message Date
eguven
d229e1f405 Add helper methods to check existence and delete ActionFiles
PiperOrigin-RevId: 239002281
2019-03-20 23:26:49 +00:00
andrewlewis
a5616cb552 Extract AV1 streams in DASH (fMP4/Matroska)
PiperOrigin-RevId: 238983394
2019-03-20 23:26:49 +00:00
eguven
3e4c15aa15 Add methods to DefaultDownloadIndex to set manual stop reason and not met requirements
PiperOrigin-RevId: 238960156
2019-03-20 23:26:49 +00:00
olly
2959b5f9c2 Roll forward of 238625384.
PiperOrigin-RevId: 238666870
2019-03-20 23:26:49 +00:00
olly
a291d6221f Automated g4 rollback of changelist 238625384.
*** Original change description ***

Allow exoplayer/v2 mockito2

***

PiperOrigin-RevId: 238626401
2019-03-20 23:26:49 +00:00
olly
07702cecdd Allow exoplayer/v2/ mockito2
PiperOrigin-RevId: 238625384
2019-03-20 23:26:10 +00:00
andrewlewis
f9055396b8 Post errors before calling stopInternal
When an error occurs we call stopInternal, and this clears the MediaPeriodQueue,
which in turn releases media period holders and notifies that media periods have
been released. AnalyticsCollector updates its information about media periods
using the media period release events, which means that if we post the source
error after stopInternal posts its events we can't determine what media period
the source error corresponds to.

Move error notifications before calling stopInternal, so that
AnalyticsCollector's model of the media period queue contains the loading period
at the point when it handles the error.

For consistency also move the other (non-source) error notifications to match
the new ordering.

PiperOrigin-RevId: 238559324
2019-03-15 04:54:22 +00:00
eguven
d088be7acc Remove DownloadState.stopFlags
PiperOrigin-RevId: 238442845
2019-03-15 04:54:04 +00:00
tonihei
d93ee00d19 Add convenience method to DownloadHelper to add selection for single renderer.
This simplifies the DownloadHelper code in the demo app and is generally
useful for more specific updates with SelectionOverrides.

PiperOrigin-RevId: 238228276
2019-03-15 04:53:29 +00:00
tonihei
8e80acd18f Use androidx.test and extensions.
This replaces the deprecated usages of RobolectricTestRunner and
RuntimeEnvironent and fully migrates the tests to androidx.

PiperOrigin-RevId: 238011667
2019-03-15 04:53:12 +00:00
eguven
9c6c74d564 Fix merging download action to completed and stop flag set download
PiperOrigin-RevId: 238002393
2019-03-15 04:52:54 +00:00
andrewlewis
76e9950409 Make MatroskaExtractor.seek() non-final
Now that this class can be extended, it makes sense for subclasses to be able
to clear state in seek().

PiperOrigin-RevId: 237902276
2019-03-15 04:52:37 +00:00
andrewlewis
7acc0ee798 Fix ProgressiveMediaSource DefaultExtractorsFactory proguarding
PiperOrigin-RevId: 237900673
2019-03-15 04:52:19 +00:00
tonihei
7bf963c06c Add unit tests for buffer-based ABR.
PiperOrigin-RevId: 237803831
2019-03-15 04:52:01 +00:00
andrewlewis
3ea6d78ee7 Add some tests for DefaultAudioSink
PiperOrigin-RevId: 237247769
2019-03-15 04:50:12 +00:00
tonihei
1aad0f8e22 Don't throw in ProgressiveMediaPeriod.onLoadCompleted.
We may currently throw if the load completes before we finished preparation.
Don't throw and instead check for this condition in maybeThrowPrepareError.

PiperOrigin-RevId: 237237000
2019-03-15 04:49:54 +00:00
olly
851134ec16 Derive Format.frameRate for MP4 videos
Issue: #5598
PiperOrigin-RevId: 237067179
2019-03-15 04:49:36 +00:00
Arnold Szabo
d7c2519a5d Fixes according to the code review 2019-03-07 00:09:11 +02:00
aquilescanta
97ea23fb89 Fix load error handling call in ProgressiveMediaPeriod
PiperOrigin-RevId: 237052069
2019-03-06 17:29:18 +00:00
olly
a8d8f610ba Add SimpleCache deletion functionality
This is needed now that index data may be stored outside
of the cache directory.

PiperOrigin-RevId: 237051112
2019-03-06 17:29:18 +00:00
tonihei
ea42bfbf34 Don't retry UnexpectedLoaderExceptions.
These are thrown for non-IOException encountered during loading. Also, they
are thrown from an unexpected position and retrying is likely to fail anyway
because the Extractor is left in an unrecoverable state.

PiperOrigin-RevId: 237043948
2019-03-06 17:29:18 +00:00
olly
ab5dae64b9 Make sure we handle SQLiteException and other IO errors properly
SQLiteException is a runtime exception, which makes it easy to
forget to handle it. This change converts SQLiteExceptions into
a checked exception, which is then handled appropriately.

PiperOrigin-RevId: 237038793
2019-03-06 17:29:18 +00:00
andrewlewis
dd06a2d5f1 Fix integer bitrate division
PiperOrigin-RevId: 237028164
2019-03-06 17:29:18 +00:00
aquilescanta
155a129d2c Make flags-only DecoderInputBuffer hold all flags
Currently a flags-only DecoderInputBuffer may hold only the end-of-stream
flag. This change makes flags-only buffer read any kind of flag set in
the next sample. If no sample is available RESULT_NOTHING_READ is
returned.

PiperOrigin-RevId: 237027581
2019-03-06 17:29:18 +00:00
andrewlewis
febb8c589e Improve handling of failed NAL prefix reads
nalPrefix.readUnsignedIntToInt() will throw if the unsigned output doesn't fit
in an int. Before this change, in the error case we'd retry reading from after
the NAL prefix position. Throw a ParserException so that reading an obviously
invalid NAL prefix will be treated as a fatal exception by the default load
error handling policy.

PiperOrigin-RevId: 236839690
2019-03-06 17:29:18 +00:00
tonihei
641c1d2af4 Properly release DownloadHelper and TrackSelectionDialog.
The release needs to post to the MediaSource thread and also needs to post
back to the DownloadHelper thread to prevent sending updates after release has
been called. The point where we release the downloadHelper also needs to
dismiss the dialog in case the creation has already been queued before the
release.

PiperOrigin-RevId: 236652309
2019-03-06 17:29:18 +00:00
aquilescanta
8a2fc55c49 Fix load error handling policy invocation
PiperOrigin-RevId: 236648435
2019-03-06 17:29:18 +00:00
tonihei
28c7cb3716 Reset period position when resetState=True.
This is more in line with "forgetting all previous state" as documented for
resetState=True. Also only apply the current position as initial seek position
in this case.
PiperOrigin-RevId: 236623630
2019-03-06 17:29:18 +00:00
aquilescanta
7a1b8a9585 Extract method in MediaCodecRenderer
Deduplicates a bit of code

PiperOrigin-RevId: 236621851
2019-03-06 17:29:18 +00:00
tonihei
8fce3ce678 Do not throw in resolveSeekPosition on playback thread.
We currently throw if a pending seek position was valid when the user issued
it on the app thread, but can't be resolved on the playback thread because the
timeline changed in the meantime. Throwing in this case seems wrong as the
user could not have known about the issue (and the seek position was actually
valid). Also, in other cases where the currently playing period is no longer
in the new timeline, we gracefully use a subsequent period or transition to
ENDED state instead of throwing. So it seems more consistent to transition to
ENDED state as well.

PiperOrigin-RevId: 236274862
2019-03-06 17:29:18 +00:00
tonihei
3eeb3acb3b Remove nullness suppressions.
These were added in an internal clean-up and are better fixed than suppressed.

PiperOrigin-RevId: 236118715
2019-03-06 17:29:18 +00:00
tonihei
2ae07936ba Handle !resetPosition as initial seek position.
The flag in ExoPlayer.prepare is documented as keeping the current window
index and window position. We are currently using the current period UID and
period position instead. This causes problems when the media source is changed
but the position is not reset.

Using the initial seek position instead ensures we actually use the window
index and position.

Issue:#5520
PiperOrigin-RevId: 236101024
2019-03-06 17:29:18 +00:00
tonihei
377e550d0f Improve new error type documentation and prevent NPE in error listener.
Adding new error types may cause issues when listeners assume a fixed set of
error types and don't handle arbitrary defaults.

Fixing error handling in one case and improving documentation to make people
aware of the issue.

PiperOrigin-RevId: 236093265
2019-03-06 17:29:18 +00:00
tonihei
92a7bb534a Remove wrong documentation.
This is a left-over from the past and is no longer true.

PiperOrigin-RevId: 236089921
2019-03-06 17:29:18 +00:00
olly
b25d2c9978 Adding @SuppressWarnings for the latest stable SDK Q drop
Global Presubmit : https://test.corp.google.com/ui#id=OCL:235456897:BASE:235767406:1551211793273:aa1704f6

LSC doc: go/android-sdk-lsc

PiperOrigin-RevId: 235812819
2019-03-06 17:29:18 +00:00
andrewlewis
8edecd5ccb Update Matroska video codec FourCCs
Issue: #5503
PiperOrigin-RevId: 235523955
2019-03-06 16:55:19 +00:00
andrewlewis
f394697d4a Fix updating rate with codec reuse while disabled
While disabled the renderer does not have non-null stream formats. This means
that setting the operating rate could cause a NullPointerException if there was
a codec for reuse.

Check for being enabled/started before trying to set the operating rate. After
the renderer is enabled it should receive a new input format which will update
the operating rate as needed.

PiperOrigin-RevId: 235494384
2019-03-06 16:55:02 +00:00
andrewlewis
caeaa9574e Avoid draining audio processors while reset
If the DefaultAudioSink was reconfigured in a way that was compatible with the
previous configuration just after having been reset, we would try to drain audio
processors despite not having an AudioTrack. This could result in a
NullPointerException if speed adjustment was active.

Fix this behavior by only trying to drain audio processors if we actually have
an AudioTrack.

PiperOrigin-RevId: 235355466
2019-03-06 16:54:44 +00:00
aquilescanta
eea1ce3e0a Fix channel count propagation on HLS traditional preparation
PiperOrigin-RevId: 235189983
2019-03-06 16:54:08 +00:00
olly
3e03e71cf9 Start enabling database based SimpleCache indexing
- Expose constructor (package private for now, for tests only)
- Add some tests for cache initialization
- Add some TODOs for handling initialization failure

PiperOrigin-RevId: 235188386
2019-03-06 16:53:51 +00:00
olly
ff7f0304e5 Automated g4 rollback of changelist 235153912.
*** Reason for rollback ***

Breaks ExoPlayer's gradle build

*** Original change description ***

Migrate Mockito Matchers.{hamcrestMethods} to MockitoHamcrest.{hamcrestMethods}

All methods accepting a hamcrest Matcher in org.mockito.Matchers have been changed
to only accept an ArgumentMatcher. The corresponding methods are now available on
MockitoHamcrest.

For more information see http://go/mockito-2-lsc

Tested:
    TAP --sample for global presubmit queue
    http://test/OCL:235033293:BASE:234998256:1550793421835:c2ccbbda

***

PiperOrigin-RevId: 235186705
2019-03-06 16:53:32 +00:00
olly
325029d58e Migrate Mockito Matchers.{hamcrestMethods} to MockitoHamcrest.{hamcrestMethods}
All methods accepting a hamcrest Matcher in org.mockito.Matchers have been changed
to only accept an ArgumentMatcher. The corresponding methods are now available on
MockitoHamcrest.

For more information see http://go/mockito-2-lsc

Tested:
    TAP --sample for global presubmit queue
    http://test/OCL:235033293:BASE:234998256:1550793421835:c2ccbbda
PiperOrigin-RevId: 235153912
2019-03-06 16:52:58 +00:00
Arnold Szabo
854419962a Merge role and accessibility fields into RoleFlags 2019-03-05 23:38:49 +02:00
Arnold Szabo
58d746ecaa Add IntDef for role and accessibility descriptor's value, parse these also for video / audio tracks 2019-03-03 20:26:31 +02:00
Arnold Szabo
06ed877845 Pass role and accessibility descriptor values from adaptation set to format 2019-02-27 23:53:52 +02:00
andrewlewis
8746d4a885 Automated g4 rollback of changelist 230206675.
*** Reason for rollback ***

Reverting as this may break playback on other Amlogic devices and/or playback of non-interlaced content.

*** Original change description ***

Add max video size workaround for Amlogic decoder.

The Amlogic awesome decoder reduces the video size of interlaced videos by half
if the internal configuration isn't force reset with new maximum input size
values. The product of these new values must exceed 1920x1088 to force the
reset.

Issue:#5003

***

PiperOrigin-RevId: 234967314
2019-02-21 11:56:10 +00:00
olly
1450b3713f Suppress warnings emitted by Checker Framework version 2.6.0
PiperOrigin-RevId: 234917536
2019-02-21 11:56:02 +00:00
olly
2685b8bd90 Support multiple instances of database features
- Use Cache UID for CacheContentIndex and CacheFileMetadataIndex. This
  enables SD card swapping for a single device.
- I'm hopeful of finding a way to get the Cache UID to DefaultDownloadIndex
  so we can do the same there.

PiperOrigin-RevId: 234662753
2019-02-20 13:56:08 +00:00
aquilescanta
774c01d020 Make MimeType top level check related methods more robust
Throwing an IllegalArgumentException doesn't help the method signature.

PiperOrigin-RevId: 234579722
2019-02-19 13:23:19 +00:00
andrewlewis
8e7ae9201a Bump version for 2.9.6 release
PiperOrigin-RevId: 234578712
2019-02-19 13:23:19 +00:00