280 Commits

Author SHA1 Message Date
apodob
095c63933b Fix the preparation of Extractor inside the init() method
Extractor was not calling endTracks() and seekMap() on the
extractorOutput which are required to finish the preparation.
At that point extractor does not support seeking.

PiperOrigin-RevId: 393994848
2021-09-02 09:38:30 +01:00
kimvde
97466ab779 TsExtractor: handle packets without PTS
#minor-release
Issue: #9294
PiperOrigin-RevId: 392844983
2021-08-25 10:59:58 +01:00
andrewlewis
654a320792 Remove stray symlinks
These are unneeded for the external project

#minor-release

PiperOrigin-RevId: 392835942
2021-08-25 10:58:20 +01:00
apodob
cbd6527926 Set format.sampleMimeType to TEXT_EXOPLAYER_CUES in SubtitleExtractor.
Samples are serialized using our custom CueEncoder. Information in
which format samples are encoded is needed by Renderer to decide which
decoder to use. Extractor receives Format object in the constructor and
prepares new Format object with sampleMimeType moved to codecs field
and new sampleMimeType set to "custom serialized exoplayer Cue".

PiperOrigin-RevId: 391739866
2021-08-20 11:44:06 +01:00
apodob
afc549fba4 Release subtitle outputBuffer after decoding.
PiperOrigin-RevId: 391509443
2021-08-19 10:51:34 +01:00
apodob
80d9d47d1c Add Extractor#release() implementation.
SubtitleExtractor.release() releases the underlying SubtitleDecoder.
This change introduces the STATE_RELEASED state. The extractor
handles the new state in the read() and seek() methods.

PiperOrigin-RevId: 391046478
2021-08-17 15:41:03 +01:00
olly
88a637bc45 Move format util classes to extractor package
PiperOrigin-RevId: 390577072
2021-08-13 11:45:37 +01:00
apodob
c5b01b2f7b Add SubtitleExtractor which wraps a SubtitleDecoder.
SubtitleExtractor is a component that extracts subtitle data taken from
ExtractorInput into samples. Samples are pushed into an ExtractorOutput
(usually SampleQueue). As a temporary solution SubtitleExtractor uses
SubtitleDecoder to extract Cues from input data.

PiperOrigin-RevId: 390319875
2021-08-12 16:33:14 +01:00
olly
7e8ba03147 Deprecate final non-nested Factory classes in upstream
PiperOrigin-RevId: 389661768
2021-08-09 20:07:24 +01:00
ibaker
db1fe8041b Remove @DoNotInstrument from test classes
This isn't needed now we've updated to Robolectric 4.6

Follow-up to 0df0df9aee

PiperOrigin-RevId: 389616471
2021-08-09 20:02:05 +01:00
olly
a34809bb9d Tweak use of TimestampAdjuster for seeking
- Fix use of getTimestampOffsetUs in TsExtractor where
  getFirstSampleTimestampUs should have been used.
- Don't reset TimestampAdjuster if it's in no-offset mode.
- Improve comment clarity

#minor-release

PiperOrigin-RevId: 388682711
2021-08-04 18:40:45 +01:00
olly
f726212180 Simplify TimestampAdjuster logic
- Use timestampOffsetUs == C.TIME_UNSET directly as the way of
  determining whether the adjuster has determined the offset,
  rather than relying on lastSampleTimestampUs checks for this.
- Remove comment referring to lastSampleTimestampUs as holding
  the "adjusted PTS". Its value may not have originated from a PTS
  timestamp. It's also confusing to refer to it as "adjusted"
  given timestampOffsetUs has not been applied to it.
- Fix PassthroughSectionPayloadReader to make sure it'll never
  output a sample with an unset timestamp.

#minor-release

PiperOrigin-RevId: 388226180
2021-08-02 19:19:28 +01:00
andrewlewis
9c27cfcda7 Fix parameter names on overridden methods
The dokka javadoc generation tool complains when parameter names don't match between a method and its override. This change updates occurrences where there is currently a mismatch.

Notable renamings that might be controversial:
- `onPlaybackStateChanged(int state)` to `onPlaybackStateChanged(int playbackState)` affected a lot of lines but seems more consistent with other '-Changed' methods.
- `handleMessage(int messageType, Object payload)` to `handleMessage(int messageType, Object message)`
- `ExtractorInput` and `DataSource` inherit `DataReader` which had `read(byte[] target, ...`, while data sources normally called the first parameter `buffer`. I have standardized these all to use `buffer` even though it looks out of place in the `ExtractorInput` interface (which has more `read` methods with `target`).

