51 Commits

Author SHA1 Message Date
hschlueter
9649411a4f Use video passthrough if clipping starts at key frame.
PiperOrigin-RevId: 451380267
2022-05-30 16:37:19 +00:00
hschlueter
678b6c0438 Replace 640x360 H264 test video with 320x240 H264 video.
Decoding and encoding 320x240 H264 video should be supported
on all devices from Android 5.0 based on CDD requirements.
https://source.android.com/compatibility/5.0/android-5.0-cdd#5_2_video_encoding

640x360 encoding doesn't seem to be supported on Nexus 5.

PiperOrigin-RevId: 450901715
2022-05-26 11:55:21 +00:00
hschlueter
d59186e53c Combine multiple matrix transformations in one shader.
When using a MatrixTransformationFrameProcessor per transformation
matrix, each frame processor's shader applies the matrix to the
vertices and clips the result to the NDC range when drawing the
output frame.
This change combines consecutive MatrixTransformations into a single
MatrixTransformationFrameProcessor by multiplying the individual
matrices while updating and clipping the visible polygon after
each matrix and mapping the resulting visible polygon back to the
input space so that its vertices and the combined transformation
matrix can be used in the shader.

PiperOrigin-RevId: 448521068
2022-05-24 10:44:15 +01:00
ibaker
4f616d6003 Remove ExoPlayer's RawCcExtractor
RawCC is a Google-internal subtitle format, and is no longer used with
ExoPlayer.

PiperOrigin-RevId: 446950691
2022-05-09 11:02:25 +01:00
olly
a16c0b3068 Reading AV1 initialization data.
We add an entire class like we do for parsing other codec initialization formats; it's currently not doing any parsing though (... initialization data is really simple for AV1 though: just the entire contents of the box).

For testing, we add the sample file, having been re-encoded with ffmpeg (and we also happen to have another av1 file, too).

PiperOrigin-RevId: 444890282
2022-05-09 10:24:18 +01:00
Ian Baker
9369348d6f Merge pull request #10150 from egor-n:dev-v2-8435-outlinecolour
PiperOrigin-RevId: 444787307
2022-05-09 10:15:05 +01:00
huangdarwin
f269963e89 Transformer GL: Add support for pixelWidthHeightRatio.
To ensure frame processor operations operate on square pixels,
make the frame taller or wider for non-square input pixels.

In addition to automated tests, this was tested by changing the
inputFormat.pixelWidthHeightRatio in the TransformerVideoRenderer.

PiperOrigin-RevId: 444553517
2022-05-09 10:11:18 +01:00
andrewlewis
c8744ee9bd Add an SSIM test with 360p input
This test should run on all devices from API 21 (the media uses Baseline
profile level 3.0 H.264) to give us coverage of the full pipeline (forcing
re-encoding) and SSIM calculation on all devices.

PiperOrigin-RevId: 443650002
2022-04-26 15:00:34 +01:00
huangdarwin
29e32540de FrameProcessor: Move test bitmaps to a separate directory.
* Group what's now many related test PNGs by moving them to their own directory.
* Move bitmap references to files where they're used, as each bitmap is only
used once each, except the original bitmap.

PiperOrigin-RevId: 441485489
2022-04-26 14:36:31 +01:00
huangdarwin
34f014ce5c FrameProcessor: Add aspect ratio changes to Presentation.
PiperOrigin-RevId: 441250773
2022-04-26 14:31:14 +01:00
huangdarwin
fbcb49e8fd Media: Remove unused test images.
PiperOrigin-RevId: 441142050
2022-04-26 14:27:10 +01:00
olly
c007068ddb Expect PresentationTime Discontinuity During Stream Transitions
PiperOrigin-RevId: 440378974
2022-04-26 14:21:36 +01:00
huangdarwin
8a7fcb4eae FrameProcessor: Add setCrop to Presentation.
PiperOrigin-RevId: 440325693
2022-04-26 14:19:38 +01:00
olly
296efbb395 Reading AV1 initialization data.
We add an entire class like we do for parsing other codec initialization formats; it's currently not doing any parsing though (... initialization data is really simple for AV1 though: just the entire contents of the box).

For testing, we add the sample file, having been re-encoded with ffmpeg (and we also happen to have another av1 file, too).

