11589 Commits

Author SHA1 Message Date
ibaker
926df59081 Defensively copy potentially mutable text in Cue constructor
Without this the Cue isn't deeply immutable, which can be a bit
surprising.

PiperOrigin-RevId: 375477571
2021-05-26 11:27:59 +01:00
ibaker
2081f4b466 Annotate Cue.Builder getters with @Pure
This reduces the null-checking required in a follow-up change.

PiperOrigin-RevId: 375468504
2021-05-26 11:27:22 +01:00
ibaker
5afc915e51 Don't restore DRM keys before releasing them
#minor-release

PiperOrigin-RevId: 375436117
2021-05-26 11:26:09 +01:00
samrobinson
8d550bf05b Add an extras bundle to MediaMetadata.
#minor-release

PiperOrigin-RevId: 375435339
2021-05-26 11:25:27 +01:00
aquilescanta
1fa61feb7e Migrate AtomParsers to using new ParserException fields
PiperOrigin-RevId: 375133184
2021-05-26 11:24:46 +01:00
samrobinson
e793a9031b Add a mediaType field to MediaMetadata.
#minor-release

PiperOrigin-RevId: 375097412
2021-05-21 18:25:49 +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
krocard
e8ca443389 Add to realease note DefaultDrmSessionEventListener's rename.
Its absence seems to have caused
https://github.com/google/ExoPlayer/issues/8969.

#minor-release

PiperOrigin-RevId: 375058222
2021-05-21 18:24:01 +01:00
olly
e9f66fc5d1 Replace internal dependencies on monolithic module
PiperOrigin-RevId: 375054051
2021-05-21 12:05:56 +01:00
tonihei
8ded11753e Fix issue where getFirstSampleIndex was called on spliced in chunks.
We need to avoid reading and skipping into preload chunks as they
may need to be discarded. The current code iterates over all chunks,
but this can be simplified by just checking the last chunk knowing
that the preload chunk must always be the last one.

As a result, we avoid calling getFirstSampleIndex on all chunks. This
is a bug since the method is not allowed to be called for chunks
that have been spliced in. This still leaves the smaller issue of
potentially calling this method for spliced-in preload chunks, which
will be solved separately.

Issue: #8937

#minor-release

PiperOrigin-RevId: 375053638
2021-05-21 12:05:23 +01:00
olly
8c9c0f8d3f Gradle cleanup #3
Tweak the way directories are passed

PiperOrigin-RevId: 374912886
2021-05-21 12:04:15 +01:00
aquilescanta
2c2197d12c Assign ERROR_CODE_IO_BAD_HTTP_STATUS to InvalidResponseCodeException
PiperOrigin-RevId: 374885599
2021-05-21 12:03:39 +01:00
aquilescanta
23d4efad7b Make TYPE_* constant declarations in lexicographic order
PiperOrigin-RevId: 374880929
2021-05-21 12:03:04 +01:00
aquilescanta
1c4294175f Add contentIsMalformed and dataType to ParserException
PiperOrigin-RevId: 374874272
2021-05-21 12:02:29 +01:00
tonihei
08259f8987 Don't allow spliced-in preload chunks.
Preload chunks may still need to be discarded. However, we don't
currently support discarding spliced-in chunks. Thus, we need to
avoid loadng a preload chunk that needs to be spliced-in.

Issue: #8937

#minor-release

PiperOrigin-RevId: 374851661
2021-05-20 15:45:30 +01:00
olly
20fcb42872 Gradle cleanup #2
PiperOrigin-RevId: 374847609
2021-05-20 15:44:28 +01:00
olly
45fde20b0e Gradle cleanup #1
Colocate lines that refer to the same module, to reduce probability of
accidentally removing one line and not the other (which has happened
more than once :)).

PiperOrigin-RevId: 374847082
2021-05-20 15:43:59 +01:00
tonihei
d08303d05d Add ServerSideInsertedAdsMediaSource.
This media source wraps another source and publishes a Timeline with
ads. The created MediaPeriods for ad and content are mapped back to
the original stream to allow seamless playback.

PiperOrigin-RevId: 374836091
2021-05-20 15:43:00 +01:00
tonihei
1a6f36d4a4 Fix reading position at stream transition.
PiperOrigin-RevId: 374836046
2021-05-20 15:42:31 +01:00
tonihei
8eb990e47a Make SSAI player logic more targeted.
There is a newly added condition to help advancing between SSAI ads
and content in case the ad group position or ad duration changed. The
condition currently doesn't check directly whether it's a SSAI
transition but relies on indrect signals. Making this more direct
helps to understand the purpose and avoid unintentional bugs where
this condition would apply in other cases too.

