7038 Commits

Author SHA1 Message Date
bachinger
b05fa731d8 Propagate segment properties when merging HLS delta updates
Issue: #5011
PiperOrigin-RevId: 350540152
2021-01-08 15:31:22 +00:00
christosts
fc3b91c96c Add assertion in MediaCodec adapter
Add assertion to check an output format has been propagated before
returning an output buffer when operating MediaCodec in asynchronous
mode.

PiperOrigin-RevId: 350534918
2021-01-08 15:31:10 +00:00
andrewlewis
456622a275 Deprecate stop(boolean)
`stop(true)` is almost the same as `clearMediaItems(); stop();`, except that
any player error isn't cleared. Clearing media items more clearly expresses the
intent.

PiperOrigin-RevId: 350516748
2021-01-07 10:45:02 +00:00
tonihei
2c925a4109 Fix MIGHT_NOT_USE_FULL_NETWORK_SPEED for VOD DASH streams.
The flag compared against the nowTime in the period that is only
set to a positive value for live streams.

PiperOrigin-RevId: 350514934
2021-01-07 10:44:53 +00:00
olly
855db95fb3 Update surface frame-rate based on fixed frame-rate estimate
PiperOrigin-RevId: 350442843
2021-01-07 10:44:44 +00:00
tonihei
25ed6b127d Clarify parameter Javadoc for playback speed values.
In many cases we just used "playback speed" as a detailed Javadoc
parameter or return type definition. This doesn't define which scale
the speed is using.

PlaybackParameters as the main point to set the speed already uses a
more precise wording to describe the value as a factor by which playback
will be sped up.

This change replaces other usages of "playback speed" with this wording
whereever we would usually add a unit, keeping "playback speed" for
summary statements etc to reference the general concept that doesn't
usually require a unit.

PiperOrigin-RevId: 350379139
2021-01-07 10:44:34 +00:00
olly
d1d28a418d Propagate audio session ID to MediaCodecVideoRenderer
Issue: #8190
PiperOrigin-RevId: 350357825
2021-01-07 10:44:25 +00:00
tonihei
aa2beb080c Turn on parallel video and audio adaptation by default.
The experimental setting shows positive results and can be turned
on by default. To avoid adaptation between HLS audio formats without
bitrates, we need to ensure that only formats with bitrates are
considered for adaptation.

Also added tests for these features.

Issue: #5111
PiperOrigin-RevId: 350315296
2021-01-07 10:44:15 +00:00
christosts
51d90a40ba Keep pending output format after multiple flushes
The AsynchronousMediaCodecCallback has logic to retain a pending
output format in case flush() is called. This commit fixes a case where
calling flush() again while an output format is pending would nullify
the pending output format.

A unit test is added in AsynchronousMediaCodecCallback but not the
AsynchronousMediaCodecAdapter. That is because the adapter operates
directly on top of MediaCodec, but Robolectric's ShadowMediaCodec
produces an output format on every MediaCodec.start(). This is
unrealistic when operating MediaCodec in asynchronous mode where we
need to call MediaCodec.start() after every MediaCodec.flush().

PiperOrigin-RevId: 350176659
2021-01-07 10:44:05 +00:00
tonihei
a4fbc2c98d Clean up parallel adaptation code.
- The AdaptiveTrackSelection doesn't need to use the experimental
terminolgy because the code is always triggered if there are multiple
adaptive selections.

- It's also confusing to pass the state on the outside after the object
creation, so moving everything into a simple control flow again where
the adaptation checkpoints are passed in via the constructor.

- Instead of triple arrays, we can use more readable named structures.

- The calculation of the checkpoints can be cleaned up to be more
readable by moving things to helper methods.

- The reserved bandwidth from all fixed track selections is really just
a special case of multiple parallel adaptataions. So this logic doesn't
need to be separate.

- The whole logic also didn't have test coverage so far. Added tests
for the actual adaptation using these checkpoints and the builder
calculating the checkpoints.

Overall this should be a no-op change.

PiperOrigin-RevId: 350162834
2021-01-07 10:43:56 +00:00
olly
0901fe6e38 Remove internal renderer audio session ID propagation
Overriding this method will never be necessary or advisable once we
improve routing of audio session IDs