PiperOrigin-RevId: 439453823
2022-04-06 11:58:54 +01:00
olly
21d085f8a9 Reading average and peak bitrates from esds boxes.
This provides better compatibility with MediaExtractor, which does read these fields; we also need them for being able to mux file contents into another mp4 file.

Also, there is a minor refactor included so that we have an actual type for esds box contents instead of a pair.

PiperOrigin-RevId: 438673825
2022-04-06 11:39:05 +01:00
hschlueter
ecfbc65a0d Convert FrameEditor to a FrameProcessorChain.
The FrameProcessorChain manages a List<GlFrameProcessor>.
FrameProcessorChainDataProcessingTest now tests chaining ScaleToFit-
and AdvancedFrameProcessors.

PiperOrigin-RevId: 436468037
2022-03-22 14:29:53 +00:00
hschlueter
b2b27dc571 Fix FrameEditor intermediate texture size.
ExternalCopyFrameProcessor's output dimensions match the input
size not the output size. So the intermediate texture size
should match the input size.

Also rename configureOutputDimensions to configureOutputSize.

PiperOrigin-RevId: 435058789
2022-03-16 15:36:06 +00:00
huangdarwin
72aca58286 Transformer GL: Split out ScaleToFit and Advanced GlFrameProcessors
* Move auto-adjustments for transformation matrices from the
  VideoTranscodingSamplePipeline constructor to the new
  ScaleToFitFrameProcessor.
* Add GlFrameProcessor#getOutputDimensions() to allow for GlFrameProcessors with
  different input and output dimensions. This is a prerequisite for
  Presentation.
* Tested with unit tests (and manually just in case).
* A follow up CL will implement change the FrameProcessor input to be scale and
  rotate values as requested by the user. This was kept out of this CL to
  reduce CL review size. Presentation will also be implemented in a follow up
  CL.

PiperOrigin-RevId: 434774854
2022-03-15 16:36:52 +00:00
hschlueter
650f71d022 Clarify instructions for updating expected output bitmaps.
Also replace the bitmaps with bitmaps obtained by following
the instructions.

PiperOrigin-RevId: 430232369
2022-02-23 16:17:57 +00:00
samrobinson
d7adb94669 Add a new sample file to assets, which has increasing timestamps.
Re-enable tests that have no muxer support for timestamps going backwards.

Tests running on the B-frame sample will be added in a future commit.

#mse-bug-week

PiperOrigin-RevId: 429599177
2022-02-22 10:30:18 +00:00
olly
9238dc758d Add Matroska Extractor Test Sample For Opus
PiperOrigin-RevId: 429386479
2022-02-18 14:56:25 +00:00
bachinger
d681e264aa Skip played server side inserted ads in a single period window
This change makes sure played server side ads are skipped in a single period
timeline. It avoids creating an ad-MediaPeriodInfo for played postrolls and
creates a content info instead. It also sets the end position for content infos
that terminate the stream before the stream is actually finished. This prevents
the player from continue playing the remaining media delivered by the
MediaPeriod.

We also make sure that the discontinuity of played ads are not reported because
there is actually no discontinuity.

#minor-release

PiperOrigin-RevId: 428734387
2022-02-17 11:52:23 +00:00
ibaker
4e3d15be87 Remove deprecated ActionFile and ActionFileUpgradeUtil
#minor-release

PiperOrigin-RevId: 426868933
2022-02-07 11:44:22 +00:00
olly
24749339db Support relative MPD.Location URIs
#minor-release
Issue: google/ExoPlayer#9939
PiperOrigin-RevId: 426394339
2022-02-07 10:41:54 +00:00
kimvde
ddfd79bb98 Use SpeedChangingAudioProcessor in Transformer
PiperOrigin-RevId: 426113559
2022-02-04 09:39:51 +00:00
Andrew Lewis
497f55a4bb Merge pull request #9893 from moneytoo:mkv-vtt
PiperOrigin-RevId: 424382031
2022-01-28 08:45:44 +00:00
Andrew Lewis
b2152f1988 Merge pull request #9864 from OxygenCobalt:vorbis-comments
PiperOrigin-RevId: 424355325
2022-01-28 08:42:33 +00:00
hschlueter
d277deb335 Transcode to a muxer-supported sample MIME type.
If the output sample MIME type is inferred from the input
but is not supported by the muxer, we fallback to transcoding
to a supported sample MIME type.
The audio and video renderers need to make sure not to select the PassthroughSamplePipeline for this case. Which sample MIME type
to choose is decided by the EncoderFactory.