In addition, we need to exclude TextRenderer from the check because
its read position doesn't correspond to the actual decode position
since the decoding happens in the renderer itself (b/181312195).

PiperOrigin-RevId: 374835985
2021-05-20 15:42:02 +01:00
tonihei
5ff4211c5e Avoid recalculation of whether a MediaPeriod is part of a SSAI stream
We can instead just save this information in MediaPeriodInfo, similar
to how we store whether the MediaPeriod is last in the timeline etc.

PiperOrigin-RevId: 374835918
2021-05-20 15:41:34 +01:00
olly
0de6bc861a Format *_jni.cc files
PiperOrigin-RevId: 374830877
2021-05-20 15:40:34 +01:00
klhyun
9e4315f48d Implement MediaController#getCurrentCues
It only covers MediaSession - MediaController
(Does not consider cases that either a legacy session or a legacy controller is involved)

Add PlayerInfo#Builder to clean it up.

PiperOrigin-RevId: 374785779
2021-05-20 15:39:34 +01:00
christosts
65d8ff80db ForwardingPlayer only forwards Player operations
PiperOrigin-RevId: 374621615
2021-05-19 20:24:53 +01:00
krocard
41afb6ac4e Add guarantied invalid command to allow niche optimisations
This allows users to use `int` to store an optional command.

PiperOrigin-RevId: 374600127
2021-05-19 20:24:29 +01:00
claincly
e383b0031d Define the default RTSP character set.
#minor-release

PiperOrigin-RevId: 374433331
2021-05-19 20:24:04 +01:00
aquilescanta
66c1aedeb3 Assign ERROR_CODE_BEHIND_LIVE_WINDOW to BehindLiveWindowExceptions
PiperOrigin-RevId: 374425179
2021-05-19 20:23:38 +01:00
ibaker
73f28d4829 Fix core_settings.gradle to not assume exoplayerRoot is absolute
Gradle warns against passing a relative path to `new File(String)`:
https://docs.gradle.org/current/userguide/working_with_files.html#sec:single_file_paths

This change fixes all usages of `exoplayerRoot` to pass it to Gradle's
`Project.file()` first, which returns an absolute `File`.

To reproduce the problem in Issue: #8927:
1. Checkout ExoPlayer git project, to e.g. `~/ExoPlayer/exoplayer-git`
2. Create a new Android Studio project in e.g. `~/AndroidStudioProjects/exoplayer-test`
3. Edit the new project's `settings.gradle` file as described in
   https://github.com/google/ExoPlayer/blob/release-v2/README.md
   using a relative path for `exoplayerRoot`:
   ```
   gradle.ext.exoplayerRoot = '../../ExoPlayer/exoplayer-git'
   ```
4. In a shell:
   ```bash
   $ cd ~/AndroidStudioProjects/exoplayer-test/app
   $ ../gradlew build
   ```