Issue: #8190
PiperOrigin-RevId: 350146302
2021-01-07 10:43:46 +00:00
Emanuele Tidó
75b222d8d4
Update DefaultHttpDataSource.java 2021-01-06 00:17:13 +00:00
Emanuele Tidó
654890846a
Update DefaultHttpDataSource.java
set responseBody to Util.EMPTY_BYTE_ARRAY when an IOException occurs trying to get his value from inputStream
2021-01-06 00:10:56 +00:00
olly
6d2d2e31ef Fix DownloadManager assertion failure
Issue: #8419
#minor-release
PiperOrigin-RevId: 350134719
2021-01-05 16:04:46 +00:00
Ian Baker
a9a150a1d3 Merge pull request #8397 from equeim:avc-codecs
PiperOrigin-RevId: 350105847
2021-01-05 12:00:21 +00:00
andrewlewis
97d3e52340 Move XML parsing utils to common module
This is in preparation for using them from the extractor module.

PiperOrigin-RevId: 349571390
2021-01-05 11:59:58 +00:00
Emanuele Tidó
ee0d4a5b3e
Update DefaultHttpDataSource.java 2020-12-30 17:01:36 +00:00
Emanuele Tidó
625c46e963
throw InvalidResponseCodeException instead of HttpDataSourceException
if responseCode and responseMessage ara available always throws an InvalidResponseCodeException instead of HttpDataSourceException, so in onPlayerError method the http status code and message can be used to decide what will be the next step.
2020-12-30 16:50:04 +00:00
Alexey Rochev
78a975c268 Initialize Format.codecs from AVC SPS NAL unit (#8393)
This will allow ExoPlayer to check if video track's profile
and level are supported by decoder when playing progressive media sources.

Also fix typo in AvcConfig.
2020-12-24 20:30:35 +03:00
olly
1347d572ef Restore old SampleQueue exoMediaCryptoType behavior
PiperOrigin-RevId: 348818482
2020-12-23 22:54:07 +00:00
olly
3abdec17ca Some no-op cleanup to bypass mode
PiperOrigin-RevId: 348795995
2020-12-23 22:53:59 +00:00
olly
5f3d1c1bc8 Fix bypass mode when the stream is empty
#minor-release
Issue: #8374
PiperOrigin-RevId: 348792965
2020-12-23 22:53:50 +00:00
olly
e71ce06722 Add e2e test for playing SilenceMediaSource
PiperOrigin-RevId: 348789555
2020-12-23 22:53:41 +00:00
olly
d01093d711 Rollback of dd7b379dc0
*** Original commit ***

DataSource.open() throws if already opened.

Update DataSource implementations to throw an error if open() is called
when the DataSource is already open.

***

PiperOrigin-RevId: 348783425
2020-12-23 22:53:24 +00:00
ibaker
653d180d4c Add 302 redirect test to DefaultHttpDataSourceContractTest
PiperOrigin-RevId: 348760170
2020-12-23 22:53:15 +00:00
ibaker
f44e5bd292 Add a DefaultHttpDataSource contract test
Also add a MockWebServer Dispatcher that can be customised with
different resources and behaviours for different paths.

PiperOrigin-RevId: 348759662
2020-12-23 22:53:06 +00:00
bachinger
525f151f21 Check whether drm session manager of sample queue is null
PiperOrigin-RevId: 348688419
2020-12-23 22:52:48 +00:00
tonihei
c7af1e12de Fix nullness warnings.
These two things were reported by the nullness checker as warnings.

PiperOrigin-RevId: 348650535
2020-12-23 22:52:30 +00:00
christosts
dd7b379dc0 DataSource.open() throws if already opened.
Update DataSource implementations to throw an error if open() is called
when the DataSource is already open.

PiperOrigin-RevId: 348609860
2020-12-23 22:52:21 +00:00
tonihei
0226543090 Remove experimental method to disable stuck buffering detection.
PiperOrigin-RevId: 348462189
2020-12-23 22:52:12 +00:00
olly
85d094a2b6 Move surface frame-rate adjustment into the helper
Estimating the playback frame-rate, querying the display refresh rate, and
setting the surface frame-rate, are all closely related to one another. In
particular because setting the surface frame-rate can directly cause the
display refresh rate to change. It therefore makes sense to move surface
frame-rate adjustment into the helper.

This also makes it easier to re-use the logic in other video renderers.

PiperOrigin-RevId: 348455864
2020-12-23 22:52:04 +00:00
tonihei
696bb34ac6 Fix second sync point calculation for unbounded live streams.
We currently use INDEX_UNBOUNDED for the calculation and don't
offset the index by the firstSegmentNum if not unbounded.

PiperOrigin-RevId: 348445797
2020-12-23 22:51:55 +00:00
ibaker
df0b74e4c4 DataSourceContractTest: Add tests for reading subranges
PiperOrigin-RevId: 348443305
2020-12-23 22:51:29 +00:00
bachinger
04824dfd25 Make DefaultHttpDataSourceFactory an inner class of the built class
#exofixit

PiperOrigin-RevId: 348441436
2020-12-23 22:51:20 +00:00
Oliver Woodman
5e47c3c5e5 Merge pull request #8357 from TiVo:p-fix-cea708anchor
PiperOrigin-RevId: 348440799
2020-12-23 22:51:10 +00:00
tonihei
30ee29df1a Use real SampleQueue in FakeSampleStream.
This replaces all the duplicated logic previously implemented in
FakeSampleStream and more closely follows the pattern of how
SampleStreams are used from real MediaPeriods.

Some tests needed adjustments because using real the SampleQueue
improved behaviour:
 - Waiting for isLoading is only needed once even across period
   boundaries because the real SampleQueue doesn't have the on/off
   pattern.
 - AnalyticsCollectorTest.playlistOperations() was wrongly asserting
   that some pre-buffering events. The new version is more intuitively
   correct we pre-buffer the second item during the initial loading
   phase (thus period1seq1) and keep the buffer in the queue after
   the removal operation.

PiperOrigin-RevId: 348440255
2020-12-23 22:51:00 +00:00
tonihei
cf0a4e528e Disable delta updates until merging bug is fixed.
The delta updates loose information about previous init segments.
Until this is properly fixed, we can avoid the problem by not
using delta updates.

Issue: #5011
PiperOrigin-RevId: 348023895
2020-12-23 22:50:51 +00:00
ibaker
0d1dac93c4 Use CapturingRenderersFactory in DashPlaybackTest
PiperOrigin-RevId: 348018409
2020-12-23 22:50:33 +00:00
ibaker
1327ecad24 Use CapturingRenderersFactory in Vp9PlaybackTest
PiperOrigin-RevId: 348017841
2020-12-23 22:50:25 +00:00
ibaker
27e290e701 Use CapturingRenderersFactory in TsPlaybackTest
PiperOrigin-RevId: 348017268
2020-12-23 22:50:16 +00:00
krocard
8fb15f97ca Explicitly fail playback if new format has no sampleMimeType
This avoids a NullPointerException later when the format is used.

Fixes https://github.com/google/ExoPlayer/issues/8283.

PiperOrigin-RevId: 348017149
2020-12-23 22:50:07 +00:00
ibaker
fe5176c009 Use CapturingRenderersFactory in OggPlaybackTest
PiperOrigin-RevId: 348016819
2020-12-23 22:49:58 +00:00
ibaker
6a89027f56 Use CapturingRenderersFactory in Mp3PlaybackTest
PiperOrigin-RevId: 348016339
2020-12-23 22:49:49 +00:00
ibaker
56d30205ba Use CapturingRenderersFactory in MkvPlaybackTest
PiperOrigin-RevId: 348015859
2020-12-23 22:49:40 +00:00
ibaker
237766548c Use CapturingRenderersFactory in MkaPlaybackTest
PiperOrigin-RevId: 348015304
2020-12-23 22:49:32 +00:00
ibaker
5bfa818533 Use CapturingRenderersFactory in FlvPlaybackTest
PiperOrigin-RevId: 348014814
2020-12-23 22:49:23 +00:00
ibaker
3bf5e6b0e4 Use CapturingRenderersFactory in FlacPlaybackTest
PiperOrigin-RevId: 348014322
2020-12-23 22:49:14 +00:00
christosts
6b43f1566f Reduce length of test data in UdpDataSourceContractTest
PiperOrigin-RevId: 348011243
2020-12-23 22:49:05 +00:00
ibaker
9d2855c31f Add @Test to overridden test in UdpDataSourceContractTest
With @Ignore but not @Test the method is still executed by JUnit:
https://github.com/junit-team/junit4/issues/695

PiperOrigin-RevId: 348009981
2020-12-23 22:48:56 +00:00
kimvde
e6d8741467 Add method to compute a SparseLongArray min value.
PiperOrigin-RevId: 348008973
2020-12-23 22:48:47 +00:00