PiperOrigin-RevId: 423272812
2022-01-25 19:06:26 +00:00
huangdarwin
9ef376e4cb Transformer GL: Add pixel tests for transformation.
Rotation, translation, and scale tests on a normal video.

PiperOrigin-RevId: 422383176
2022-01-25 18:43:11 +00:00
bachinger
c6e5ace310 Inherit parent properties for manifests with dvb profile only
Issue: google/ExoPlayer#9856
PiperOrigin-RevId: 421842579
2022-01-25 18:23:20 +00:00
ibaker
b05583f00d DASH: Stop interpreting main track role as SELECTION_FLAG_DEFAULT
The `main` role distinguishes a track from an `alternate`, but unlike
`SELECTION_FLAG_DEFAULT` it doesn't imply the track should be selected
unless user preferences state otherwise. e.g. in the case of a text
track, the player shouldn't enable subtitle rendering just because a
`main` text track is present in the manifest.

The `main`/`alternate` distinction is still available through
`Format.roleFlags` and the `ROLE_FLAG_MAIN` and `ROLE_FLAG_ALTERNATE`
values.

This behaviour was originally [added in 2.2.0](7f967f3057),
however at the time the `C.RoleFlags` IntDef did not exist. The IntDef
was [added in 2.10.0](a86a9137be).

PiperOrigin-RevId: 418937747
2022-01-05 12:15:27 +00:00
hschlueter
fe1ffdb959 Throw when inferred sample MIME type is not supported by the muxer.
This is better than silently dropping tracks as done previously. Later,
we will implement fallback to transcoding to a supported MIME type.

PiperOrigin-RevId: 418006258
2022-01-05 12:14:58 +00:00
tonihei
40d9838315 Rename HLS master playlist to multivariant playlist
The spec renamed this type of playlist in the latest revision
to use a more inclusive technical term (see
https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-10)

PiperOrigin-RevId: 417560274
2022-01-05 10:41:06 +00:00
tonihei
422a003a03 Add some correctness checks to min/max live latency values.
For DASH manifests, we merge min/max live latency values from various
sources and they may not be consistent with each other. To ensure we
use a sensible configuration in all cases, we can add more correctness
checks:
 1. Limit the min/max values to fall into the available live window.
 2. Ensure that maxLatency >= minLatency in all cases.

Issue: google/ExoPlayer#9750
PiperOrigin-RevId: 415282938
2021-12-10 11:22:02 +00:00
kimvde
94caa8ad6c Fix re-encoding after flattening
The decoder is using the SVC NAL unit prefix data on some Samsung
devices.

PiperOrigin-RevId: 414457181
2021-12-07 17:37:31 +00:00
hschlueter
8105394ac2 Flip input buffer even if the end of stream is reached.
Sometimes the empty end of stream buffer has a non-zero
data limit. Calling flip first, resets the limit to the
position which is zero in these cases.

PiperOrigin-RevId: 413156455
2021-12-02 11:55:55 +00:00
andrewlewis
1b25e2f93d Add unit test for FrameEditor
The test extracts and decodes the first video frame in the test media, renders it to the frame editor's input surface and then processes data. It then reads back the output from the frame editor, converts it to a bitmap and then compares that with a 'golden' bitmap (which is just the same as the test media's first video frame).

PiperOrigin-RevId: 413131811
2021-12-02 11:55:55 +00:00
ibaker
a4c12ca97d Parse DASH forced-subtitle role value
Issue: google/ExoPlayer#9727

#minor-release

PiperOrigin-RevId: 412266397
2021-12-02 11:55:44 +00:00
hschlueter
51901ad568 Do not queue empty input buffers.
Follow-up to a comment on
ac8e418f3d
Buffers that are useful to pass to the sample/passthrough pipeline
should either contain data or the end of input flag. Otherwise, passing
these buffers along is unnecessary and may even cause the decoder to
allocate a new input buffer which is wasteful.

