Skip to content

Commit 03569f9

Browse files
authored
Merge pull request #10349 from google/dev-v2-r2.18.0
r2.18.0
2 parents a308c69 + 85d8682 commit 03569f9

File tree

825 files changed

+56460
-15683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

825 files changed

+56460
-15683
lines changed

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ body:
1818
label: ExoPlayer Version
1919
description: What version of ExoPlayer are you using?
2020
options:
21+
- 2.18.0
2122
- 2.17.1
2223
- 2.17.0
2324
- 2.16.1

RELEASENOTES.md

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,194 @@
11
# Release notes
22

3+
### 2.18.0 (2022-06-16)
4+
5+
This release corresponds to the
6+
[AndroidX media3 1.0.0-beta01 release](https://github.com/androidx/media/releases/tag/1.0.0-beta01).
7+
8+
* Core library:
9+
* Enable support for Android platform diagnostics via
10+
`MediaMetricsManager`. ExoPlayer will forward playback events and
11+
performance data to the platform, which helps to provide system
12+
performance and debugging information on the device. This data may also
13+
be collected by Google
14+
[if sharing usage and diagnostics data is enabled](https://support.google.com/accounts/answer/6078260)
15+
by the user of the device. Apps can opt-out of contributing to platform
16+
diagnostics for ExoPlayer with
17+
`ExoPlayer.Builder.setUsePlatformDiagnostics(false)`.
18+
* Fix bug that tracks are reset too often when using `MergingMediaSource`,
19+
for example when side-loading subtitles and changing the selected
20+
subtitle mid-playback
21+
([#10248](https://github.com/google/ExoPlayer/issues/10248)).
22+
* Stop detecting 5G-NSA network type on API 29 and 30. These playbacks
23+
will assume a 4G network.
24+
* Disallow passing `null` to
25+
`MediaSource.Factory.setDrmSessionManagerProvider` and
26+
`MediaSource.Factory.setLoadErrorHandlingPolicy`. Instances of
27+
`DefaultDrmSessionManagerProvider` and `DefaultLoadErrorHandlingPolicy`
28+
can be passed explicitly if required.
29+
* Add `MediaItem.RequestMetadata` to represent metadata needed to play
30+
media when the exact `LocalConfiguration` is not known. Also remove
31+
`MediaMetadata.mediaUrl` as this is now included in `RequestMetadata`.
32+
* Add `Player.Command.COMMAND_SET_MEDIA_ITEM` to enable players to allow
33+
setting a single item.
34+
* Track selection:
35+
* Flatten `TrackSelectionOverrides` class into `TrackSelectionParameters`,
36+
and promote `TrackSelectionOverride` to a top level class.
37+
* Rename `TracksInfo` to `Tracks` and `TracksInfo.TrackGroupInfo` to
38+
`Tracks.Group`. `Player.getCurrentTracksInfo` and
39+
`Player.Listener.onTracksInfoChanged` have also been renamed to
40+
`Player.getCurrentTracks` and `Player.Listener.onTracksChanged`.
41+
* Change `DefaultTrackSelector.buildUponParameters` and
42+
`DefaultTrackSelector.Parameters.buildUpon` to return
43+
`DefaultTrackSelector.Parameters.Builder` instead of the deprecated
44+
`DefaultTrackSelector.ParametersBuilder`.
45+
* Add
46+
`DefaultTrackSelector.Parameters.constrainAudioChannelCountToDeviceCapabilities`
47+
which is enabled by default. When enabled, the `DefaultTrackSelector`
48+
will prefer audio tracks whose channel count does not exceed the device
49+
output capabilities. On handheld devices, the `DefaultTrackSelector`
50+
will prefer stereo/mono over multichannel audio formats, unless the
51+
multichannel format can be
52+
[Spatialized](https://developer.android.com/reference/android/media/Spatializer)
53+
(Android 12L+) or is a Dolby surround sound format. In addition, on
54+
devices that support audio spatialization, the `DefaultTrackSelector`
55+
will monitor for changes in the
56+
[Spatializer properties](https://developer.android.com/reference/android/media/Spatializer.OnSpatializerStateChangedListener)
57+
and trigger a new track selection upon these. Devices with a
58+
`television`
59+
[UI mode](https://developer.android.com/guide/topics/resources/providing-resources#UiModeQualifier)
60+
are excluded from these constraints and the format with the highest
61+
channel count will be preferred. To enable this feature, the
62+
`DefaultTrackSelector` instance must be constructed with a `Context`.
63+
* Video:
64+
* Rename `DummySurface` to `PlaceholderSurface`.
65+
* Add AV1 support to the `MediaCodecVideoRenderer.getCodecMaxInputSize`.
66+
* Audio:
67+
* Use LG AC3 audio decoder advertising non-standard MIME type.
68+
* Change the return type of `AudioAttributes.getAudioAttributesV21()` from
69+
`android.media.AudioAttributes` to a new `AudioAttributesV21` wrapper
70+
class, to prevent slow ART verification on API < 21.
71+
* Query the platform (API 29+) or assume the audio encoding channel count
72+
for audio passthrough when the format audio channel count is unset,
73+
which occurs with HLS chunkless preparation
74+
([10204](https://github.com/google/ExoPlayer/issues/10204)).
75+
* Configure `AudioTrack` with channel mask
76+
`AudioFormat.CHANNEL_OUT_7POINT1POINT4` if the decoder outputs 12
77+
channel PCM audio
78+
([#10322](#https://github.com/google/ExoPlayer/pull/10322).
79+
* DRM
80+
* Ensure the DRM session is always correctly updated when seeking
81+
immediately after a format change
82+
([10274](https://github.com/google/ExoPlayer/issues/10274)).
83+
* Text:
84+
* Change `Player.getCurrentCues()` to return `CueGroup` instead of
85+
`List<Cue>`.
86+
* SSA: Support `OutlineColour` style setting when `BorderStyle == 3` (i.e.
87+
`OutlineColour` sets the background of the cue)
88+
([#8435](https://github.com/google/ExoPlayer/issues/8435)).
89+
* CEA-708: Parse data into multiple service blocks and ignore blocks not
90+
associated with the currently selected service number.
91+
* Remove `RawCcExtractor`, which was only used to handle a Google-internal
92+
subtitle format.
93+
* Extractors:
94+
* Matroska: Parse `DiscardPadding` for Opus tracks.
95+
* MP4: Parse bitrates from `esds` boxes.
96+
* Ogg: Allow duplicate Opus ID and comment headers
97+
([#10038](https://github.com/google/ExoPlayer/issues/10038)).
98+
* UI:
99+
* Fix delivery of events to `OnClickListener`s set on `StyledPlayerView`
100+
and `PlayerView`, in the case that `useController=false`
101+
([#9605](https://github.com/google/ExoPlayer/issues/9605)). Also fix
102+
delivery of events to `OnLongClickListener` for all view configurations.
103+
* Fix incorrectly treating a sequence of touch events that exit the bounds
104+
of `StyledPlayerView` and `PlayerView` before `ACTION_UP` as a click
105+
([#9861](https://github.com/google/ExoPlayer/issues/9861)).
106+
* Fix `PlayerView` accessibility issue where tapping might toggle playback
107+
rather than hiding the controls
108+
([#8627](https://github.com/google/ExoPlayer/issues/8627)).
109+
* Rewrite `TrackSelectionView` and `TrackSelectionDialogBuilder` to work
110+
with the `Player` interface rather than `ExoPlayer`. This allows the
111+
views to be used with other `Player` implementations, and removes the
112+
dependency from the UI module to the ExoPlayer module. This is a
113+
breaking change.
114+
* Don't show forced text tracks in the `PlayerView` track selector, and
115+
keep a suitable forced text track selected if "None" is selected
116+
([#9432](https://github.com/google/ExoPlayer/issues/9432)).
117+
* DASH:
118+
* Parse channel count from DTS `AudioChannelConfiguration` elements. This
119+
re-enables audio passthrough for DTS streams
120+
([#10159](https://github.com/google/ExoPlayer/issues/10159)).
121+
* Disallow passing `null` to
122+
`DashMediaSource.Factory.setCompositeSequenceableLoaderFactory`.
123+
Instances of `DefaultCompositeSequenceableLoaderFactory` can be passed
124+
explicitly if required.
125+
* HLS:
126+
* Fallback to chunkful preparation if the playlist CODECS attribute does
127+
not contain the audio codec
128+
([#10065](https://github.com/google/ExoPlayer/issues/10065)).
129+
* Disallow passing `null` to
130+
`HlsMediaSource.Factory.setCompositeSequenceableLoaderFactory`,
131+
`HlsMediaSource.Factory.setPlaylistParserFactory`, and
132+
`HlsMediaSource.Factory.setPlaylistTrackerFactory`. Instances of
133+
`DefaultCompositeSequenceableLoaderFactory`,
134+
`DefaultHlsPlaylistParserFactory`, or a reference to
135+
`DefaultHlsPlaylistTracker.FACTORY` can be passed explicitly if
136+
required.
137+
* Smooth Streaming:
138+
* Disallow passing `null` to
139+
`SsMediaSource.Factory.setCompositeSequenceableLoaderFactory`. Instances
140+
of `DefaultCompositeSequenceableLoaderFactory` can be passed explicitly
141+
if required.
142+
* RTSP:
143+
* Add RTP reader for MPEG4
144+
([#35](https://github.com/androidx/media/pull/35)).
145+
* Add RTP reader for HEVC
146+
([#36](https://github.com/androidx/media/pull/36)).
147+
* Add RTP reader for AMR. Currently only mono-channel, non-interleaved AMR
148+
streams are supported. Compound AMR RTP payload is not supported.
149+
([#46](https://github.com/androidx/media/pull/46))
150+
* Add RTP reader for VP8
151+
([#47](https://github.com/androidx/media/pull/47)).
152+
* Add RTP reader for WAV
153+
([#56](https://github.com/androidx/media/pull/56)).
154+
* Fix RTSP basic authorization header.
155+
([#9544](https://github.com/google/ExoPlayer/issues/9544)).
156+
* Stop checking mandatory SDP fields as ExoPlayer doesn't need them
157+
([#10049](https://github.com/google/ExoPlayer/issues/10049)).
158+
* Throw checked exception when parsing RTSP timing
159+
([#10165](https://github.com/google/ExoPlayer/issues/10165)).
160+
* Add RTP reader for VP9
161+
([#47](https://github.com/androidx/media/pull/64)).
162+
* Add RTP reader for OPUS
163+
([#53](https://github.com/androidx/media/pull/53)).
164+
* Data sources:
165+
* Rename `DummyDataSource` to `PlaceholderDataSource`.
166+
* Workaround OkHttp interrupt handling.
167+
* Ad playback / IMA:
168+
* Decrease ad polling rate from every 100ms to every 200ms, to line up
169+
with Media Rating Council (MRC) recommendations.
170+
* FFmpeg extension:
171+
* Update CMake version to `3.21.0+` to avoid a CMake bug causing
172+
AndroidStudio's gradle sync to fail
173+
([#9933](https://github.com/google/ExoPlayer/issues/9933)).
174+
* Remove deprecated symbols:
175+
* Remove `Player.Listener.onTracksChanged`. Use
176+
`Player.Listener.onTracksInfoChanged` instead.
177+
* Remove `Player.getCurrentTrackGroups` and
178+
`Player.getCurrentTrackSelections`. Use `Player.getCurrentTracksInfo`
179+
instead. You can also continue to use `ExoPlayer.getCurrentTrackGroups`
180+
and `ExoPlayer.getCurrentTrackSelections`, although these methods remain
181+
deprecated.
182+
* Remove `DownloadHelper`
183+
`DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_VIEWPORT` and
184+
`DEFAULT_TRACK_SELECTOR_PARAMETERS` constants. Use
185+
`getDefaultTrackSelectorParameters(Context)` instead when possible, and
186+
`DEFAULT_TRACK_SELECTOR_PARAMETERS_WITHOUT_CONTEXT` otherwise.
187+
* Remove constructor `DefaultTrackSelector(ExoTrackSelection.Factory)`.
188+
Use `DefaultTrackSelector(Context, ExoTrackSelection.Factory)` instead.
189+
* Remove `Transformer.Builder.setContext`. The `Context` should be passed
190+
to the `Transformer.Builder` constructor instead.
191+
3192
### 2.17.1 (2022-03-10)
4193

5194
This release corresponds to the

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ buildscript {
1717
mavenCentral()
1818
}
1919
dependencies {
20-
classpath 'com.android.tools.build:gradle:7.0.3'
20+
classpath 'com.android.tools.build:gradle:7.2.1'
2121
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.2.2'
2222
}
2323
}

common_library_config.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,10 @@ android {
2929
targetCompatibility JavaVersion.VERSION_1_8
3030
}
3131

32-
testOptions.unitTests.includeAndroidResources = true
32+
testOptions {
33+
unitTests.all {
34+
jvmArgs "-Xmx2g"
35+
}
36+
unitTests.includeAndroidResources true
37+
}
3338
}

constants.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
// limitations under the License.
1414
project.ext {
1515
// ExoPlayer version and version code.
16-
releaseVersion = '2.17.1'
17-
releaseVersionCode = 2_017_001
16+
releaseVersion = '2.18.0'
17+
releaseVersionCode = 2_018_000
1818
minSdkVersion = 16
1919
appTargetSdkVersion = 29
2020
// Upgrading this requires [Internal ref: b/193254928] to be fixed, or some
2121
// additional robolectric config.
2222
targetSdkVersion = 30
23-
compileSdkVersion = 31
23+
compileSdkVersion = 32
2424
dexmakerVersion = '2.28.1'
2525
junitVersion = '4.13.2'
2626
// Use the same Guava version as the Android repo:
2727
// https://cs.android.com/android/platform/superproject/+/master:external/guava/METADATA
2828
guavaVersion = '31.0.1-android'
2929
mockitoVersion = '3.12.4'
30-
robolectricVersion = '4.6.1'
30+
robolectricVersion = '4.8.1'
3131
// Keep this in sync with Google's internal Checker Framework version.
3232
checkerframeworkVersion = '3.13.0'
3333
checkerframeworkCompatVersion = '2.5.5'

demos/cast/src/main/java/com/google/android/exoplayer2/castdemo/MainActivity.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ public RecyclerViewCallback() {
230230
@Override
231231
public boolean onMove(
232232
RecyclerView list, RecyclerView.ViewHolder origin, RecyclerView.ViewHolder target) {
233-
int fromPosition = origin.getAdapterPosition();
234-
int toPosition = target.getAdapterPosition();
233+
int fromPosition = origin.getBindingAdapterPosition();
234+
int toPosition = target.getBindingAdapterPosition();
235235
if (draggingFromPosition == C.INDEX_UNSET) {
236236
// A drag has started, but changes to the media queue will be reflected in clearView().
237237
draggingFromPosition = fromPosition;
@@ -243,7 +243,7 @@ public boolean onMove(
243243

244244
@Override
245245
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
246-
int position = viewHolder.getAdapterPosition();
246+
int position = viewHolder.getBindingAdapterPosition();
247247
QueueItemViewHolder queueItemHolder = (QueueItemViewHolder) viewHolder;
248248
if (playerManager.removeItem(queueItemHolder.item)) {
249249
mediaQueueListAdapter.notifyItemRemoved(position);
@@ -282,7 +282,7 @@ public QueueItemViewHolder(TextView textView) {
282282

283283
@Override
284284
public void onClick(View v) {
285-
playerManager.selectQueueItem(getAdapterPosition());
285+
playerManager.selectQueueItem(getBindingAdapterPosition());
286286
}
287287
}
288288

demos/cast/src/main/java/com/google/android/exoplayer2/castdemo/PlayerManager.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import com.google.android.exoplayer2.Player.DiscontinuityReason;
2626
import com.google.android.exoplayer2.Player.TimelineChangeReason;
2727
import com.google.android.exoplayer2.Timeline;
28-
import com.google.android.exoplayer2.TracksInfo;
28+
import com.google.android.exoplayer2.Tracks;
2929
import com.google.android.exoplayer2.ext.cast.CastPlayer;
3030
import com.google.android.exoplayer2.ext.cast.SessionAvailabilityListener;
3131
import com.google.android.exoplayer2.ui.StyledPlayerControlView;
@@ -57,7 +57,7 @@ interface Listener {
5757
private final ArrayList<MediaItem> mediaQueue;
5858
private final Listener listener;
5959

60-
private TracksInfo lastSeenTrackGroupInfo;
60+
private Tracks lastSeenTracks;
6161
private int currentItemIndex;
6262
private Player currentPlayer;
6363

@@ -219,19 +219,19 @@ public void onTimelineChanged(Timeline timeline, @TimelineChangeReason int reaso
219219
}
220220

221221
@Override
222-
public void onTracksInfoChanged(TracksInfo tracksInfo) {
223-
if (currentPlayer != localPlayer || tracksInfo == lastSeenTrackGroupInfo) {
222+
public void onTracksChanged(Tracks tracks) {
223+
if (currentPlayer != localPlayer || tracks == lastSeenTracks) {
224224
return;
225225
}
226-
if (!tracksInfo.isTypeSupportedOrEmpty(
227-
C.TRACK_TYPE_VIDEO, /* allowExceedsCapabilities= */ true)) {
226+
if (tracks.containsType(C.TRACK_TYPE_VIDEO)
227+
&& !tracks.isTypeSupported(C.TRACK_TYPE_VIDEO, /* allowExceedsCapabilities= */ true)) {
228228
listener.onUnsupportedTrack(C.TRACK_TYPE_VIDEO);
229229
}
230-
if (!tracksInfo.isTypeSupportedOrEmpty(
231-
C.TRACK_TYPE_AUDIO, /* allowExceedsCapabilities= */ true)) {
230+
if (tracks.containsType(C.TRACK_TYPE_AUDIO)
231+
&& !tracks.isTypeSupported(C.TRACK_TYPE_AUDIO, /* allowExceedsCapabilities= */ true)) {
232232
listener.onUnsupportedTrack(C.TRACK_TYPE_AUDIO);
233233
}
234-
lastSeenTrackGroupInfo = tracksInfo;
234+
lastSeenTracks = tracks;
235235
}
236236

237237
// CastPlayer.SessionAvailabilityListener implementation.

demos/gl/src/main/java/com/google/android/exoplayer2/gldemo/BitmapOverlayVideoProcessor.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import android.opengl.GLES20;
2828
import android.opengl.GLUtils;
2929
import com.google.android.exoplayer2.C;
30+
import com.google.android.exoplayer2.util.GlProgram;
3031
import com.google.android.exoplayer2.util.GlUtil;
3132
import java.io.IOException;
3233
import java.util.Locale;
@@ -50,7 +51,7 @@
5051
private final Bitmap logoBitmap;
5152
private final Canvas overlayCanvas;
5253

53-
private GlUtil.@MonotonicNonNull Program program;
54+
private @MonotonicNonNull GlProgram program;
5455

5556
private float bitmapScaleX;
5657
private float bitmapScaleY;
@@ -78,17 +79,21 @@ public BitmapOverlayVideoProcessor(Context context) {
7879
public void initialize() {
7980
try {
8081
program =
81-
new GlUtil.Program(
82+
new GlProgram(
8283
context,
8384
/* vertexShaderFilePath= */ "bitmap_overlay_video_processor_vertex.glsl",
8485
/* fragmentShaderFilePath= */ "bitmap_overlay_video_processor_fragment.glsl");
8586
} catch (IOException e) {
8687
throw new IllegalStateException(e);
8788
}
8889
program.setBufferAttribute(
89-
"aFramePosition", GlUtil.getNormalizedCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
90+
"aFramePosition",
91+
GlUtil.getNormalizedCoordinateBounds(),
92+
GlUtil.HOMOGENEOUS_COORDINATE_VECTOR_SIZE);
9093
program.setBufferAttribute(
91-
"aTexCoords", GlUtil.getTextureCoordinateBounds(), GlUtil.RECTANGLE_VERTICES_COUNT);
94+
"aTexCoords",
95+
GlUtil.getTextureCoordinateBounds(),
96+
GlUtil.HOMOGENEOUS_COORDINATE_VECTOR_SIZE);
9297
GLES20.glGenTextures(1, textures, 0);
9398
GLES20.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]);
9499
GLES20.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
@@ -117,9 +122,9 @@ public void draw(int frameTexture, long frameTimestampUs, float[] transformMatri
117122
GlUtil.checkGlError();
118123

119124
// Run the shader program.
120-
GlUtil.Program program = checkNotNull(this.program);
121-
program.setSamplerTexIdUniform("uTexSampler0", frameTexture, /* unit= */ 0);
122-
program.setSamplerTexIdUniform("uTexSampler1", textures[0], /* unit= */ 1);
125+
GlProgram program = checkNotNull(this.program);
126+
program.setSamplerTexIdUniform("uTexSampler0", frameTexture, /* texUnitIndex= */ 0);
127+
program.setSamplerTexIdUniform("uTexSampler1", textures[0], /* texUnitIndex= */ 1);
123128
program.setFloatUniform("uScaleX", bitmapScaleX);
124129
program.setFloatUniform("uScaleY", bitmapScaleY);
125130
program.setFloatsUniform("uTexTransform", transformMatrix);

0 commit comments

Comments
 (0)