(Step 4 is important, it seems running `./gradlew` from the project root
doesn't trigger the relative path problem)

This change fixes the problem, and also works with `exoplayerRoot` as a
`File` or `Path` object. `String`, `File` and `Path` all work with relative or
absolute paths:
```
gradle.ext.exoplayerRoot = '/home/ibaker/ExoPlayer/exoplayer-git'
gradle.ext.exoplayerRoot = '../../ExoPlayer/exoplayer-git'
gradle.ext.exoplayerRoot = new File('/home/ibaker/ExoPlayer/exoplayer-git')
gradle.ext.exoplayerRoot = new File('../../ExoPlayer/exoplayer-git')
gradle.ext.exoplayerRoot = Paths.get('/home/ibaker/ExoPlayer/exoplayer-git')
gradle.ext.exoplayerRoot = Paths.get('../../ExoPlayer/exoplayer-git')
```

Note: The Path versions above require importing `java.nio.file.Paths`
and changing the `apply from:` line in the project's settings.gradle
file to something like:
```
apply from: file(gradle.ext.exoplayerRoot.resolve('core_settings.gradle'))
```
It's assumed that a project wanting to pass a `Path` will make these
changes.

Issue: #8927
PiperOrigin-RevId: 374421627
2021-05-19 20:23:13 +01:00
aquilescanta
227795964b Add an IntDef for DATA_TYPE_* constants
PiperOrigin-RevId: 374418502
2021-05-19 20:22:48 +01:00
aquilescanta
6c06b4efd1 Re-order error codes for symmetry
PiperOrigin-RevId: 374416794
2021-05-19 20:22:23 +01:00
aquilescanta
61c92007b7 Bubble up the errorCode argument in preparation for new factory methods
Notes:
- The only functional change is that createForRemote now assings ERROR_CODE_REMOTE_ERROR.
- createForSource still uses ERROR_CODE_UNSPECIFIED, even though it expects an
  IOException. The reason for not using ERROR_CODE_IO_UNSPECIFIED is that the reason for
  the error might not be IO. For example, malformed media, or BehindLiveWindowException,
  which have non-IO error codes. So using UNSPECIFIED saves a later change in category.
PiperOrigin-RevId: 374390407
2021-05-19 20:21:57 +01:00
tonihei
378b3f6eb5 Add Util class for server-side inserted ads.
When working with SSAI ads, we need to easily convert positions between
the underlying stream and the media model that exposes ad groups. To
simplify this, we can add util methods (that are testable on their own).

In addition, we need an easy way to build AdPlaybackStates for SSAI
inserted ads. The metadata is obtained out-of-band and usually has the
ad group start and end times in the underlying stream only. Hence, we
also add a util method to add a new ad group based on this information.

PiperOrigin-RevId: 374369360
2021-05-19 20:21:32 +01:00
aquilescanta
c7db9fb390 Deduplicate calls to maybeNotifyPlaybackInfoChanged
PiperOrigin-RevId: 374253036
2021-05-19 20:21:08 +01:00
samrobinson
25b453a5fe Add track number & total to MediaMetadata
#minor-release

PiperOrigin-RevId: 374235979
2021-05-19 20:20:43 +01:00
Denise LaFayette
e3228064f3 Introduce LanguageFeatureStyle interface to mark language features 2021-05-17 13:20:34 -07:00
ibaker
d5d7823877 Remove reference to Issue #4133 in exoplayer.dev/drm
The issue is fixed in 2.14.0 - keys are fetched ahead of playback

#minor-release

PiperOrigin-RevId: 374159998
2021-05-17 18:23:44 +01:00
olly
b882ba0f37 Update links for new Javadoc
PiperOrigin-RevId: 374216724
2021-05-17 18:23:33 +01:00
tonihei
6fd20ddace Fix start position for non-precise startOffset and user-set liveOffset
Also added test cases covering this.

PiperOrigin-RevId: 374218514
2021-05-17 18:20:54 +01:00
olly
c80355c903 Update links for new Javadoc
PiperOrigin-RevId: 374216724
2021-05-17 18:20:33 +01:00
tonihei
04d6c8ed19 Fix grammar nit
PiperOrigin-RevId: 374186953
2021-05-17 18:20:14 +01:00
krocard
6a30af567f Add Commands.Builder.addAllCommands for easy init
MediaSession default command state contains all
commands.
To avoid having to update MediaSession when a command
is added, allow to create a Commands.Builder that
starts with all commands.

PiperOrigin-RevId: 374183484
2021-05-17 18:19:53 +01:00
aquilescanta
17209ed1ee Use the term equivalent instead of equal in assertion
The assertion doesn't check equality (as in x.equals(y)), but rather
whether a subset of the fields are equal.

PiperOrigin-RevId: 374183338
2021-05-17 18:19:32 +01:00
olly
2566b24642 Remove deprecated Listener.onTimelineChanged
PiperOrigin-RevId: 374171038
2021-05-17 18:19:13 +01:00
olly
0c80a54bc1 Update avcLevelToMaxFrameSize for AVCLevel6, 61 and 62
#minor-release

PiperOrigin-RevId: 374161340
2021-05-17 18:18:34 +01:00
christosts
1dfda7ab6e ForwardingPlayer implements Player
Make ForwardingPlayer implement Player and not extend BasePlayer so that
ForwardingPlayer forwards each Player method directly to the wrapped
Player instance.

PiperOrigin-RevId: 374161084
2021-05-17 18:18:14 +01:00
ibaker
ea597a8002 Remove reference to Issue #4133 in exoplayer.dev/drm
The issue is fixed in 2.14.0 - keys are fetched ahead of playback

#minor-release

PiperOrigin-RevId: 374159998
2021-05-17 18:17:54 +01:00
olly
936fa7cc15 Update Javadoc for 2.14.0
#minor-release

PiperOrigin-RevId: 373351935
2021-05-17 16:37:39 +01:00
Denise LaFayette
49dfe66bb3 Preserve Japanese language features when not applying embedded styling
Fix bug where rubies and boutens are missing, tate-chu-yoko is rendered
incorrectly when SubtitleView.setApplyEmbeddedStyles(false). This method
should only affect styling elements and not remove any language features.
2021-05-14 16:37:37 -07:00
Oliver Woodman
a79b61f86b Merge branch 'release-v2' into dev-v2 2021-05-14 11:52:11 +01:00
Oliver Woodman
92e05bcd66 Remove dev release notes from release 2021-05-14 11:36:34 +01:00