PiperOrigin-RevId: 411060709
2021-11-22 17:20:34 +00:00
Ian Baker
30caac6fc3 Merge pull request #9536 from TiVo:p-fix-issue-2882
PiperOrigin-RevId: 411056555
2021-11-22 17:00:01 +00:00
tonihei
1618e0ef8e Add parsed essential/supplemental properties to the Representation.
We already parse essential and supplemental properties from the
Representation, but don't add them to our Representation class so that
they can be accessed by users.

Issue: google/ExoPlayer#9579
PiperOrigin-RevId: 409961990
2021-11-19 14:48:01 +00:00
Ian Baker
5ce54179aa Merge pull request #9543 from KasemJaffer:rf64
PiperOrigin-RevId: 408816643
2021-11-19 14:29:19 +00:00
hschlueter
d8b9d378d9 Accumulate remainder in buffer duration calculations.
When dropping the remainder, the decoder and encoder timestamps start diverging after a few buffers when no speed changes are supposed to occur. Tracking the remainder keeps them in sync.

PiperOrigin-RevId: 408341074
2021-11-19 14:22:24 +00:00
hschlueter
64466356b2 Add PassthroughSamplePipeline for audio.
When no transformation is needed, the passthrough pipeline allows us to skip decoding and re-encoding.

PiperOrigin-RevId: 407789767
2021-11-09 10:10:10 +00:00
hschlueter
b87f26490b Separate TransformerAudioRenderer and new AudioSamplePipeline.
`TransformerAudioRenderer` reads input and passes `DecoderInputBuffer`s
to the `AudioSamplePipeline`. The `AudioSamplePipeline` handles all
steps from decoding to encoding. `TransformerAudioRenderer` receives
`DecoderInputBuffer`s from the `AudioSamplePipeline` and passes their
data to the muxer.

`AudioSamplePipeline` implements a new interface `SamplePipeline`.
A pass-through pipeline will be added in a future cl.

PiperOrigin-RevId: 407555102
2021-11-09 10:09:26 +00:00
hschlueter
52c330c1d7 Write sample size to dumpfile in transformer tests.
If the number of samples changes, the sizes will help us to verify
whether they are just split differently or extra data was added.

PiperOrigin-RevId: 407346280
2021-11-09 10:09:13 +00:00
aquilescanta
ab9741aced Parse HDR static metadata from MP4 files
#minor-release

PiperOrigin-RevId: 407136922
2021-11-09 10:09:13 +00:00
tonihei
d1e13b629d Fix rounding error in fMP4 presentation time calculation
The presentation time in fMP4 is calculated by adding and subtracting
3 values. All 3 values are currently converted to microseconds first
before the calculation, leading to rounding errors. The rounding errors
can be avoided by doing the conversion to microseconds as the last step.

For example:
In timescale 96000:  8008+8008-16016 = 0
Rounding to us first: 83416+83416-166833=-1

#minor-release

PiperOrigin-RevId: 406809844
2021-11-09 10:07:30 +00:00
tonihei
10dcdd1df5 Add large renderer position offset.
This helps to prevent issues where decoders can't handle negative
timestamps. In particular it avoids issues when the media accidentally
or intentionally starts with small negative timestamps. But it also
helps to prevent other renderer resets at a later point, for example
if a live stream with a large start offset is enqueued in the playlist.

#minor-release

PiperOrigin-RevId: 406786977
2021-11-09 10:07:00 +00:00
ibaker
e8fdab353f Allow missing full_range_flag in colr box with type=nclx
Test file produced with:
$ MP4Box -add "sample.mp4#video:colr=nclc,1,1,1" -new sample_18byte_nclx_colr.mp4

And then manually changing the `nclc` bytes to `nclx`.

This produces an 18-byte `colr` box with type `nclx`. The bitstream of
this file does not contain HDR content, so the file itself is invalid
for playback with a real decoder, but adding the box is enough to test
the extractor change in this commit.

(aside: MP4Box will let you pass `nclx`, but it requires 4 parameters, i.e. it
requires the full_range_flag to be set, resulting in a valid 19-byte colr box)

#minor-release
Issue: #9332
PiperOrigin-RevId: 405842520
2021-10-27 13:04:55 +01:00