PiperOrigin-RevId: 387290360
2021-07-28 09:15:29 +01:00
olly
c6e860b8bb Fix 1 ErrorProneStyle finding:
* @Flags is not a TYPE_USE annotation, so should appear before any modifiers and after Javadocs.
  (see go/java-style#s4.8.5-annotations)

This CL looks good? Just LGTM and Approve it!
This CL doesn’t look good? This is what you can do:
* Suggest a fix on the CL (go/how-to-suggest-fix).
* Revert this CL, by replying "REVERT: <provide reason>"
* File a bug under go/error-prone-bug for category ErrorProneStyle if the change looks generally problematic.
* Revert this CL and not get a CL that cleans up these paths in the future by
replying "BLOCKLIST: <provide reason>". This is not reversible! We recommend to
opt out the respective paths in your CL Robot configuration instead:
go/clrobot-opt-out.

This CL was generated by CL Robot - a tool that cleans up code findings
(go/clrobot). The affected code paths have been enabled for CL Robot in //depot/google3/java/com/google/android/libraries/media/METADATA which is reachable following include_presubmits from //depot/google3/third_party/java_src/android_libs/media/METADATA.
Anything wrong with the signup? File a bug at go/clrobot-bug.

#codehealth

PiperOrigin-RevId: 386849198
2021-07-27 12:22:08 +01:00
kim-vde
8e29e76b51 Merge pull request #9163 from ProtoScott:feature/dtsx_codec_updates
PiperOrigin-RevId: 386428758
2021-07-23 14:12:29 +01:00
aquilescanta
99abb4e1e9 Check for TS synchronization before parsing packet from random position
#minor-release
Issue: #9100
PiperOrigin-RevId: 384962258
2021-07-16 11:22:55 +01:00
bachinger
f60c080500 Minor change to extractor module to avoid formatting changes
PiperOrigin-RevId: 384730845
2021-07-14 21:18:23 +01:00
kimvde
1309b26ebe Add support for MP4 H263 atom type
#minor-release
Issue:#9158
PiperOrigin-RevId: 383660258
2021-07-09 09:24:13 +01:00
Scott
716cbceaa4 Updates to mp4 atom extractor/parser for dtsx support. 2021-07-08 11:07:56 +01:00
kimvde
6e4508daec Improve support for Ogg truncated content
#minor-release

Issue:#7608
PiperOrigin-RevId: 382081687
2021-06-30 13:49:15 +01:00
aquilescanta
fc26d4eeb1 Remove the last deprecated ParserException constructor
PiperOrigin-RevId: 381221669
2021-06-30 13:27:45 +01:00
andrewlewis
7d05f20493 Signal container MIME type for JPEGs
Before this change the `Format` on the image track output by the
`JpegExtractor` doesn't have a MIME type.

PiperOrigin-RevId: 381015819
2021-06-30 13:19:00 +01:00
aquilescanta
81c542b6a7 Remove deprecated ParserException constructor
And replace it with factory method which includes more
context for error code assignment.

PiperOrigin-RevId: 380624625
2021-06-21 22:29:27 +01:00
olly
a3dbd61239 Remove obsolete Checker Framework suppression strings
More information: go/checker-3130-lsc

Tested:
    Some test failures are present, but the CL author has decided to mail the change anyway
PiperOrigin-RevId: 379622938
2021-06-21 21:56:37 +01:00
olly
4e8895d5cb Fix issue where a trun atom could be associated with the wrong track
Note that this removes a workaround for malformed content, in which the
track_ID is set incorrectly. It's unclear there was sufficient reason to
implement that workaround, and so it's preferable to remove it, rather
than implementing the concept of unrecognized tracks, which would be
needed to keep it and to also fix this issue.

Issue: #9056
#minor-release
PiperOrigin-RevId: 379506261
2021-06-15 18:45:21 +01:00
olly
3e819d082a Make javadoc valid html5
As of [JDK-8247957](https://bugs.openjdk.java.net/browse/JDK-8247957), doclint
no longer supports html4.

Tested:
    Some test failures are present, but the CL author has decided to mail the change anyway
PiperOrigin-RevId: 378819179
2021-06-11 12:23:35 +01:00
aquilescanta
b5dbadee0c Remove ParserException(cause) constructor
PiperOrigin-RevId: 378635295
2021-06-10 17:36:29 +01:00
olly
4b30cca914 Update @SuppressWarnings annotations for go/nullness diagnostics
in preparation for upgrading the version of the Checker Framework in google3.

More information: go/checker-3110-lsc

PiperOrigin-RevId: 377925828
2021-06-08 13:02:47 +01:00
bachinger
5700401ec1 Reformat README of extractors module
PiperOrigin-RevId: 377031562
2021-06-02 18:17:13 +01:00
bachinger
f40a92281b Add @DoNotInstrument annotations for extractors module
PiperOrigin-RevId: 377007386
2021-06-02 18:14:35 +01:00
aquilescanta
85e4137b81 Add test for ColorInfo in MP4
PiperOrigin-RevId: 375992816
2021-05-27 10:44:50 +01:00
aquilescanta
ddc047c235 Add ColorInfo parsing support in MP4 files
PiperOrigin-RevId: 375719035
2021-05-26 11:32:29 +01:00
aquilescanta
2e8d4c9110 Extract function for mapping ColorInfo-related constants
PiperOrigin-RevId: 375705247
2021-05-26 11:31:52 +01:00
aquilescanta
1fa61feb7e Migrate AtomParsers to using new ParserException fields
PiperOrigin-RevId: 375133184
2021-05-26 11:24:46 +01:00
aquilescanta
3f33f10a32 Add ExtractorUtil method for checking input conditions
Unlike Assertions, the introduced method cannot be disabled and throws
a ParserException instead. This method is meant to replace regular
assertions (which throw RuntimeExceptions) which check input in the
parsing code.

PiperOrigin-RevId: 375085160
2021-05-21 18:24:37 +01:00
aquilescanta
23d4efad7b Make TYPE_* constant declarations in lexicographic order
PiperOrigin-RevId: 374880929
2021-05-21 12:03:04 +01:00
kim-vde
eb93e5c0b5 Merge pull request #8860 from KeiMurayamaS:dev-v2-add-mpegh-parser
PiperOrigin-RevId: 373142159
2021-05-11 16:01:46 +01:00
Kei Murayama
f05197c4d5 Support parsing MPEG-H 3D Audio
First intention to support parsing MPEG-H 3D Audio in ExoPlayer is to
take advantage of parsing capability from MediaParser API in AOSP.
Just with this change ExoPlayer does't support decoding MPEG-H 3D Audio
but can support decoding either by adding decoder with an extension or
by using Android OS which has decoder capability with MediaCodec API.
2021-05-10 17:55:03 +09:00
bachinger
4c1a294b2e Format Java source files
PiperOrigin-RevId: 372127633
2021-05-06 13:32:25 +01:00
bachinger
cdff456621 Make copybara remove the LINT.IfChange tag
PiperOrigin-RevId: 371135534
2021-04-29 17:35:05 +01:00
ibaker
dafea4e40f Re-format some javadoc
PiperOrigin-RevId: 369642047
2021-04-21 18:46:00 +01:00
andrewlewis
a29ad96b1e Update internal codebase location for extractor module
PiperOrigin-RevId: 369609585
2021-04-21 10:24:26 +01:00
andrewlewis
d359882871 Update internal codebase location for flac extension
PiperOrigin-RevId: 368388742
2021-04-14 11:42:51 +01:00
olly
7aeb476812 Fix DefaultExtractorInputTest.largeSkip
PiperOrigin-RevId: 365992439
2021-04-01 16:04:42 +01:00
tonihei
76700e9d84 Log error for TrackGroups with multiple languages or role flags.
A TrackGroup must contain the same content in all Formats (except for
the quality, encoding etc). Verify that the language and role flags
are the same and log an error if don't match. Don't throw to avoid
breaking existing use cases that just happen to work by chance.

PiperOrigin-RevId: 365539240
2021-04-01 16:03:43 +01:00
aquilescanta
273d68accd Add missing switch case
Before this change, calling read after reaching the end of input in an Ogg file
would cause an IllegalStateException.

PiperOrigin-RevId: 364758873
2021-03-24 18:07:25 +00:00
kimvde
2c76bc5a4c JpegExtractor: support JFIF segment preceding Exif segment
#minor-release

PiperOrigin-RevId: 364561115
2021-03-24 18:06:16 +00:00
kimvde
ef2f8b7ae6 JpegExtractor: read GContainer and GContainerItem XMP prefixes
#minor-release

PiperOrigin-RevId: 363859522
2021-03-24 18:04:56 +00:00
olly
6f8a8fbc1c HLS: Allow audio variants to initialize the timestamp adjuster
This makes HLS playback less liable to become stuck if discontinuity
tags are inserted at different times across media playlists.

Issue: #8700
Issue: #8372
PiperOrigin-RevId: 362903428
2021-03-15 19:14:52 +00:00
kimvde
c1ef00ab42 Revert logic to decide whether meta atom is full
The previous logic was changed under the assumption that the first box
inside a meta box was not always an hdlr box, but this is not true.

#minor-release

PiperOrigin-RevId: 357200713
2021-02-12 19:55:47 +00:00