Commit 2deb4356 by ibaker Committed by tonihei

Annotate methods that always return `this` with `@CanIgnoreReturnValue`

It's always safe to ignore the result of these methods, because the
caller already has a reference to the returned value.

PiperOrigin-RevId: 462388947
parent 649b70f9
Showing with 648 additions and 3 deletions
...@@ -25,6 +25,7 @@ import android.view.View; ...@@ -25,6 +25,7 @@ import android.view.View;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -77,6 +78,7 @@ public final class AdOverlayInfo { ...@@ -77,6 +78,7 @@ public final class AdOverlayInfo {
* *
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public Builder setDetailedReason(@Nullable String detailedReason) { public Builder setDetailedReason(@Nullable String detailedReason) {
this.detailedReason = detailedReason; this.detailedReason = detailedReason;
return this; return this;
......
...@@ -24,6 +24,7 @@ import androidx.annotation.Nullable; ...@@ -24,6 +24,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -94,30 +95,35 @@ public final class AudioAttributes implements Bundleable { ...@@ -94,30 +95,35 @@ public final class AudioAttributes implements Bundleable {
} }
/** See {@link android.media.AudioAttributes.Builder#setContentType(int)} */ /** See {@link android.media.AudioAttributes.Builder#setContentType(int)} */
@CanIgnoreReturnValue
public Builder setContentType(@C.AudioContentType int contentType) { public Builder setContentType(@C.AudioContentType int contentType) {
this.contentType = contentType; this.contentType = contentType;
return this; return this;
} }
/** See {@link android.media.AudioAttributes.Builder#setFlags(int)} */ /** See {@link android.media.AudioAttributes.Builder#setFlags(int)} */
@CanIgnoreReturnValue
public Builder setFlags(@C.AudioFlags int flags) { public Builder setFlags(@C.AudioFlags int flags) {
this.flags = flags; this.flags = flags;
return this; return this;
} }
/** See {@link android.media.AudioAttributes.Builder#setUsage(int)} */ /** See {@link android.media.AudioAttributes.Builder#setUsage(int)} */
@CanIgnoreReturnValue
public Builder setUsage(@C.AudioUsage int usage) { public Builder setUsage(@C.AudioUsage int usage) {
this.usage = usage; this.usage = usage;
return this; return this;
} }
/** See {@link android.media.AudioAttributes.Builder#setAllowedCapturePolicy(int)}. */ /** See {@link android.media.AudioAttributes.Builder#setAllowedCapturePolicy(int)}. */
@CanIgnoreReturnValue
public Builder setAllowedCapturePolicy(@C.AudioAllowedCapturePolicy int allowedCapturePolicy) { public Builder setAllowedCapturePolicy(@C.AudioAllowedCapturePolicy int allowedCapturePolicy) {
this.allowedCapturePolicy = allowedCapturePolicy; this.allowedCapturePolicy = allowedCapturePolicy;
return this; return this;
} }
/** See {@link android.media.AudioAttributes.Builder#setSpatializationBehavior(int)}. */ /** See {@link android.media.AudioAttributes.Builder#setSpatializationBehavior(int)}. */
@CanIgnoreReturnValue
public Builder setSpatializationBehavior(@C.SpatializationBehavior int spatializationBehavior) { public Builder setSpatializationBehavior(@C.SpatializationBehavior int spatializationBehavior) {
this.spatializationBehavior = spatializationBehavior; this.spatializationBehavior = spatializationBehavior;
return this; return this;
......
...@@ -22,6 +22,7 @@ import android.util.SparseBooleanArray; ...@@ -22,6 +22,7 @@ import android.util.SparseBooleanArray;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
/** /**
* A set of integer flags. * A set of integer flags.
...@@ -53,6 +54,7 @@ public final class FlagSet { ...@@ -53,6 +54,7 @@ public final class FlagSet {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder add(int flag) { public Builder add(int flag) {
checkState(!buildCalled); checkState(!buildCalled);
flags.append(flag, /* value= */ true); flags.append(flag, /* value= */ true);
...@@ -67,6 +69,7 @@ public final class FlagSet { ...@@ -67,6 +69,7 @@ public final class FlagSet {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder addIf(int flag, boolean condition) { public Builder addIf(int flag, boolean condition) {
if (condition) { if (condition) {
return add(flag); return add(flag);
...@@ -81,6 +84,7 @@ public final class FlagSet { ...@@ -81,6 +84,7 @@ public final class FlagSet {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder addAll(int... flags) { public Builder addAll(int... flags) {
for (int flag : flags) { for (int flag : flags) {
add(flag); add(flag);
...@@ -95,6 +99,7 @@ public final class FlagSet { ...@@ -95,6 +99,7 @@ public final class FlagSet {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder addAll(FlagSet flags) { public Builder addAll(FlagSet flags) {
for (int i = 0; i < flags.size(); i++) { for (int i = 0; i < flags.size(); i++) {
add(flags.get(i)); add(flags.get(i));
...@@ -109,6 +114,7 @@ public final class FlagSet { ...@@ -109,6 +114,7 @@ public final class FlagSet {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder remove(int flag) { public Builder remove(int flag) {
checkState(!buildCalled); checkState(!buildCalled);
flags.delete(flag); flags.delete(flag);
...@@ -123,6 +129,7 @@ public final class FlagSet { ...@@ -123,6 +129,7 @@ public final class FlagSet {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder removeIf(int flag, boolean condition) { public Builder removeIf(int flag, boolean condition) {
if (condition) { if (condition) {
return remove(flag); return remove(flag);
...@@ -137,6 +144,7 @@ public final class FlagSet { ...@@ -137,6 +144,7 @@ public final class FlagSet {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder removeAll(int... flags) { public Builder removeAll(int... flags) {
for (int flag : flags) { for (int flag : flags) {
remove(flag); remove(flag);
......
...@@ -29,6 +29,7 @@ import androidx.annotation.Nullable; ...@@ -29,6 +29,7 @@ import androidx.annotation.Nullable;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -114,30 +115,35 @@ public final class MediaMetadata implements Bundleable { ...@@ -114,30 +115,35 @@ public final class MediaMetadata implements Bundleable {
} }
/** Sets the title. */ /** Sets the title. */
@CanIgnoreReturnValue
public Builder setTitle(@Nullable CharSequence title) { public Builder setTitle(@Nullable CharSequence title) {
this.title = title; this.title = title;
return this; return this;
} }
/** Sets the artist. */ /** Sets the artist. */
@CanIgnoreReturnValue
public Builder setArtist(@Nullable CharSequence artist) { public Builder setArtist(@Nullable CharSequence artist) {
this.artist = artist; this.artist = artist;
return this; return this;
} }
/** Sets the album title. */ /** Sets the album title. */
@CanIgnoreReturnValue
public Builder setAlbumTitle(@Nullable CharSequence albumTitle) { public Builder setAlbumTitle(@Nullable CharSequence albumTitle) {
this.albumTitle = albumTitle; this.albumTitle = albumTitle;
return this; return this;
} }
/** Sets the album artist. */ /** Sets the album artist. */
@CanIgnoreReturnValue
public Builder setAlbumArtist(@Nullable CharSequence albumArtist) { public Builder setAlbumArtist(@Nullable CharSequence albumArtist) {
this.albumArtist = albumArtist; this.albumArtist = albumArtist;
return this; return this;
} }
/** Sets the display title. */ /** Sets the display title. */
@CanIgnoreReturnValue
public Builder setDisplayTitle(@Nullable CharSequence displayTitle) { public Builder setDisplayTitle(@Nullable CharSequence displayTitle) {
this.displayTitle = displayTitle; this.displayTitle = displayTitle;
return this; return this;
...@@ -148,24 +154,28 @@ public final class MediaMetadata implements Bundleable { ...@@ -148,24 +154,28 @@ public final class MediaMetadata implements Bundleable {
* *
* <p>This is the secondary title of the media, unrelated to closed captions. * <p>This is the secondary title of the media, unrelated to closed captions.
*/ */
@CanIgnoreReturnValue
public Builder setSubtitle(@Nullable CharSequence subtitle) { public Builder setSubtitle(@Nullable CharSequence subtitle) {
this.subtitle = subtitle; this.subtitle = subtitle;
return this; return this;
} }
/** Sets the description. */ /** Sets the description. */
@CanIgnoreReturnValue
public Builder setDescription(@Nullable CharSequence description) { public Builder setDescription(@Nullable CharSequence description) {
this.description = description; this.description = description;
return this; return this;
} }
/** Sets the user {@link Rating}. */ /** Sets the user {@link Rating}. */
@CanIgnoreReturnValue
public Builder setUserRating(@Nullable Rating userRating) { public Builder setUserRating(@Nullable Rating userRating) {
this.userRating = userRating; this.userRating = userRating;
return this; return this;
} }
/** Sets the overall {@link Rating}. */ /** Sets the overall {@link Rating}. */
@CanIgnoreReturnValue
public Builder setOverallRating(@Nullable Rating overallRating) { public Builder setOverallRating(@Nullable Rating overallRating) {
this.overallRating = overallRating; this.overallRating = overallRating;
return this; return this;
...@@ -175,6 +185,7 @@ public final class MediaMetadata implements Bundleable { ...@@ -175,6 +185,7 @@ public final class MediaMetadata implements Bundleable {
* @deprecated Use {@link #setArtworkData(byte[] data, Integer pictureType)} or {@link * @deprecated Use {@link #setArtworkData(byte[] data, Integer pictureType)} or {@link
* #maybeSetArtworkData(byte[] data, int pictureType)}, providing a {@link PictureType}. * #maybeSetArtworkData(byte[] data, int pictureType)}, providing a {@link PictureType}.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@Deprecated @Deprecated
public Builder setArtworkData(@Nullable byte[] artworkData) { public Builder setArtworkData(@Nullable byte[] artworkData) {
...@@ -185,6 +196,7 @@ public final class MediaMetadata implements Bundleable { ...@@ -185,6 +196,7 @@ public final class MediaMetadata implements Bundleable {
* Sets the artwork data as a compressed byte array with an associated {@link PictureType * Sets the artwork data as a compressed byte array with an associated {@link PictureType
* artworkDataType}. * artworkDataType}.
*/ */
@CanIgnoreReturnValue
public Builder setArtworkData( public Builder setArtworkData(
@Nullable byte[] artworkData, @Nullable @PictureType Integer artworkDataType) { @Nullable byte[] artworkData, @Nullable @PictureType Integer artworkDataType) {
this.artworkData = artworkData == null ? null : artworkData.clone(); this.artworkData = artworkData == null ? null : artworkData.clone();
...@@ -200,6 +212,7 @@ public final class MediaMetadata implements Bundleable { ...@@ -200,6 +212,7 @@ public final class MediaMetadata implements Bundleable {
* <p>Use {@link #setArtworkData(byte[], Integer)} to set the artwork data without checking the * <p>Use {@link #setArtworkData(byte[], Integer)} to set the artwork data without checking the
* {@link PictureType}. * {@link PictureType}.
*/ */
@CanIgnoreReturnValue
public Builder maybeSetArtworkData(byte[] artworkData, @PictureType int artworkDataType) { public Builder maybeSetArtworkData(byte[] artworkData, @PictureType int artworkDataType) {
if (this.artworkData == null if (this.artworkData == null
|| Util.areEqual(artworkDataType, PICTURE_TYPE_FRONT_COVER) || Util.areEqual(artworkDataType, PICTURE_TYPE_FRONT_COVER)
...@@ -211,30 +224,35 @@ public final class MediaMetadata implements Bundleable { ...@@ -211,30 +224,35 @@ public final class MediaMetadata implements Bundleable {
} }
/** Sets the artwork {@link Uri}. */ /** Sets the artwork {@link Uri}. */
@CanIgnoreReturnValue
public Builder setArtworkUri(@Nullable Uri artworkUri) { public Builder setArtworkUri(@Nullable Uri artworkUri) {
this.artworkUri = artworkUri; this.artworkUri = artworkUri;
return this; return this;
} }
/** Sets the track number. */ /** Sets the track number. */
@CanIgnoreReturnValue
public Builder setTrackNumber(@Nullable Integer trackNumber) { public Builder setTrackNumber(@Nullable Integer trackNumber) {
this.trackNumber = trackNumber; this.trackNumber = trackNumber;
return this; return this;
} }
/** Sets the total number of tracks. */ /** Sets the total number of tracks. */
@CanIgnoreReturnValue
public Builder setTotalTrackCount(@Nullable Integer totalTrackCount) { public Builder setTotalTrackCount(@Nullable Integer totalTrackCount) {
this.totalTrackCount = totalTrackCount; this.totalTrackCount = totalTrackCount;
return this; return this;
} }
/** Sets the {@link FolderType}. */ /** Sets the {@link FolderType}. */
@CanIgnoreReturnValue
public Builder setFolderType(@Nullable @FolderType Integer folderType) { public Builder setFolderType(@Nullable @FolderType Integer folderType) {
this.folderType = folderType; this.folderType = folderType;
return this; return this;
} }
/** Sets whether the media is playable. */ /** Sets whether the media is playable. */
@CanIgnoreReturnValue
public Builder setIsPlayable(@Nullable Boolean isPlayable) { public Builder setIsPlayable(@Nullable Boolean isPlayable) {
this.isPlayable = isPlayable; this.isPlayable = isPlayable;
return this; return this;
...@@ -243,6 +261,7 @@ public final class MediaMetadata implements Bundleable { ...@@ -243,6 +261,7 @@ public final class MediaMetadata implements Bundleable {
/** /**
* @deprecated Use {@link #setRecordingYear(Integer)} instead. * @deprecated Use {@link #setRecordingYear(Integer)} instead.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@Deprecated @Deprecated
public Builder setYear(@Nullable Integer year) { public Builder setYear(@Nullable Integer year) {
...@@ -250,6 +269,7 @@ public final class MediaMetadata implements Bundleable { ...@@ -250,6 +269,7 @@ public final class MediaMetadata implements Bundleable {
} }
/** Sets the year of the recording date. */ /** Sets the year of the recording date. */
@CanIgnoreReturnValue
public Builder setRecordingYear(@Nullable Integer recordingYear) { public Builder setRecordingYear(@Nullable Integer recordingYear) {
this.recordingYear = recordingYear; this.recordingYear = recordingYear;
return this; return this;
...@@ -260,6 +280,7 @@ public final class MediaMetadata implements Bundleable { ...@@ -260,6 +280,7 @@ public final class MediaMetadata implements Bundleable {
* *
* <p>Value should be between 1 and 12. * <p>Value should be between 1 and 12.
*/ */
@CanIgnoreReturnValue
public Builder setRecordingMonth( public Builder setRecordingMonth(
@Nullable @IntRange(from = 1, to = 12) Integer recordingMonth) { @Nullable @IntRange(from = 1, to = 12) Integer recordingMonth) {
this.recordingMonth = recordingMonth; this.recordingMonth = recordingMonth;
...@@ -271,12 +292,14 @@ public final class MediaMetadata implements Bundleable { ...@@ -271,12 +292,14 @@ public final class MediaMetadata implements Bundleable {
* *
* <p>Value should be between 1 and 31. * <p>Value should be between 1 and 31.
*/ */
@CanIgnoreReturnValue
public Builder setRecordingDay(@Nullable @IntRange(from = 1, to = 31) Integer recordingDay) { public Builder setRecordingDay(@Nullable @IntRange(from = 1, to = 31) Integer recordingDay) {
this.recordingDay = recordingDay; this.recordingDay = recordingDay;
return this; return this;
} }
/** Sets the year of the release date. */ /** Sets the year of the release date. */
@CanIgnoreReturnValue
public Builder setReleaseYear(@Nullable Integer releaseYear) { public Builder setReleaseYear(@Nullable Integer releaseYear) {
this.releaseYear = releaseYear; this.releaseYear = releaseYear;
return this; return this;
...@@ -287,6 +310,7 @@ public final class MediaMetadata implements Bundleable { ...@@ -287,6 +310,7 @@ public final class MediaMetadata implements Bundleable {
* *
* <p>Value should be between 1 and 12. * <p>Value should be between 1 and 12.
*/ */
@CanIgnoreReturnValue
public Builder setReleaseMonth(@Nullable @IntRange(from = 1, to = 12) Integer releaseMonth) { public Builder setReleaseMonth(@Nullable @IntRange(from = 1, to = 12) Integer releaseMonth) {
this.releaseMonth = releaseMonth; this.releaseMonth = releaseMonth;
return this; return this;
...@@ -297,60 +321,70 @@ public final class MediaMetadata implements Bundleable { ...@@ -297,60 +321,70 @@ public final class MediaMetadata implements Bundleable {
* *
* <p>Value should be between 1 and 31. * <p>Value should be between 1 and 31.
*/ */
@CanIgnoreReturnValue
public Builder setReleaseDay(@Nullable @IntRange(from = 1, to = 31) Integer releaseDay) { public Builder setReleaseDay(@Nullable @IntRange(from = 1, to = 31) Integer releaseDay) {
this.releaseDay = releaseDay; this.releaseDay = releaseDay;
return this; return this;
} }
/** Sets the writer. */ /** Sets the writer. */
@CanIgnoreReturnValue
public Builder setWriter(@Nullable CharSequence writer) { public Builder setWriter(@Nullable CharSequence writer) {
this.writer = writer; this.writer = writer;
return this; return this;
} }
/** Sets the composer. */ /** Sets the composer. */
@CanIgnoreReturnValue
public Builder setComposer(@Nullable CharSequence composer) { public Builder setComposer(@Nullable CharSequence composer) {
this.composer = composer; this.composer = composer;
return this; return this;
} }
/** Sets the conductor. */ /** Sets the conductor. */
@CanIgnoreReturnValue
public Builder setConductor(@Nullable CharSequence conductor) { public Builder setConductor(@Nullable CharSequence conductor) {
this.conductor = conductor; this.conductor = conductor;
return this; return this;
} }
/** Sets the disc number. */ /** Sets the disc number. */
@CanIgnoreReturnValue
public Builder setDiscNumber(@Nullable Integer discNumber) { public Builder setDiscNumber(@Nullable Integer discNumber) {
this.discNumber = discNumber; this.discNumber = discNumber;
return this; return this;
} }
/** Sets the total number of discs. */ /** Sets the total number of discs. */
@CanIgnoreReturnValue
public Builder setTotalDiscCount(@Nullable Integer totalDiscCount) { public Builder setTotalDiscCount(@Nullable Integer totalDiscCount) {
this.totalDiscCount = totalDiscCount; this.totalDiscCount = totalDiscCount;
return this; return this;
} }
/** Sets the genre. */ /** Sets the genre. */
@CanIgnoreReturnValue
public Builder setGenre(@Nullable CharSequence genre) { public Builder setGenre(@Nullable CharSequence genre) {
this.genre = genre; this.genre = genre;
return this; return this;
} }
/** Sets the compilation. */ /** Sets the compilation. */
@CanIgnoreReturnValue
public Builder setCompilation(@Nullable CharSequence compilation) { public Builder setCompilation(@Nullable CharSequence compilation) {
this.compilation = compilation; this.compilation = compilation;
return this; return this;
} }
/** Sets the name of the station streaming the media. */ /** Sets the name of the station streaming the media. */
@CanIgnoreReturnValue
public Builder setStation(@Nullable CharSequence station) { public Builder setStation(@Nullable CharSequence station) {
this.station = station; this.station = station;
return this; return this;
} }
/** Sets the extras {@link Bundle}. */ /** Sets the extras {@link Bundle}. */
@CanIgnoreReturnValue
public Builder setExtras(@Nullable Bundle extras) { public Builder setExtras(@Nullable Bundle extras) {
this.extras = extras; this.extras = extras;
return this; return this;
...@@ -365,6 +399,7 @@ public final class MediaMetadata implements Bundleable { ...@@ -365,6 +399,7 @@ public final class MediaMetadata implements Bundleable {
* <p>In the event that multiple {@link Metadata.Entry} objects within the {@link Metadata} * <p>In the event that multiple {@link Metadata.Entry} objects within the {@link Metadata}
* relate to the same {@link MediaMetadata} field, then the last one will be used. * relate to the same {@link MediaMetadata} field, then the last one will be used.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder populateFromMetadata(Metadata metadata) { public Builder populateFromMetadata(Metadata metadata) {
for (int i = 0; i < metadata.length(); i++) { for (int i = 0; i < metadata.length(); i++) {
...@@ -384,6 +419,7 @@ public final class MediaMetadata implements Bundleable { ...@@ -384,6 +419,7 @@ public final class MediaMetadata implements Bundleable {
* <p>In the event that multiple {@link Metadata.Entry} objects within any of the {@link * <p>In the event that multiple {@link Metadata.Entry} objects within any of the {@link
* Metadata} relate to the same {@link MediaMetadata} field, then the last one will be used. * Metadata} relate to the same {@link MediaMetadata} field, then the last one will be used.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder populateFromMetadata(List<Metadata> metadataList) { public Builder populateFromMetadata(List<Metadata> metadataList) {
for (int i = 0; i < metadataList.size(); i++) { for (int i = 0; i < metadataList.size(); i++) {
...@@ -397,6 +433,7 @@ public final class MediaMetadata implements Bundleable { ...@@ -397,6 +433,7 @@ public final class MediaMetadata implements Bundleable {
} }
/** Populates all the fields from {@code mediaMetadata}, provided they are non-null. */ /** Populates all the fields from {@code mediaMetadata}, provided they are non-null. */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder populate(@Nullable MediaMetadata mediaMetadata) { public Builder populate(@Nullable MediaMetadata mediaMetadata) {
if (mediaMetadata == null) { if (mediaMetadata == null) {
......
...@@ -36,6 +36,7 @@ import androidx.media3.common.text.CueGroup; ...@@ -36,6 +36,7 @@ import androidx.media3.common.text.CueGroup;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -406,6 +407,7 @@ public interface Player { ...@@ -406,6 +407,7 @@ public interface Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder add(@Command int command) { public Builder add(@Command int command) {
flagsBuilder.add(command); flagsBuilder.add(command);
return this; return this;
...@@ -419,6 +421,7 @@ public interface Player { ...@@ -419,6 +421,7 @@ public interface Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder addIf(@Command int command, boolean condition) { public Builder addIf(@Command int command, boolean condition) {
flagsBuilder.addIf(command, condition); flagsBuilder.addIf(command, condition);
return this; return this;
...@@ -431,6 +434,7 @@ public interface Player { ...@@ -431,6 +434,7 @@ public interface Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder addAll(@Command int... commands) { public Builder addAll(@Command int... commands) {
flagsBuilder.addAll(commands); flagsBuilder.addAll(commands);
return this; return this;
...@@ -443,6 +447,7 @@ public interface Player { ...@@ -443,6 +447,7 @@ public interface Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder addAll(Commands commands) { public Builder addAll(Commands commands) {
flagsBuilder.addAll(commands.flags); flagsBuilder.addAll(commands.flags);
return this; return this;
...@@ -454,6 +459,7 @@ public interface Player { ...@@ -454,6 +459,7 @@ public interface Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder addAllCommands() { public Builder addAllCommands() {
flagsBuilder.addAll(SUPPORTED_COMMANDS); flagsBuilder.addAll(SUPPORTED_COMMANDS);
return this; return this;
...@@ -466,6 +472,7 @@ public interface Player { ...@@ -466,6 +472,7 @@ public interface Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder remove(@Command int command) { public Builder remove(@Command int command) {
flagsBuilder.remove(command); flagsBuilder.remove(command);
return this; return this;
...@@ -479,6 +486,7 @@ public interface Player { ...@@ -479,6 +486,7 @@ public interface Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder removeIf(@Command int command, boolean condition) { public Builder removeIf(@Command int command, boolean condition) {
flagsBuilder.removeIf(command, condition); flagsBuilder.removeIf(command, condition);
return this; return this;
...@@ -491,6 +499,7 @@ public interface Player { ...@@ -491,6 +499,7 @@ public interface Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder removeAll(@Command int... commands) { public Builder removeAll(@Command int... commands) {
flagsBuilder.removeAll(commands); flagsBuilder.removeAll(commands);
return this; return this;
......
...@@ -34,6 +34,7 @@ import androidx.media3.common.util.BundleUtil; ...@@ -34,6 +34,7 @@ import androidx.media3.common.util.BundleUtil;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.InlineMe; import com.google.errorprone.annotations.InlineMe;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
...@@ -261,6 +262,7 @@ public abstract class Timeline implements Bundleable { ...@@ -261,6 +262,7 @@ public abstract class Timeline implements Bundleable {
} }
/** Sets the data held by this window. */ /** Sets the data held by this window. */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public Window set( public Window set(
...@@ -626,6 +628,7 @@ public abstract class Timeline implements Bundleable { ...@@ -626,6 +628,7 @@ public abstract class Timeline implements Bundleable {
* period is not within the window. * period is not within the window.
* @return This period, for convenience. * @return This period, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Period set( public Period set(
@Nullable Object id, @Nullable Object id,
...@@ -662,6 +665,7 @@ public abstract class Timeline implements Bundleable { ...@@ -662,6 +665,7 @@ public abstract class Timeline implements Bundleable {
* information has yet to be loaded. * information has yet to be loaded.
* @return This period, for convenience. * @return This period, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Period set( public Period set(
@Nullable Object id, @Nullable Object id,
......
...@@ -36,6 +36,7 @@ import androidx.media3.common.Bundleable; ...@@ -36,6 +36,7 @@ import androidx.media3.common.Bundleable;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -628,6 +629,7 @@ public final class Cue implements Bundleable { ...@@ -628,6 +629,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#text * @see Cue#text
*/ */
@CanIgnoreReturnValue
public Builder setText(CharSequence text) { public Builder setText(CharSequence text) {
this.text = text; this.text = text;
return this; return this;
...@@ -649,6 +651,7 @@ public final class Cue implements Bundleable { ...@@ -649,6 +651,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#bitmap * @see Cue#bitmap
*/ */
@CanIgnoreReturnValue
public Builder setBitmap(Bitmap bitmap) { public Builder setBitmap(Bitmap bitmap) {
this.bitmap = bitmap; this.bitmap = bitmap;
return this; return this;
...@@ -672,6 +675,7 @@ public final class Cue implements Bundleable { ...@@ -672,6 +675,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#textAlignment * @see Cue#textAlignment
*/ */
@CanIgnoreReturnValue
public Builder setTextAlignment(@Nullable Layout.Alignment textAlignment) { public Builder setTextAlignment(@Nullable Layout.Alignment textAlignment) {
this.textAlignment = textAlignment; this.textAlignment = textAlignment;
return this; return this;
...@@ -695,6 +699,7 @@ public final class Cue implements Bundleable { ...@@ -695,6 +699,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#multiRowAlignment * @see Cue#multiRowAlignment
*/ */
@CanIgnoreReturnValue
public Builder setMultiRowAlignment(@Nullable Layout.Alignment multiRowAlignment) { public Builder setMultiRowAlignment(@Nullable Layout.Alignment multiRowAlignment) {
this.multiRowAlignment = multiRowAlignment; this.multiRowAlignment = multiRowAlignment;
return this; return this;
...@@ -707,6 +712,7 @@ public final class Cue implements Bundleable { ...@@ -707,6 +712,7 @@ public final class Cue implements Bundleable {
* @see Cue#line * @see Cue#line
* @see Cue#lineType * @see Cue#lineType
*/ */
@CanIgnoreReturnValue
public Builder setLine(float line, @LineType int lineType) { public Builder setLine(float line, @LineType int lineType) {
this.line = line; this.line = line;
this.lineType = lineType; this.lineType = lineType;
...@@ -739,6 +745,7 @@ public final class Cue implements Bundleable { ...@@ -739,6 +745,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#lineAnchor * @see Cue#lineAnchor
*/ */
@CanIgnoreReturnValue
public Builder setLineAnchor(@AnchorType int lineAnchor) { public Builder setLineAnchor(@AnchorType int lineAnchor) {
this.lineAnchor = lineAnchor; this.lineAnchor = lineAnchor;
return this; return this;
...@@ -760,6 +767,7 @@ public final class Cue implements Bundleable { ...@@ -760,6 +767,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#position * @see Cue#position
*/ */
@CanIgnoreReturnValue
public Builder setPosition(float position) { public Builder setPosition(float position) {
this.position = position; this.position = position;
return this; return this;
...@@ -781,6 +789,7 @@ public final class Cue implements Bundleable { ...@@ -781,6 +789,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#positionAnchor * @see Cue#positionAnchor
*/ */
@CanIgnoreReturnValue
public Builder setPositionAnchor(@AnchorType int positionAnchor) { public Builder setPositionAnchor(@AnchorType int positionAnchor) {
this.positionAnchor = positionAnchor; this.positionAnchor = positionAnchor;
return this; return this;
...@@ -802,6 +811,7 @@ public final class Cue implements Bundleable { ...@@ -802,6 +811,7 @@ public final class Cue implements Bundleable {
* @see Cue#textSize * @see Cue#textSize
* @see Cue#textSizeType * @see Cue#textSizeType
*/ */
@CanIgnoreReturnValue
public Builder setTextSize(float textSize, @TextSizeType int textSizeType) { public Builder setTextSize(float textSize, @TextSizeType int textSizeType) {
this.textSize = textSize; this.textSize = textSize;
this.textSizeType = textSizeType; this.textSizeType = textSizeType;
...@@ -834,6 +844,7 @@ public final class Cue implements Bundleable { ...@@ -834,6 +844,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#size * @see Cue#size
*/ */
@CanIgnoreReturnValue
public Builder setSize(float size) { public Builder setSize(float size) {
this.size = size; this.size = size;
return this; return this;
...@@ -855,6 +866,7 @@ public final class Cue implements Bundleable { ...@@ -855,6 +866,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#bitmapHeight * @see Cue#bitmapHeight
*/ */
@CanIgnoreReturnValue
public Builder setBitmapHeight(float bitmapHeight) { public Builder setBitmapHeight(float bitmapHeight) {
this.bitmapHeight = bitmapHeight; this.bitmapHeight = bitmapHeight;
return this; return this;
...@@ -878,6 +890,7 @@ public final class Cue implements Bundleable { ...@@ -878,6 +890,7 @@ public final class Cue implements Bundleable {
* @see Cue#windowColor * @see Cue#windowColor
* @see Cue#windowColorSet * @see Cue#windowColorSet
*/ */
@CanIgnoreReturnValue
public Builder setWindowColor(@ColorInt int windowColor) { public Builder setWindowColor(@ColorInt int windowColor) {
this.windowColor = windowColor; this.windowColor = windowColor;
this.windowColorSet = true; this.windowColorSet = true;
...@@ -885,6 +898,7 @@ public final class Cue implements Bundleable { ...@@ -885,6 +898,7 @@ public final class Cue implements Bundleable {
} }
/** Sets {@link Cue#windowColorSet} to false. */ /** Sets {@link Cue#windowColorSet} to false. */
@CanIgnoreReturnValue
public Builder clearWindowColor() { public Builder clearWindowColor() {
this.windowColorSet = false; this.windowColorSet = false;
return this; return this;
...@@ -915,12 +929,14 @@ public final class Cue implements Bundleable { ...@@ -915,12 +929,14 @@ public final class Cue implements Bundleable {
* *
* @see Cue#verticalType * @see Cue#verticalType
*/ */
@CanIgnoreReturnValue
public Builder setVerticalType(@VerticalType int verticalType) { public Builder setVerticalType(@VerticalType int verticalType) {
this.verticalType = verticalType; this.verticalType = verticalType;
return this; return this;
} }
/** Sets the shear angle for this Cue. */ /** Sets the shear angle for this Cue. */
@CanIgnoreReturnValue
public Builder setShearDegrees(float shearDegrees) { public Builder setShearDegrees(float shearDegrees) {
this.shearDegrees = shearDegrees; this.shearDegrees = shearDegrees;
return this; return this;
......
...@@ -21,6 +21,7 @@ import android.os.Handler; ...@@ -21,6 +21,7 @@ import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import androidx.annotation.GuardedBy; import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -136,6 +137,7 @@ import java.util.List; ...@@ -136,6 +137,7 @@ import java.util.List;
@Nullable private android.os.Message message; @Nullable private android.os.Message message;
@Nullable private SystemHandlerWrapper handler; @Nullable private SystemHandlerWrapper handler;
@CanIgnoreReturnValue
public SystemMessage setMessage(android.os.Message message, SystemHandlerWrapper handler) { public SystemMessage setMessage(android.os.Message message, SystemHandlerWrapper handler) {
this.message = message; this.message = message;
this.handler = handler; this.handler = handler;
......
...@@ -24,6 +24,7 @@ import androidx.media3.common.C; ...@@ -24,6 +24,7 @@ import androidx.media3.common.C;
import androidx.media3.common.MediaLibraryInfo; import androidx.media3.common.MediaLibraryInfo;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -89,6 +90,7 @@ public final class DataSpec { ...@@ -89,6 +90,7 @@ public final class DataSpec {
* @param uriString The {@link DataSpec#uri}. * @param uriString The {@link DataSpec#uri}.
* @return The builder. * @return The builder.
*/ */
@CanIgnoreReturnValue
public Builder setUri(String uriString) { public Builder setUri(String uriString) {
this.uri = Uri.parse(uriString); this.uri = Uri.parse(uriString);
return this; return this;
...@@ -100,6 +102,7 @@ public final class DataSpec { ...@@ -100,6 +102,7 @@ public final class DataSpec {
* @param uri The {@link DataSpec#uri}. * @param uri The {@link DataSpec#uri}.
* @return The builder. * @return The builder.
*/ */
@CanIgnoreReturnValue
public Builder setUri(Uri uri) { public Builder setUri(Uri uri) {
this.uri = uri; this.uri = uri;
return this; return this;
...@@ -111,6 +114,7 @@ public final class DataSpec { ...@@ -111,6 +114,7 @@ public final class DataSpec {
* @param uriPositionOffset The {@link DataSpec#uriPositionOffset}. * @param uriPositionOffset The {@link DataSpec#uriPositionOffset}.
* @return The builder. * @return The builder.
*/ */
@CanIgnoreReturnValue
public Builder setUriPositionOffset(long uriPositionOffset) { public Builder setUriPositionOffset(long uriPositionOffset) {
this.uriPositionOffset = uriPositionOffset; this.uriPositionOffset = uriPositionOffset;
return this; return this;
...@@ -122,6 +126,7 @@ public final class DataSpec { ...@@ -122,6 +126,7 @@ public final class DataSpec {
* @param httpMethod The {@link DataSpec#httpMethod}. * @param httpMethod The {@link DataSpec#httpMethod}.
* @return The builder. * @return The builder.
*/ */
@CanIgnoreReturnValue
public Builder setHttpMethod(@HttpMethod int httpMethod) { public Builder setHttpMethod(@HttpMethod int httpMethod) {
this.httpMethod = httpMethod; this.httpMethod = httpMethod;
return this; return this;
...@@ -133,6 +138,7 @@ public final class DataSpec { ...@@ -133,6 +138,7 @@ public final class DataSpec {
* @param httpBody The {@link DataSpec#httpBody}. * @param httpBody The {@link DataSpec#httpBody}.
* @return The builder. * @return The builder.
*/ */
@CanIgnoreReturnValue
public Builder setHttpBody(@Nullable byte[] httpBody) { public Builder setHttpBody(@Nullable byte[] httpBody) {
this.httpBody = httpBody; this.httpBody = httpBody;
return this; return this;
...@@ -148,6 +154,7 @@ public final class DataSpec { ...@@ -148,6 +154,7 @@ public final class DataSpec {
* @param httpRequestHeaders The {@link DataSpec#httpRequestHeaders}. * @param httpRequestHeaders The {@link DataSpec#httpRequestHeaders}.
* @return The builder. * @return The builder.
*/ */
@CanIgnoreReturnValue
public Builder setHttpRequestHeaders(Map<String, String> httpRequestHeaders) { public Builder setHttpRequestHeaders(Map<String, String> httpRequestHeaders) {
this.httpRequestHeaders = httpRequestHeaders; this.httpRequestHeaders = httpRequestHeaders;
return this; return this;
...@@ -159,6 +166,7 @@ public final class DataSpec { ...@@ -159,6 +166,7 @@ public final class DataSpec {
* @param position The {@link DataSpec#position}. * @param position The {@link DataSpec#position}.
* @return The builder. * @return The builder.
*/ */
@CanIgnoreReturnValue
public Builder setPosition(long position) { public Builder setPosition(long position) {
this.position = position; this.position = position;
return this; return this;
...@@ -170,6 +178,7 @@ public final class DataSpec { ...@@ -170,6 +178,7 @@ public final class DataSpec {
* @param length The {@link DataSpec#length}. * @param length The {@link DataSpec#length}.
* @return The builder. * @return The builder.
*/ */
@CanIgnoreReturnValue
public Builder setLength(long length) { public Builder setLength(long length) {
this.length = length; this.length = length;
return this; return this;
...@@ -181,6 +190,7 @@ public final class DataSpec { ...@@ -181,6 +190,7 @@ public final class DataSpec {
* @param key The {@link DataSpec#key}. * @param key The {@link DataSpec#key}.
* @return The builder. * @return The builder.
*/ */
@CanIgnoreReturnValue
public Builder setKey(@Nullable String key) { public Builder setKey(@Nullable String key) {
this.key = key; this.key = key;
return this; return this;
...@@ -192,6 +202,7 @@ public final class DataSpec { ...@@ -192,6 +202,7 @@ public final class DataSpec {
* @param flags The {@link DataSpec#flags}. * @param flags The {@link DataSpec#flags}.
* @return The builder. * @return The builder.
*/ */
@CanIgnoreReturnValue
public Builder setFlags(@Flags int flags) { public Builder setFlags(@Flags int flags) {
this.flags = flags; this.flags = flags;
return this; return this;
...@@ -203,6 +214,7 @@ public final class DataSpec { ...@@ -203,6 +214,7 @@ public final class DataSpec {
* @param customData The {@link DataSpec#customData}. * @param customData The {@link DataSpec#customData}.
* @return The builder. * @return The builder.
*/ */
@CanIgnoreReturnValue
public Builder setCustomData(@Nullable Object customData) { public Builder setCustomData(@Nullable Object customData) {
this.customData = customData; this.customData = customData;
return this; return this;
......
...@@ -23,6 +23,7 @@ import androidx.media3.common.util.Assertions; ...@@ -23,6 +23,7 @@ import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.Log; import androidx.media3.common.util.Log;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
...@@ -99,6 +100,7 @@ public final class DefaultDataSource implements DataSource { ...@@ -99,6 +100,7 @@ public final class DefaultDataSource implements DataSource {
* @param transferListener The listener that will be used. * @param transferListener The listener that will be used.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setTransferListener(@Nullable TransferListener transferListener) { public Factory setTransferListener(@Nullable TransferListener transferListener) {
this.transferListener = transferListener; this.transferListener = transferListener;
......
...@@ -34,6 +34,7 @@ import com.google.common.collect.ForwardingMap; ...@@ -34,6 +34,7 @@ import com.google.common.collect.ForwardingMap;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.common.net.HttpHeaders; import com.google.common.net.HttpHeaders;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
...@@ -82,6 +83,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou ...@@ -82,6 +83,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
readTimeoutMs = DEFAULT_READ_TIMEOUT_MILLIS; readTimeoutMs = DEFAULT_READ_TIMEOUT_MILLIS;
} }
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@Override @Override
public final Factory setDefaultRequestProperties(Map<String, String> defaultRequestProperties) { public final Factory setDefaultRequestProperties(Map<String, String> defaultRequestProperties) {
...@@ -99,6 +101,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou ...@@ -99,6 +101,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
* agent of the underlying platform. * agent of the underlying platform.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setUserAgent(@Nullable String userAgent) { public Factory setUserAgent(@Nullable String userAgent) {
this.userAgent = userAgent; this.userAgent = userAgent;
...@@ -113,6 +116,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou ...@@ -113,6 +116,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
* @param connectTimeoutMs The connect timeout, in milliseconds, that will be used. * @param connectTimeoutMs The connect timeout, in milliseconds, that will be used.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setConnectTimeoutMs(int connectTimeoutMs) { public Factory setConnectTimeoutMs(int connectTimeoutMs) {
this.connectTimeoutMs = connectTimeoutMs; this.connectTimeoutMs = connectTimeoutMs;
...@@ -127,6 +131,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou ...@@ -127,6 +131,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
* @param readTimeoutMs The connect timeout, in milliseconds, that will be used. * @param readTimeoutMs The connect timeout, in milliseconds, that will be used.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setReadTimeoutMs(int readTimeoutMs) { public Factory setReadTimeoutMs(int readTimeoutMs) {
this.readTimeoutMs = readTimeoutMs; this.readTimeoutMs = readTimeoutMs;
...@@ -141,6 +146,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou ...@@ -141,6 +146,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
* @param allowCrossProtocolRedirects Whether to allow cross protocol redirects. * @param allowCrossProtocolRedirects Whether to allow cross protocol redirects.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setAllowCrossProtocolRedirects(boolean allowCrossProtocolRedirects) { public Factory setAllowCrossProtocolRedirects(boolean allowCrossProtocolRedirects) {
this.allowCrossProtocolRedirects = allowCrossProtocolRedirects; this.allowCrossProtocolRedirects = allowCrossProtocolRedirects;
...@@ -158,6 +164,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou ...@@ -158,6 +164,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
* predicate that was previously set. * predicate that was previously set.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setContentTypePredicate(@Nullable Predicate<String> contentTypePredicate) { public Factory setContentTypePredicate(@Nullable Predicate<String> contentTypePredicate) {
this.contentTypePredicate = contentTypePredicate; this.contentTypePredicate = contentTypePredicate;
...@@ -174,6 +181,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou ...@@ -174,6 +181,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
* @param transferListener The listener that will be used. * @param transferListener The listener that will be used.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setTransferListener(@Nullable TransferListener transferListener) { public Factory setTransferListener(@Nullable TransferListener transferListener) {
this.transferListener = transferListener; this.transferListener = transferListener;
...@@ -184,6 +192,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou ...@@ -184,6 +192,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
* Sets whether we should keep the POST method and body when we have HTTP 302 redirects for a * Sets whether we should keep the POST method and body when we have HTTP 302 redirects for a
* POST request. * POST request.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setKeepPostFor302Redirects(boolean keepPostFor302Redirects) { public Factory setKeepPostFor302Redirects(boolean keepPostFor302Redirects) {
this.keepPostFor302Redirects = keepPostFor302Redirects; this.keepPostFor302Redirects = keepPostFor302Redirects;
......
...@@ -30,6 +30,7 @@ import androidx.media3.common.PlaybackException; ...@@ -30,6 +30,7 @@ import androidx.media3.common.PlaybackException;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
...@@ -82,6 +83,7 @@ public final class FileDataSource extends BaseDataSource { ...@@ -82,6 +83,7 @@ public final class FileDataSource extends BaseDataSource {
* @param listener The {@link TransferListener}. * @param listener The {@link TransferListener}.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setListener(@Nullable TransferListener listener) { public Factory setListener(@Nullable TransferListener listener) {
this.listener = listener; this.listener = listener;
return this; return this;
......
...@@ -25,6 +25,7 @@ import androidx.media3.common.util.UnstableApi; ...@@ -25,6 +25,7 @@ import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.common.base.Ascii; import com.google.common.base.Ascii;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
...@@ -157,6 +158,7 @@ public interface HttpDataSource extends DataSource { ...@@ -157,6 +158,7 @@ public interface HttpDataSource extends DataSource {
return createDataSourceInternal(defaultRequestProperties); return createDataSourceInternal(defaultRequestProperties);
} }
@CanIgnoreReturnValue
@Override @Override
public final Factory setDefaultRequestProperties(Map<String, String> defaultRequestProperties) { public final Factory setDefaultRequestProperties(Map<String, String> defaultRequestProperties) {
this.defaultRequestProperties.clearAndSet(defaultRequestProperties); this.defaultRequestProperties.clearAndSet(defaultRequestProperties);
......
...@@ -28,6 +28,7 @@ import androidx.media3.common.util.Util; ...@@ -28,6 +28,7 @@ import androidx.media3.common.util.Util;
import androidx.media3.datasource.DataSink; import androidx.media3.datasource.DataSink;
import androidx.media3.datasource.DataSpec; import androidx.media3.datasource.DataSpec;
import androidx.media3.datasource.cache.Cache.CacheException; import androidx.media3.datasource.cache.Cache.CacheException;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
...@@ -65,6 +66,7 @@ public final class CacheDataSink implements DataSink { ...@@ -65,6 +66,7 @@ public final class CacheDataSink implements DataSink {
* @param cache The cache to which data will be written. * @param cache The cache to which data will be written.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setCache(Cache cache) { public Factory setCache(Cache cache) {
this.cache = cache; this.cache = cache;
return this; return this;
...@@ -83,6 +85,7 @@ public final class CacheDataSink implements DataSink { ...@@ -83,6 +85,7 @@ public final class CacheDataSink implements DataSink {
* fragmentation. * fragmentation.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setFragmentSize(long fragmentSize) { public Factory setFragmentSize(long fragmentSize) {
this.fragmentSize = fragmentSize; this.fragmentSize = fragmentSize;
return this; return this;
...@@ -97,6 +100,7 @@ public final class CacheDataSink implements DataSink { ...@@ -97,6 +100,7 @@ public final class CacheDataSink implements DataSink {
* @param bufferSize The buffer size in bytes. * @param bufferSize The buffer size in bytes.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setBufferSize(int bufferSize) { public Factory setBufferSize(int bufferSize) {
this.bufferSize = bufferSize; this.bufferSize = bufferSize;
return this; return this;
......
...@@ -42,6 +42,7 @@ import androidx.media3.datasource.PriorityDataSource; ...@@ -42,6 +42,7 @@ import androidx.media3.datasource.PriorityDataSource;
import androidx.media3.datasource.TeeDataSource; import androidx.media3.datasource.TeeDataSource;
import androidx.media3.datasource.TransferListener; import androidx.media3.datasource.TransferListener;
import androidx.media3.datasource.cache.Cache.CacheException; import androidx.media3.datasource.cache.Cache.CacheException;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
...@@ -88,6 +89,7 @@ public final class CacheDataSource implements DataSource { ...@@ -88,6 +89,7 @@ public final class CacheDataSource implements DataSource {
* @param cache The cache that will be used. * @param cache The cache that will be used.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setCache(Cache cache) { public Factory setCache(Cache cache) {
this.cache = cache; this.cache = cache;
return this; return this;
...@@ -111,6 +113,7 @@ public final class CacheDataSource implements DataSource { ...@@ -111,6 +113,7 @@ public final class CacheDataSource implements DataSource {
* @param cacheReadDataSourceFactory The {@link DataSource.Factory} for reading from the cache. * @param cacheReadDataSourceFactory The {@link DataSource.Factory} for reading from the cache.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setCacheReadDataSourceFactory(DataSource.Factory cacheReadDataSourceFactory) { public Factory setCacheReadDataSourceFactory(DataSource.Factory cacheReadDataSourceFactory) {
this.cacheReadDataSourceFactory = cacheReadDataSourceFactory; this.cacheReadDataSourceFactory = cacheReadDataSourceFactory;
return this; return this;
...@@ -126,6 +129,7 @@ public final class CacheDataSource implements DataSource { ...@@ -126,6 +129,7 @@ public final class CacheDataSource implements DataSource {
* DataSinks} for writing data to the cache, or {@code null} to disable writing. * DataSinks} for writing data to the cache, or {@code null} to disable writing.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setCacheWriteDataSinkFactory( public Factory setCacheWriteDataSinkFactory(
@Nullable DataSink.Factory cacheWriteDataSinkFactory) { @Nullable DataSink.Factory cacheWriteDataSinkFactory) {
this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory; this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory;
...@@ -141,6 +145,7 @@ public final class CacheDataSource implements DataSource { ...@@ -141,6 +145,7 @@ public final class CacheDataSource implements DataSource {
* @param cacheKeyFactory The {@link CacheKeyFactory}. * @param cacheKeyFactory The {@link CacheKeyFactory}.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setCacheKeyFactory(CacheKeyFactory cacheKeyFactory) { public Factory setCacheKeyFactory(CacheKeyFactory cacheKeyFactory) {
this.cacheKeyFactory = cacheKeyFactory; this.cacheKeyFactory = cacheKeyFactory;
return this; return this;
...@@ -162,6 +167,7 @@ public final class CacheDataSource implements DataSource { ...@@ -162,6 +167,7 @@ public final class CacheDataSource implements DataSource {
* cache, or {@code null} to cause failure in the case of a cache miss. * cache, or {@code null} to cause failure in the case of a cache miss.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setUpstreamDataSourceFactory( public Factory setUpstreamDataSourceFactory(
@Nullable DataSource.Factory upstreamDataSourceFactory) { @Nullable DataSource.Factory upstreamDataSourceFactory) {
this.upstreamDataSourceFactory = upstreamDataSourceFactory; this.upstreamDataSourceFactory = upstreamDataSourceFactory;
...@@ -186,6 +192,7 @@ public final class CacheDataSource implements DataSource { ...@@ -186,6 +192,7 @@ public final class CacheDataSource implements DataSource {
* @param upstreamPriorityTaskManager The upstream {@link PriorityTaskManager}. * @param upstreamPriorityTaskManager The upstream {@link PriorityTaskManager}.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setUpstreamPriorityTaskManager( public Factory setUpstreamPriorityTaskManager(
@Nullable PriorityTaskManager upstreamPriorityTaskManager) { @Nullable PriorityTaskManager upstreamPriorityTaskManager) {
this.upstreamPriorityTaskManager = upstreamPriorityTaskManager; this.upstreamPriorityTaskManager = upstreamPriorityTaskManager;
...@@ -210,6 +217,7 @@ public final class CacheDataSource implements DataSource { ...@@ -210,6 +217,7 @@ public final class CacheDataSource implements DataSource {
* @param upstreamPriority The priority to use when requesting data from upstream. * @param upstreamPriority The priority to use when requesting data from upstream.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setUpstreamPriority(int upstreamPriority) { public Factory setUpstreamPriority(int upstreamPriority) {
this.upstreamPriority = upstreamPriority; this.upstreamPriority = upstreamPriority;
return this; return this;
...@@ -223,6 +231,7 @@ public final class CacheDataSource implements DataSource { ...@@ -223,6 +231,7 @@ public final class CacheDataSource implements DataSource {
* @param flags The {@link CacheDataSource.Flags}. * @param flags The {@link CacheDataSource.Flags}.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setFlags(@CacheDataSource.Flags int flags) { public Factory setFlags(@CacheDataSource.Flags int flags) {
this.flags = flags; this.flags = flags;
return this; return this;
...@@ -236,6 +245,7 @@ public final class CacheDataSource implements DataSource { ...@@ -236,6 +245,7 @@ public final class CacheDataSource implements DataSource {
* @param eventListener The {@link EventListener}. * @param eventListener The {@link EventListener}.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setEventListener(@Nullable EventListener eventListener) { public Factory setEventListener(@Nullable EventListener eventListener) {
this.eventListener = eventListener; this.eventListener = eventListener;
return this; return this;
......
...@@ -20,6 +20,7 @@ import androidx.annotation.Nullable; ...@@ -20,6 +20,7 @@ import androidx.annotation.Nullable;
import androidx.media3.common.C; import androidx.media3.common.C;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
...@@ -81,6 +82,7 @@ public class ContentMetadataMutations { ...@@ -81,6 +82,7 @@ public class ContentMetadataMutations {
* @param value The value to be set. * @param value The value to be set.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ContentMetadataMutations set(String name, String value) { public ContentMetadataMutations set(String name, String value) {
return checkAndSet(name, value); return checkAndSet(name, value);
} }
...@@ -92,6 +94,7 @@ public class ContentMetadataMutations { ...@@ -92,6 +94,7 @@ public class ContentMetadataMutations {
* @param value The value to be set. * @param value The value to be set.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ContentMetadataMutations set(String name, long value) { public ContentMetadataMutations set(String name, long value) {
return checkAndSet(name, value); return checkAndSet(name, value);
} }
...@@ -103,6 +106,7 @@ public class ContentMetadataMutations { ...@@ -103,6 +106,7 @@ public class ContentMetadataMutations {
* @param value The value to be set. * @param value The value to be set.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ContentMetadataMutations set(String name, byte[] value) { public ContentMetadataMutations set(String name, byte[] value) {
return checkAndSet(name, Arrays.copyOf(value, value.length)); return checkAndSet(name, Arrays.copyOf(value, value.length));
} }
...@@ -113,6 +117,7 @@ public class ContentMetadataMutations { ...@@ -113,6 +117,7 @@ public class ContentMetadataMutations {
* @param name The name of the metadata value. * @param name The name of the metadata value.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ContentMetadataMutations remove(String name) { public ContentMetadataMutations remove(String name) {
removedValues.add(name); removedValues.add(name);
editedValues.remove(name); editedValues.remove(name);
...@@ -137,6 +142,7 @@ public class ContentMetadataMutations { ...@@ -137,6 +142,7 @@ public class ContentMetadataMutations {
return Collections.unmodifiableMap(hashMap); return Collections.unmodifiableMap(hashMap);
} }
@CanIgnoreReturnValue
private ContentMetadataMutations checkAndSet(String name, Object value) { private ContentMetadataMutations checkAndSet(String name, Object value) {
editedValues.put(Assertions.checkNotNull(name), Assertions.checkNotNull(value)); editedValues.put(Assertions.checkNotNull(name), Assertions.checkNotNull(value));
removedValues.remove(name); removedValues.remove(name);
......
...@@ -24,6 +24,7 @@ dependencies { ...@@ -24,6 +24,7 @@ dependencies {
implementation project(modulePrefix + 'lib-common') implementation project(modulePrefix + 'lib-common')
implementation project(modulePrefix + 'lib-datasource') implementation project(modulePrefix + 'lib-datasource')
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
androidTestImplementation 'androidx.test:rules:' + androidxTestRulesVersion androidTestImplementation 'androidx.test:rules:' + androidxTestRulesVersion
......
...@@ -42,6 +42,7 @@ import com.google.common.base.Ascii; ...@@ -42,6 +42,7 @@ import com.google.common.base.Ascii;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.net.HttpHeaders; import com.google.common.net.HttpHeaders;
import com.google.common.primitives.Longs; import com.google.common.primitives.Longs;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
...@@ -142,6 +143,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -142,6 +143,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
readTimeoutMs = DEFAULT_READ_TIMEOUT_MILLIS; readTimeoutMs = DEFAULT_READ_TIMEOUT_MILLIS;
} }
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@Override @Override
public final Factory setDefaultRequestProperties(Map<String, String> defaultRequestProperties) { public final Factory setDefaultRequestProperties(Map<String, String> defaultRequestProperties) {
...@@ -162,6 +164,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -162,6 +164,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* agent of the underlying {@link CronetEngine}. * agent of the underlying {@link CronetEngine}.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setUserAgent(@Nullable String userAgent) { public Factory setUserAgent(@Nullable String userAgent) {
this.userAgent = userAgent; this.userAgent = userAgent;
...@@ -181,6 +184,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -181,6 +184,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* UrlRequest.Builder#REQUEST_PRIORITY_*} constants. * UrlRequest.Builder#REQUEST_PRIORITY_*} constants.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setRequestPriority(int requestPriority) { public Factory setRequestPriority(int requestPriority) {
this.requestPriority = requestPriority; this.requestPriority = requestPriority;
...@@ -195,6 +199,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -195,6 +199,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* @param connectTimeoutMs The connect timeout, in milliseconds, that will be used. * @param connectTimeoutMs The connect timeout, in milliseconds, that will be used.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setConnectionTimeoutMs(int connectTimeoutMs) { public Factory setConnectionTimeoutMs(int connectTimeoutMs) {
this.connectTimeoutMs = connectTimeoutMs; this.connectTimeoutMs = connectTimeoutMs;
...@@ -212,6 +217,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -212,6 +217,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* @param resetTimeoutOnRedirects Whether the connect timeout is reset when a redirect occurs. * @param resetTimeoutOnRedirects Whether the connect timeout is reset when a redirect occurs.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setResetTimeoutOnRedirects(boolean resetTimeoutOnRedirects) { public Factory setResetTimeoutOnRedirects(boolean resetTimeoutOnRedirects) {
this.resetTimeoutOnRedirects = resetTimeoutOnRedirects; this.resetTimeoutOnRedirects = resetTimeoutOnRedirects;
...@@ -228,6 +234,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -228,6 +234,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* to the redirect url in the "Cookie" header. * to the redirect url in the "Cookie" header.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setHandleSetCookieRequests(boolean handleSetCookieRequests) { public Factory setHandleSetCookieRequests(boolean handleSetCookieRequests) {
this.handleSetCookieRequests = handleSetCookieRequests; this.handleSetCookieRequests = handleSetCookieRequests;
...@@ -242,6 +249,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -242,6 +249,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* @param readTimeoutMs The connect timeout, in milliseconds, that will be used. * @param readTimeoutMs The connect timeout, in milliseconds, that will be used.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setReadTimeoutMs(int readTimeoutMs) { public Factory setReadTimeoutMs(int readTimeoutMs) {
this.readTimeoutMs = readTimeoutMs; this.readTimeoutMs = readTimeoutMs;
...@@ -261,6 +269,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -261,6 +269,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* predicate that was previously set. * predicate that was previously set.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setContentTypePredicate(@Nullable Predicate<String> contentTypePredicate) { public Factory setContentTypePredicate(@Nullable Predicate<String> contentTypePredicate) {
this.contentTypePredicate = contentTypePredicate; this.contentTypePredicate = contentTypePredicate;
...@@ -274,6 +283,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -274,6 +283,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* Sets whether we should keep the POST method and body when we have HTTP 302 redirects for a * Sets whether we should keep the POST method and body when we have HTTP 302 redirects for a
* POST request. * POST request.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setKeepPostFor302Redirects(boolean keepPostFor302Redirects) { public Factory setKeepPostFor302Redirects(boolean keepPostFor302Redirects) {
this.keepPostFor302Redirects = keepPostFor302Redirects; this.keepPostFor302Redirects = keepPostFor302Redirects;
...@@ -293,6 +303,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -293,6 +303,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* @param transferListener The listener that will be used. * @param transferListener The listener that will be used.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setTransferListener(@Nullable TransferListener transferListener) { public Factory setTransferListener(@Nullable TransferListener transferListener) {
this.transferListener = transferListener; this.transferListener = transferListener;
...@@ -313,6 +324,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource { ...@@ -313,6 +324,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* @deprecated Do not use {@link CronetDataSource} or its factory in cases where a suitable * @deprecated Do not use {@link CronetDataSource} or its factory in cases where a suitable
* {@link CronetEngine} is not available. Use the fallback factory directly in such cases. * {@link CronetEngine} is not available. Use the fallback factory directly in such cases.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@Deprecated @Deprecated
public Factory setFallbackFactory(@Nullable HttpDataSource.Factory fallbackFactory) { public Factory setFallbackFactory(@Nullable HttpDataSource.Factory fallbackFactory) {
......
...@@ -19,6 +19,7 @@ dependencies { ...@@ -19,6 +19,7 @@ dependencies {
implementation project(modulePrefix + 'lib-common') implementation project(modulePrefix + 'lib-common')
implementation project(modulePrefix + 'lib-datasource') implementation project(modulePrefix + 'lib-datasource')
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
testImplementation project(modulePrefix + 'test-utils') testImplementation project(modulePrefix + 'test-utils')
......
...@@ -40,6 +40,7 @@ import androidx.media3.datasource.TransferListener; ...@@ -40,6 +40,7 @@ import androidx.media3.datasource.TransferListener;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.net.HttpHeaders; import com.google.common.net.HttpHeaders;
import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.SettableFuture;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
...@@ -94,6 +95,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource { ...@@ -94,6 +95,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
defaultRequestProperties = new RequestProperties(); defaultRequestProperties = new RequestProperties();
} }
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@Override @Override
public final Factory setDefaultRequestProperties(Map<String, String> defaultRequestProperties) { public final Factory setDefaultRequestProperties(Map<String, String> defaultRequestProperties) {
...@@ -111,6 +113,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource { ...@@ -111,6 +113,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
* agent of the underlying {@link OkHttpClient}. * agent of the underlying {@link OkHttpClient}.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setUserAgent(@Nullable String userAgent) { public Factory setUserAgent(@Nullable String userAgent) {
this.userAgent = userAgent; this.userAgent = userAgent;
...@@ -125,6 +128,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource { ...@@ -125,6 +128,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
* @param cacheControl The cache control that will be used. * @param cacheControl The cache control that will be used.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setCacheControl(@Nullable CacheControl cacheControl) { public Factory setCacheControl(@Nullable CacheControl cacheControl) {
this.cacheControl = cacheControl; this.cacheControl = cacheControl;
...@@ -142,6 +146,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource { ...@@ -142,6 +146,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
* predicate that was previously set. * predicate that was previously set.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setContentTypePredicate(@Nullable Predicate<String> contentTypePredicate) { public Factory setContentTypePredicate(@Nullable Predicate<String> contentTypePredicate) {
this.contentTypePredicate = contentTypePredicate; this.contentTypePredicate = contentTypePredicate;
...@@ -158,6 +163,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource { ...@@ -158,6 +163,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
* @param transferListener The listener that will be used. * @param transferListener The listener that will be used.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Factory setTransferListener(@Nullable TransferListener transferListener) { public Factory setTransferListener(@Nullable TransferListener transferListener) {
this.transferListener = transferListener; this.transferListener = transferListener;
......
...@@ -18,6 +18,7 @@ dependencies { ...@@ -18,6 +18,7 @@ dependencies {
implementation project(modulePrefix + 'lib-datasource') implementation project(modulePrefix + 'lib-datasource')
implementation 'io.antmedia:rtmp-client:3.2.0' implementation 'io.antmedia:rtmp-client:3.2.0'
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
testImplementation project(modulePrefix + 'lib-exoplayer') testImplementation project(modulePrefix + 'lib-exoplayer')
testImplementation project(modulePrefix + 'test-utils') testImplementation project(modulePrefix + 'test-utils')
......
...@@ -26,6 +26,7 @@ import androidx.media3.datasource.BaseDataSource; ...@@ -26,6 +26,7 @@ import androidx.media3.datasource.BaseDataSource;
import androidx.media3.datasource.DataSource; import androidx.media3.datasource.DataSource;
import androidx.media3.datasource.DataSpec; import androidx.media3.datasource.DataSpec;
import androidx.media3.datasource.TransferListener; import androidx.media3.datasource.TransferListener;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import io.antmedia.rtmp_client.RtmpClient; import io.antmedia.rtmp_client.RtmpClient;
import io.antmedia.rtmp_client.RtmpClient.RtmpIOException; import io.antmedia.rtmp_client.RtmpClient.RtmpIOException;
import java.io.IOException; import java.io.IOException;
...@@ -53,6 +54,7 @@ public final class RtmpDataSource extends BaseDataSource { ...@@ -53,6 +54,7 @@ public final class RtmpDataSource extends BaseDataSource {
* @param transferListener The listener that will be used. * @param transferListener The listener that will be used.
* @return This factory. * @return This factory.
*/ */
@CanIgnoreReturnValue
public Factory setTransferListener(@Nullable TransferListener transferListener) { public Factory setTransferListener(@Nullable TransferListener transferListener) {
this.transferListener = transferListener; this.transferListener = transferListener;
return this; return this;
......
...@@ -25,6 +25,7 @@ import androidx.media3.common.MediaItem.LiveConfiguration; ...@@ -25,6 +25,7 @@ import androidx.media3.common.MediaItem.LiveConfiguration;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
/** /**
* A {@link LivePlaybackSpeedControl} that adjusts the playback speed using a proportional * A {@link LivePlaybackSpeedControl} that adjusts the playback speed using a proportional
...@@ -125,6 +126,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC ...@@ -125,6 +126,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC
* @param fallbackMinPlaybackSpeed The fallback minimum factor by which playback can be sped up. * @param fallbackMinPlaybackSpeed The fallback minimum factor by which playback can be sped up.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public Builder setFallbackMinPlaybackSpeed(float fallbackMinPlaybackSpeed) { public Builder setFallbackMinPlaybackSpeed(float fallbackMinPlaybackSpeed) {
Assertions.checkArgument(0 < fallbackMinPlaybackSpeed && fallbackMinPlaybackSpeed <= 1f); Assertions.checkArgument(0 < fallbackMinPlaybackSpeed && fallbackMinPlaybackSpeed <= 1f);
this.fallbackMinPlaybackSpeed = fallbackMinPlaybackSpeed; this.fallbackMinPlaybackSpeed = fallbackMinPlaybackSpeed;
...@@ -140,6 +142,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC ...@@ -140,6 +142,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC
* @param fallbackMaxPlaybackSpeed The fallback maximum factor by which playback can be sped up. * @param fallbackMaxPlaybackSpeed The fallback maximum factor by which playback can be sped up.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public Builder setFallbackMaxPlaybackSpeed(float fallbackMaxPlaybackSpeed) { public Builder setFallbackMaxPlaybackSpeed(float fallbackMaxPlaybackSpeed) {
Assertions.checkArgument(fallbackMaxPlaybackSpeed >= 1f); Assertions.checkArgument(fallbackMaxPlaybackSpeed >= 1f);
this.fallbackMaxPlaybackSpeed = fallbackMaxPlaybackSpeed; this.fallbackMaxPlaybackSpeed = fallbackMaxPlaybackSpeed;
...@@ -155,6 +158,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC ...@@ -155,6 +158,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC
* milliseconds. * milliseconds.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public Builder setMinUpdateIntervalMs(long minUpdateIntervalMs) { public Builder setMinUpdateIntervalMs(long minUpdateIntervalMs) {
Assertions.checkArgument(minUpdateIntervalMs > 0); Assertions.checkArgument(minUpdateIntervalMs > 0);
this.minUpdateIntervalMs = minUpdateIntervalMs; this.minUpdateIntervalMs = minUpdateIntervalMs;
...@@ -173,6 +177,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC ...@@ -173,6 +177,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC
* speed. * speed.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public Builder setProportionalControlFactor(float proportionalControlFactor) { public Builder setProportionalControlFactor(float proportionalControlFactor) {
Assertions.checkArgument(proportionalControlFactor > 0); Assertions.checkArgument(proportionalControlFactor > 0);
this.proportionalControlFactorUs = proportionalControlFactor / C.MICROS_PER_SECOND; this.proportionalControlFactorUs = proportionalControlFactor / C.MICROS_PER_SECOND;
...@@ -189,6 +194,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC ...@@ -189,6 +194,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC
* used, in milliseconds. * used, in milliseconds.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public Builder setMaxLiveOffsetErrorMsForUnitSpeed(long maxLiveOffsetErrorMsForUnitSpeed) { public Builder setMaxLiveOffsetErrorMsForUnitSpeed(long maxLiveOffsetErrorMsForUnitSpeed) {
Assertions.checkArgument(maxLiveOffsetErrorMsForUnitSpeed > 0); Assertions.checkArgument(maxLiveOffsetErrorMsForUnitSpeed > 0);
this.maxLiveOffsetErrorUsForUnitSpeed = Util.msToUs(maxLiveOffsetErrorMsForUnitSpeed); this.maxLiveOffsetErrorUsForUnitSpeed = Util.msToUs(maxLiveOffsetErrorMsForUnitSpeed);
...@@ -203,6 +209,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC ...@@ -203,6 +209,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC
* when the player is rebuffering, in milliseconds * when the player is rebuffering, in milliseconds
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public Builder setTargetLiveOffsetIncrementOnRebufferMs( public Builder setTargetLiveOffsetIncrementOnRebufferMs(
long targetLiveOffsetIncrementOnRebufferMs) { long targetLiveOffsetIncrementOnRebufferMs) {
Assertions.checkArgument(targetLiveOffsetIncrementOnRebufferMs >= 0); Assertions.checkArgument(targetLiveOffsetIncrementOnRebufferMs >= 0);
...@@ -225,6 +232,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC ...@@ -225,6 +232,7 @@ public final class DefaultLivePlaybackSpeedControl implements LivePlaybackSpeedC
* @param minPossibleLiveOffsetSmoothingFactor The smoothing factor. Must be &ge; 0 and &lt; 1. * @param minPossibleLiveOffsetSmoothingFactor The smoothing factor. Must be &ge; 0 and &lt; 1.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public Builder setMinPossibleLiveOffsetSmoothingFactor( public Builder setMinPossibleLiveOffsetSmoothingFactor(
float minPossibleLiveOffsetSmoothingFactor) { float minPossibleLiveOffsetSmoothingFactor) {
Assertions.checkArgument( Assertions.checkArgument(
......
...@@ -29,6 +29,7 @@ import androidx.media3.exoplayer.source.TrackGroupArray; ...@@ -29,6 +29,7 @@ import androidx.media3.exoplayer.source.TrackGroupArray;
import androidx.media3.exoplayer.trackselection.ExoTrackSelection; import androidx.media3.exoplayer.trackselection.ExoTrackSelection;
import androidx.media3.exoplayer.upstream.Allocator; import androidx.media3.exoplayer.upstream.Allocator;
import androidx.media3.exoplayer.upstream.DefaultAllocator; import androidx.media3.exoplayer.upstream.DefaultAllocator;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
/** The default {@link LoadControl} implementation. */ /** The default {@link LoadControl} implementation. */
@UnstableApi @UnstableApi
...@@ -133,6 +134,7 @@ public class DefaultLoadControl implements LoadControl { ...@@ -133,6 +134,7 @@ public class DefaultLoadControl implements LoadControl {
* @return This builder, for convenience. * @return This builder, for convenience.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder setAllocator(DefaultAllocator allocator) { public Builder setAllocator(DefaultAllocator allocator) {
checkState(!buildCalled); checkState(!buildCalled);
this.allocator = allocator; this.allocator = allocator;
...@@ -154,6 +156,7 @@ public class DefaultLoadControl implements LoadControl { ...@@ -154,6 +156,7 @@ public class DefaultLoadControl implements LoadControl {
* @return This builder, for convenience. * @return This builder, for convenience.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder setBufferDurationsMs( public Builder setBufferDurationsMs(
int minBufferMs, int minBufferMs,
int maxBufferMs, int maxBufferMs,
...@@ -185,6 +188,7 @@ public class DefaultLoadControl implements LoadControl { ...@@ -185,6 +188,7 @@ public class DefaultLoadControl implements LoadControl {
* @return This builder, for convenience. * @return This builder, for convenience.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder setTargetBufferBytes(int targetBufferBytes) { public Builder setTargetBufferBytes(int targetBufferBytes) {
checkState(!buildCalled); checkState(!buildCalled);
this.targetBufferBytes = targetBufferBytes; this.targetBufferBytes = targetBufferBytes;
...@@ -200,6 +204,7 @@ public class DefaultLoadControl implements LoadControl { ...@@ -200,6 +204,7 @@ public class DefaultLoadControl implements LoadControl {
* @return This builder, for convenience. * @return This builder, for convenience.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder setPrioritizeTimeOverSizeThresholds(boolean prioritizeTimeOverSizeThresholds) { public Builder setPrioritizeTimeOverSizeThresholds(boolean prioritizeTimeOverSizeThresholds) {
checkState(!buildCalled); checkState(!buildCalled);
this.prioritizeTimeOverSizeThresholds = prioritizeTimeOverSizeThresholds; this.prioritizeTimeOverSizeThresholds = prioritizeTimeOverSizeThresholds;
...@@ -216,6 +221,7 @@ public class DefaultLoadControl implements LoadControl { ...@@ -216,6 +221,7 @@ public class DefaultLoadControl implements LoadControl {
* @return This builder, for convenience. * @return This builder, for convenience.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder setBackBuffer(int backBufferDurationMs, boolean retainBackBufferFromKeyframe) { public Builder setBackBuffer(int backBufferDurationMs, boolean retainBackBufferFromKeyframe) {
checkState(!buildCalled); checkState(!buildCalled);
assertGreaterOrEqual(backBufferDurationMs, 0, "backBufferDurationMs", "0"); assertGreaterOrEqual(backBufferDurationMs, 0, "backBufferDurationMs", "0");
......
...@@ -42,6 +42,7 @@ import androidx.media3.exoplayer.trackselection.TrackSelector; ...@@ -42,6 +42,7 @@ import androidx.media3.exoplayer.trackselection.TrackSelector;
import androidx.media3.exoplayer.video.MediaCodecVideoRenderer; import androidx.media3.exoplayer.video.MediaCodecVideoRenderer;
import androidx.media3.exoplayer.video.VideoRendererEventListener; import androidx.media3.exoplayer.video.VideoRendererEventListener;
import androidx.media3.exoplayer.video.spherical.CameraMotionRenderer; import androidx.media3.exoplayer.video.spherical.CameraMotionRenderer;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -124,6 +125,7 @@ public class DefaultRenderersFactory implements RenderersFactory { ...@@ -124,6 +125,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
* @param extensionRendererMode The extension renderer mode. * @param extensionRendererMode The extension renderer mode.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultRenderersFactory setExtensionRendererMode( public DefaultRenderersFactory setExtensionRendererMode(
@ExtensionRendererMode int extensionRendererMode) { @ExtensionRendererMode int extensionRendererMode) {
this.extensionRendererMode = extensionRendererMode; this.extensionRendererMode = extensionRendererMode;
...@@ -139,6 +141,7 @@ public class DefaultRenderersFactory implements RenderersFactory { ...@@ -139,6 +141,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
* *
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultRenderersFactory forceEnableMediaCodecAsynchronousQueueing() { public DefaultRenderersFactory forceEnableMediaCodecAsynchronousQueueing() {
codecAdapterFactory.forceEnableAsynchronous(); codecAdapterFactory.forceEnableAsynchronous();
return this; return this;
...@@ -151,6 +154,7 @@ public class DefaultRenderersFactory implements RenderersFactory { ...@@ -151,6 +154,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
* *
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultRenderersFactory forceDisableMediaCodecAsynchronousQueueing() { public DefaultRenderersFactory forceDisableMediaCodecAsynchronousQueueing() {
codecAdapterFactory.forceDisableAsynchronous(); codecAdapterFactory.forceDisableAsynchronous();
return this; return this;
...@@ -165,6 +169,7 @@ public class DefaultRenderersFactory implements RenderersFactory { ...@@ -165,6 +169,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
* queueing. * queueing.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultRenderersFactory experimentalSetSynchronizeCodecInteractionsWithQueueingEnabled( public DefaultRenderersFactory experimentalSetSynchronizeCodecInteractionsWithQueueingEnabled(
boolean enabled) { boolean enabled) {
codecAdapterFactory.experimentalSetSynchronizeCodecInteractionsWithQueueingEnabled(enabled); codecAdapterFactory.experimentalSetSynchronizeCodecInteractionsWithQueueingEnabled(enabled);
...@@ -179,6 +184,7 @@ public class DefaultRenderersFactory implements RenderersFactory { ...@@ -179,6 +184,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
* initialization fails. * initialization fails.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultRenderersFactory setEnableDecoderFallback(boolean enableDecoderFallback) { public DefaultRenderersFactory setEnableDecoderFallback(boolean enableDecoderFallback) {
this.enableDecoderFallback = enableDecoderFallback; this.enableDecoderFallback = enableDecoderFallback;
return this; return this;
...@@ -192,6 +198,7 @@ public class DefaultRenderersFactory implements RenderersFactory { ...@@ -192,6 +198,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
* @param mediaCodecSelector The {@link MediaCodecSelector}. * @param mediaCodecSelector The {@link MediaCodecSelector}.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultRenderersFactory setMediaCodecSelector(MediaCodecSelector mediaCodecSelector) { public DefaultRenderersFactory setMediaCodecSelector(MediaCodecSelector mediaCodecSelector) {
this.mediaCodecSelector = mediaCodecSelector; this.mediaCodecSelector = mediaCodecSelector;
return this; return this;
...@@ -208,6 +215,7 @@ public class DefaultRenderersFactory implements RenderersFactory { ...@@ -208,6 +215,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
* @param enableFloatOutput Whether to enable use of floating point audio output, if available. * @param enableFloatOutput Whether to enable use of floating point audio output, if available.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultRenderersFactory setEnableAudioFloatOutput(boolean enableFloatOutput) { public DefaultRenderersFactory setEnableAudioFloatOutput(boolean enableFloatOutput) {
this.enableFloatOutput = enableFloatOutput; this.enableFloatOutput = enableFloatOutput;
return this; return this;
...@@ -230,6 +238,7 @@ public class DefaultRenderersFactory implements RenderersFactory { ...@@ -230,6 +238,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
* available. * available.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultRenderersFactory setEnableAudioOffload(boolean enableOffload) { public DefaultRenderersFactory setEnableAudioOffload(boolean enableOffload) {
this.enableOffload = enableOffload; this.enableOffload = enableOffload;
return this; return this;
...@@ -253,6 +262,7 @@ public class DefaultRenderersFactory implements RenderersFactory { ...@@ -253,6 +262,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
* android.media.AudioTrack#setPlaybackParams(PlaybackParams)}. * android.media.AudioTrack#setPlaybackParams(PlaybackParams)}.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultRenderersFactory setEnableAudioTrackPlaybackParams( public DefaultRenderersFactory setEnableAudioTrackPlaybackParams(
boolean enableAudioTrackPlaybackParams) { boolean enableAudioTrackPlaybackParams) {
this.enableAudioTrackPlaybackParams = enableAudioTrackPlaybackParams; this.enableAudioTrackPlaybackParams = enableAudioTrackPlaybackParams;
...@@ -269,6 +279,7 @@ public class DefaultRenderersFactory implements RenderersFactory { ...@@ -269,6 +279,7 @@ public class DefaultRenderersFactory implements RenderersFactory {
* seamlessly join an ongoing playback, in milliseconds. * seamlessly join an ongoing playback, in milliseconds.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultRenderersFactory setAllowedVideoJoiningTimeMs(long allowedVideoJoiningTimeMs) { public DefaultRenderersFactory setAllowedVideoJoiningTimeMs(long allowedVideoJoiningTimeMs) {
this.allowedVideoJoiningTimeMs = allowedVideoJoiningTimeMs; this.allowedVideoJoiningTimeMs = allowedVideoJoiningTimeMs;
return this; return this;
......
...@@ -70,6 +70,7 @@ import androidx.media3.extractor.DefaultExtractorsFactory; ...@@ -70,6 +70,7 @@ import androidx.media3.extractor.DefaultExtractorsFactory;
import androidx.media3.extractor.ExtractorsFactory; import androidx.media3.extractor.ExtractorsFactory;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.List; import java.util.List;
/** /**
...@@ -683,6 +684,7 @@ public interface ExoPlayer extends Player { ...@@ -683,6 +684,7 @@ public interface ExoPlayer extends Player {
* *
* @param timeoutMs The time limit in milliseconds. * @param timeoutMs The time limit in milliseconds.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder experimentalSetForegroundModeTimeoutMs(long timeoutMs) { public Builder experimentalSetForegroundModeTimeoutMs(long timeoutMs) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -697,6 +699,7 @@ public interface ExoPlayer extends Player { ...@@ -697,6 +699,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setRenderersFactory(RenderersFactory renderersFactory) { public Builder setRenderersFactory(RenderersFactory renderersFactory) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -712,6 +715,7 @@ public interface ExoPlayer extends Player { ...@@ -712,6 +715,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder setMediaSourceFactory(MediaSource.Factory mediaSourceFactory) { public Builder setMediaSourceFactory(MediaSource.Factory mediaSourceFactory) {
checkState(!buildCalled); checkState(!buildCalled);
checkNotNull(mediaSourceFactory); checkNotNull(mediaSourceFactory);
...@@ -726,6 +730,7 @@ public interface ExoPlayer extends Player { ...@@ -726,6 +730,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setTrackSelector(TrackSelector trackSelector) { public Builder setTrackSelector(TrackSelector trackSelector) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -741,6 +746,7 @@ public interface ExoPlayer extends Player { ...@@ -741,6 +746,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setLoadControl(LoadControl loadControl) { public Builder setLoadControl(LoadControl loadControl) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -756,6 +762,7 @@ public interface ExoPlayer extends Player { ...@@ -756,6 +762,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setBandwidthMeter(BandwidthMeter bandwidthMeter) { public Builder setBandwidthMeter(BandwidthMeter bandwidthMeter) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -772,6 +779,7 @@ public interface ExoPlayer extends Player { ...@@ -772,6 +779,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setLooper(Looper looper) { public Builder setLooper(Looper looper) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -787,6 +795,7 @@ public interface ExoPlayer extends Player { ...@@ -787,6 +795,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setAnalyticsCollector(AnalyticsCollector analyticsCollector) { public Builder setAnalyticsCollector(AnalyticsCollector analyticsCollector) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -804,6 +813,7 @@ public interface ExoPlayer extends Player { ...@@ -804,6 +813,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setPriorityTaskManager(@Nullable PriorityTaskManager priorityTaskManager) { public Builder setPriorityTaskManager(@Nullable PriorityTaskManager priorityTaskManager) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -824,6 +834,7 @@ public interface ExoPlayer extends Player { ...@@ -824,6 +834,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus) { public Builder setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus) {
checkState(!buildCalled); checkState(!buildCalled);
this.audioAttributes = checkNotNull(audioAttributes); this.audioAttributes = checkNotNull(audioAttributes);
...@@ -848,6 +859,7 @@ public interface ExoPlayer extends Player { ...@@ -848,6 +859,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder setWakeMode(@C.WakeMode int wakeMode) { public Builder setWakeMode(@C.WakeMode int wakeMode) {
checkState(!buildCalled); checkState(!buildCalled);
this.wakeMode = wakeMode; this.wakeMode = wakeMode;
...@@ -865,6 +877,7 @@ public interface ExoPlayer extends Player { ...@@ -865,6 +877,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
public Builder setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy) { public Builder setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy) {
checkState(!buildCalled); checkState(!buildCalled);
this.handleAudioBecomingNoisy = handleAudioBecomingNoisy; this.handleAudioBecomingNoisy = handleAudioBecomingNoisy;
...@@ -878,6 +891,7 @@ public interface ExoPlayer extends Player { ...@@ -878,6 +891,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setSkipSilenceEnabled(boolean skipSilenceEnabled) { public Builder setSkipSilenceEnabled(boolean skipSilenceEnabled) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -895,6 +909,7 @@ public interface ExoPlayer extends Player { ...@@ -895,6 +909,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setVideoScalingMode(@C.VideoScalingMode int videoScalingMode) { public Builder setVideoScalingMode(@C.VideoScalingMode int videoScalingMode) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -916,6 +931,7 @@ public interface ExoPlayer extends Player { ...@@ -916,6 +931,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setVideoChangeFrameRateStrategy( public Builder setVideoChangeFrameRateStrategy(
@C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy) { @C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy) {
...@@ -935,6 +951,7 @@ public interface ExoPlayer extends Player { ...@@ -935,6 +951,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setUseLazyPreparation(boolean useLazyPreparation) { public Builder setUseLazyPreparation(boolean useLazyPreparation) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -949,6 +966,7 @@ public interface ExoPlayer extends Player { ...@@ -949,6 +966,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setSeekParameters(SeekParameters seekParameters) { public Builder setSeekParameters(SeekParameters seekParameters) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -964,6 +982,7 @@ public interface ExoPlayer extends Player { ...@@ -964,6 +982,7 @@ public interface ExoPlayer extends Player {
* @throws IllegalArgumentException If {@code seekBackIncrementMs} is non-positive. * @throws IllegalArgumentException If {@code seekBackIncrementMs} is non-positive.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setSeekBackIncrementMs(@IntRange(from = 1) long seekBackIncrementMs) { public Builder setSeekBackIncrementMs(@IntRange(from = 1) long seekBackIncrementMs) {
checkArgument(seekBackIncrementMs > 0); checkArgument(seekBackIncrementMs > 0);
...@@ -980,6 +999,7 @@ public interface ExoPlayer extends Player { ...@@ -980,6 +999,7 @@ public interface ExoPlayer extends Player {
* @throws IllegalArgumentException If {@code seekForwardIncrementMs} is non-positive. * @throws IllegalArgumentException If {@code seekForwardIncrementMs} is non-positive.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setSeekForwardIncrementMs(@IntRange(from = 1) long seekForwardIncrementMs) { public Builder setSeekForwardIncrementMs(@IntRange(from = 1) long seekForwardIncrementMs) {
checkArgument(seekForwardIncrementMs > 0); checkArgument(seekForwardIncrementMs > 0);
...@@ -999,6 +1019,7 @@ public interface ExoPlayer extends Player { ...@@ -999,6 +1019,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setReleaseTimeoutMs(long releaseTimeoutMs) { public Builder setReleaseTimeoutMs(long releaseTimeoutMs) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -1017,6 +1038,7 @@ public interface ExoPlayer extends Player { ...@@ -1017,6 +1038,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setDetachSurfaceTimeoutMs(long detachSurfaceTimeoutMs) { public Builder setDetachSurfaceTimeoutMs(long detachSurfaceTimeoutMs) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -1036,6 +1058,7 @@ public interface ExoPlayer extends Player { ...@@ -1036,6 +1058,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems) { public Builder setPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -1051,6 +1074,7 @@ public interface ExoPlayer extends Player { ...@@ -1051,6 +1074,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setLivePlaybackSpeedControl(LivePlaybackSpeedControl livePlaybackSpeedControl) { public Builder setLivePlaybackSpeedControl(LivePlaybackSpeedControl livePlaybackSpeedControl) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -1073,6 +1097,7 @@ public interface ExoPlayer extends Player { ...@@ -1073,6 +1097,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setUsePlatformDiagnostics(boolean usePlatformDiagnostics) { public Builder setUsePlatformDiagnostics(boolean usePlatformDiagnostics) {
checkState(!buildCalled); checkState(!buildCalled);
...@@ -1088,6 +1113,7 @@ public interface ExoPlayer extends Player { ...@@ -1088,6 +1113,7 @@ public interface ExoPlayer extends Player {
* @return This builder. * @return This builder.
* @throws IllegalStateException If {@link #build()} has already been called. * @throws IllegalStateException If {@link #build()} has already been called.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@VisibleForTesting @VisibleForTesting
public Builder setClock(Clock clock) { public Builder setClock(Clock clock) {
......
...@@ -105,6 +105,7 @@ import androidx.media3.exoplayer.video.VideoRendererEventListener; ...@@ -105,6 +105,7 @@ import androidx.media3.exoplayer.video.VideoRendererEventListener;
import androidx.media3.exoplayer.video.spherical.CameraMotionListener; import androidx.media3.exoplayer.video.spherical.CameraMotionListener;
import androidx.media3.exoplayer.video.spherical.SphericalGLSurfaceView; import androidx.media3.exoplayer.video.spherical.SphericalGLSurfaceView;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
...@@ -397,6 +398,7 @@ import java.util.concurrent.TimeoutException; ...@@ -397,6 +398,7 @@ import java.util.concurrent.TimeoutException;
} }
} }
@CanIgnoreReturnValue
@SuppressWarnings("deprecation") // Returning deprecated class. @SuppressWarnings("deprecation") // Returning deprecated class.
@Override @Override
@Deprecated @Deprecated
...@@ -405,6 +407,7 @@ import java.util.concurrent.TimeoutException; ...@@ -405,6 +407,7 @@ import java.util.concurrent.TimeoutException;
return this; return this;
} }
@CanIgnoreReturnValue
@SuppressWarnings("deprecation") // Returning deprecated class. @SuppressWarnings("deprecation") // Returning deprecated class.
@Override @Override
@Deprecated @Deprecated
...@@ -413,6 +416,7 @@ import java.util.concurrent.TimeoutException; ...@@ -413,6 +416,7 @@ import java.util.concurrent.TimeoutException;
return this; return this;
} }
@CanIgnoreReturnValue
@SuppressWarnings("deprecation") // Returning deprecated class. @SuppressWarnings("deprecation") // Returning deprecated class.
@Override @Override
@Deprecated @Deprecated
...@@ -421,6 +425,7 @@ import java.util.concurrent.TimeoutException; ...@@ -421,6 +425,7 @@ import java.util.concurrent.TimeoutException;
return this; return this;
} }
@CanIgnoreReturnValue
@SuppressWarnings("deprecation") // Returning deprecated class. @SuppressWarnings("deprecation") // Returning deprecated class.
@Override @Override
@Deprecated @Deprecated
......
...@@ -27,6 +27,7 @@ import androidx.media3.common.util.Assertions; ...@@ -27,6 +27,7 @@ import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.Clock; import androidx.media3.common.util.Clock;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.exoplayer.Renderer.MessageType; import androidx.media3.exoplayer.Renderer.MessageType;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
/** /**
...@@ -125,6 +126,7 @@ public final class PlayerMessage { ...@@ -125,6 +126,7 @@ public final class PlayerMessage {
* @return This message. * @return This message.
* @throws IllegalStateException If {@link #send()} has already been called. * @throws IllegalStateException If {@link #send()} has already been called.
*/ */
@CanIgnoreReturnValue
public PlayerMessage setType(int messageType) { public PlayerMessage setType(int messageType) {
Assertions.checkState(!isSent); Assertions.checkState(!isSent);
this.type = messageType; this.type = messageType;
...@@ -143,6 +145,7 @@ public final class PlayerMessage { ...@@ -143,6 +145,7 @@ public final class PlayerMessage {
* @return This message. * @return This message.
* @throws IllegalStateException If {@link #send()} has already been called. * @throws IllegalStateException If {@link #send()} has already been called.
*/ */
@CanIgnoreReturnValue
public PlayerMessage setPayload(@Nullable Object payload) { public PlayerMessage setPayload(@Nullable Object payload) {
Assertions.checkState(!isSent); Assertions.checkState(!isSent);
this.payload = payload; this.payload = payload;
...@@ -158,6 +161,7 @@ public final class PlayerMessage { ...@@ -158,6 +161,7 @@ public final class PlayerMessage {
/** /**
* @deprecated Use {@link #setLooper(Looper)} instead. * @deprecated Use {@link #setLooper(Looper)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public PlayerMessage setHandler(Handler handler) { public PlayerMessage setHandler(Handler handler) {
return setLooper(handler.getLooper()); return setLooper(handler.getLooper());
...@@ -170,6 +174,7 @@ public final class PlayerMessage { ...@@ -170,6 +174,7 @@ public final class PlayerMessage {
* @return This message. * @return This message.
* @throws IllegalStateException If {@link #send()} has already been called. * @throws IllegalStateException If {@link #send()} has already been called.
*/ */
@CanIgnoreReturnValue
public PlayerMessage setLooper(Looper looper) { public PlayerMessage setLooper(Looper looper) {
Assertions.checkState(!isSent); Assertions.checkState(!isSent);
this.looper = looper; this.looper = looper;
...@@ -200,6 +205,7 @@ public final class PlayerMessage { ...@@ -200,6 +205,7 @@ public final class PlayerMessage {
* @return This message. * @return This message.
* @throws IllegalStateException If {@link #send()} has already been called. * @throws IllegalStateException If {@link #send()} has already been called.
*/ */
@CanIgnoreReturnValue
public PlayerMessage setPosition(long positionMs) { public PlayerMessage setPosition(long positionMs) {
Assertions.checkState(!isSent); Assertions.checkState(!isSent);
this.positionMs = positionMs; this.positionMs = positionMs;
...@@ -218,6 +224,7 @@ public final class PlayerMessage { ...@@ -218,6 +224,7 @@ public final class PlayerMessage {
* empty and the provided media item index is not within the bounds of the timeline. * empty and the provided media item index is not within the bounds of the timeline.
* @throws IllegalStateException If {@link #send()} has already been called. * @throws IllegalStateException If {@link #send()} has already been called.
*/ */
@CanIgnoreReturnValue
public PlayerMessage setPosition(int mediaItemIndex, long positionMs) { public PlayerMessage setPosition(int mediaItemIndex, long positionMs) {
Assertions.checkState(!isSent); Assertions.checkState(!isSent);
Assertions.checkArgument(positionMs != C.TIME_UNSET); Assertions.checkArgument(positionMs != C.TIME_UNSET);
...@@ -244,6 +251,7 @@ public final class PlayerMessage { ...@@ -244,6 +251,7 @@ public final class PlayerMessage {
* @return This message. * @return This message.
* @throws IllegalStateException If {@link #send()} has already been called. * @throws IllegalStateException If {@link #send()} has already been called.
*/ */
@CanIgnoreReturnValue
public PlayerMessage setDeleteAfterDelivery(boolean deleteAfterDelivery) { public PlayerMessage setDeleteAfterDelivery(boolean deleteAfterDelivery) {
Assertions.checkState(!isSent); Assertions.checkState(!isSent);
this.deleteAfterDelivery = deleteAfterDelivery; this.deleteAfterDelivery = deleteAfterDelivery;
...@@ -262,6 +270,7 @@ public final class PlayerMessage { ...@@ -262,6 +270,7 @@ public final class PlayerMessage {
* @return This message. * @return This message.
* @throws IllegalStateException If this message has already been sent. * @throws IllegalStateException If this message has already been sent.
*/ */
@CanIgnoreReturnValue
public PlayerMessage send() { public PlayerMessage send() {
Assertions.checkState(!isSent); Assertions.checkState(!isSent);
if (positionMs == C.TIME_UNSET) { if (positionMs == C.TIME_UNSET) {
...@@ -278,6 +287,7 @@ public final class PlayerMessage { ...@@ -278,6 +287,7 @@ public final class PlayerMessage {
* @return This message. * @return This message.
* @throws IllegalStateException If this method is called before {@link #send()}. * @throws IllegalStateException If this method is called before {@link #send()}.
*/ */
@CanIgnoreReturnValue
public synchronized PlayerMessage cancel() { public synchronized PlayerMessage cancel() {
Assertions.checkState(isSent); Assertions.checkState(isSent);
isCanceled = true; isCanceled = true;
......
...@@ -55,6 +55,7 @@ import androidx.media3.exoplayer.upstream.BandwidthMeter; ...@@ -55,6 +55,7 @@ import androidx.media3.exoplayer.upstream.BandwidthMeter;
import androidx.media3.exoplayer.video.VideoFrameMetadataListener; import androidx.media3.exoplayer.video.VideoFrameMetadataListener;
import androidx.media3.exoplayer.video.spherical.CameraMotionListener; import androidx.media3.exoplayer.video.spherical.CameraMotionListener;
import androidx.media3.extractor.ExtractorsFactory; import androidx.media3.extractor.ExtractorsFactory;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.List; import java.util.List;
/** /**
...@@ -146,6 +147,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -146,6 +147,7 @@ public class SimpleExoPlayer extends BasePlayer
* @deprecated Use {@link ExoPlayer.Builder#experimentalSetForegroundModeTimeoutMs(long)} * @deprecated Use {@link ExoPlayer.Builder#experimentalSetForegroundModeTimeoutMs(long)}
* instead. * instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder experimentalSetForegroundModeTimeoutMs(long timeoutMs) { public Builder experimentalSetForegroundModeTimeoutMs(long timeoutMs) {
wrappedBuilder.experimentalSetForegroundModeTimeoutMs(timeoutMs); wrappedBuilder.experimentalSetForegroundModeTimeoutMs(timeoutMs);
...@@ -155,6 +157,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -155,6 +157,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setTrackSelector(TrackSelector)} instead. * @deprecated Use {@link ExoPlayer.Builder#setTrackSelector(TrackSelector)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setTrackSelector(TrackSelector trackSelector) { public Builder setTrackSelector(TrackSelector trackSelector) {
wrappedBuilder.setTrackSelector(trackSelector); wrappedBuilder.setTrackSelector(trackSelector);
...@@ -164,6 +167,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -164,6 +167,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setMediaSourceFactory(MediaSource.Factory)} instead. * @deprecated Use {@link ExoPlayer.Builder#setMediaSourceFactory(MediaSource.Factory)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setMediaSourceFactory(MediaSource.Factory mediaSourceFactory) { public Builder setMediaSourceFactory(MediaSource.Factory mediaSourceFactory) {
wrappedBuilder.setMediaSourceFactory(mediaSourceFactory); wrappedBuilder.setMediaSourceFactory(mediaSourceFactory);
...@@ -173,6 +177,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -173,6 +177,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setLoadControl(LoadControl)} instead. * @deprecated Use {@link ExoPlayer.Builder#setLoadControl(LoadControl)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setLoadControl(LoadControl loadControl) { public Builder setLoadControl(LoadControl loadControl) {
wrappedBuilder.setLoadControl(loadControl); wrappedBuilder.setLoadControl(loadControl);
...@@ -182,6 +187,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -182,6 +187,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setBandwidthMeter(BandwidthMeter)} instead. * @deprecated Use {@link ExoPlayer.Builder#setBandwidthMeter(BandwidthMeter)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setBandwidthMeter(BandwidthMeter bandwidthMeter) { public Builder setBandwidthMeter(BandwidthMeter bandwidthMeter) {
wrappedBuilder.setBandwidthMeter(bandwidthMeter); wrappedBuilder.setBandwidthMeter(bandwidthMeter);
...@@ -191,6 +197,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -191,6 +197,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setLooper(Looper)} instead. * @deprecated Use {@link ExoPlayer.Builder#setLooper(Looper)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setLooper(Looper looper) { public Builder setLooper(Looper looper) {
wrappedBuilder.setLooper(looper); wrappedBuilder.setLooper(looper);
...@@ -200,6 +207,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -200,6 +207,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setAnalyticsCollector(AnalyticsCollector)} instead. * @deprecated Use {@link ExoPlayer.Builder#setAnalyticsCollector(AnalyticsCollector)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setAnalyticsCollector(AnalyticsCollector analyticsCollector) { public Builder setAnalyticsCollector(AnalyticsCollector analyticsCollector) {
wrappedBuilder.setAnalyticsCollector(analyticsCollector); wrappedBuilder.setAnalyticsCollector(analyticsCollector);
...@@ -210,6 +218,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -210,6 +218,7 @@ public class SimpleExoPlayer extends BasePlayer
* @deprecated Use {@link ExoPlayer.Builder#setPriorityTaskManager(PriorityTaskManager)} * @deprecated Use {@link ExoPlayer.Builder#setPriorityTaskManager(PriorityTaskManager)}
* instead. * instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setPriorityTaskManager(@Nullable PriorityTaskManager priorityTaskManager) { public Builder setPriorityTaskManager(@Nullable PriorityTaskManager priorityTaskManager) {
wrappedBuilder.setPriorityTaskManager(priorityTaskManager); wrappedBuilder.setPriorityTaskManager(priorityTaskManager);
...@@ -220,6 +229,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -220,6 +229,7 @@ public class SimpleExoPlayer extends BasePlayer
* @deprecated Use {@link ExoPlayer.Builder#setAudioAttributes(AudioAttributes, boolean)} * @deprecated Use {@link ExoPlayer.Builder#setAudioAttributes(AudioAttributes, boolean)}
* instead. * instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus) { public Builder setAudioAttributes(AudioAttributes audioAttributes, boolean handleAudioFocus) {
wrappedBuilder.setAudioAttributes(audioAttributes, handleAudioFocus); wrappedBuilder.setAudioAttributes(audioAttributes, handleAudioFocus);
...@@ -229,6 +239,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -229,6 +239,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setWakeMode(int)} instead. * @deprecated Use {@link ExoPlayer.Builder#setWakeMode(int)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setWakeMode(@C.WakeMode int wakeMode) { public Builder setWakeMode(@C.WakeMode int wakeMode) {
wrappedBuilder.setWakeMode(wakeMode); wrappedBuilder.setWakeMode(wakeMode);
...@@ -238,6 +249,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -238,6 +249,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setHandleAudioBecomingNoisy(boolean)} instead. * @deprecated Use {@link ExoPlayer.Builder#setHandleAudioBecomingNoisy(boolean)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy) { public Builder setHandleAudioBecomingNoisy(boolean handleAudioBecomingNoisy) {
wrappedBuilder.setHandleAudioBecomingNoisy(handleAudioBecomingNoisy); wrappedBuilder.setHandleAudioBecomingNoisy(handleAudioBecomingNoisy);
...@@ -247,6 +259,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -247,6 +259,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setSkipSilenceEnabled(boolean)} instead. * @deprecated Use {@link ExoPlayer.Builder#setSkipSilenceEnabled(boolean)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setSkipSilenceEnabled(boolean skipSilenceEnabled) { public Builder setSkipSilenceEnabled(boolean skipSilenceEnabled) {
wrappedBuilder.setSkipSilenceEnabled(skipSilenceEnabled); wrappedBuilder.setSkipSilenceEnabled(skipSilenceEnabled);
...@@ -256,6 +269,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -256,6 +269,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setVideoScalingMode(int)} instead. * @deprecated Use {@link ExoPlayer.Builder#setVideoScalingMode(int)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setVideoScalingMode(@C.VideoScalingMode int videoScalingMode) { public Builder setVideoScalingMode(@C.VideoScalingMode int videoScalingMode) {
wrappedBuilder.setVideoScalingMode(videoScalingMode); wrappedBuilder.setVideoScalingMode(videoScalingMode);
...@@ -265,6 +279,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -265,6 +279,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setVideoChangeFrameRateStrategy(int)} instead. * @deprecated Use {@link ExoPlayer.Builder#setVideoChangeFrameRateStrategy(int)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setVideoChangeFrameRateStrategy( public Builder setVideoChangeFrameRateStrategy(
@C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy) { @C.VideoChangeFrameRateStrategy int videoChangeFrameRateStrategy) {
...@@ -275,6 +290,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -275,6 +290,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setUseLazyPreparation(boolean)} instead. * @deprecated Use {@link ExoPlayer.Builder#setUseLazyPreparation(boolean)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setUseLazyPreparation(boolean useLazyPreparation) { public Builder setUseLazyPreparation(boolean useLazyPreparation) {
wrappedBuilder.setUseLazyPreparation(useLazyPreparation); wrappedBuilder.setUseLazyPreparation(useLazyPreparation);
...@@ -284,6 +300,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -284,6 +300,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setSeekParameters(SeekParameters)} instead. * @deprecated Use {@link ExoPlayer.Builder#setSeekParameters(SeekParameters)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setSeekParameters(SeekParameters seekParameters) { public Builder setSeekParameters(SeekParameters seekParameters) {
wrappedBuilder.setSeekParameters(seekParameters); wrappedBuilder.setSeekParameters(seekParameters);
...@@ -293,6 +310,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -293,6 +310,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setSeekBackIncrementMs(long)} instead. * @deprecated Use {@link ExoPlayer.Builder#setSeekBackIncrementMs(long)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setSeekBackIncrementMs(@IntRange(from = 1) long seekBackIncrementMs) { public Builder setSeekBackIncrementMs(@IntRange(from = 1) long seekBackIncrementMs) {
wrappedBuilder.setSeekBackIncrementMs(seekBackIncrementMs); wrappedBuilder.setSeekBackIncrementMs(seekBackIncrementMs);
...@@ -302,6 +320,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -302,6 +320,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setSeekForwardIncrementMs(long)} instead. * @deprecated Use {@link ExoPlayer.Builder#setSeekForwardIncrementMs(long)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setSeekForwardIncrementMs(@IntRange(from = 1) long seekForwardIncrementMs) { public Builder setSeekForwardIncrementMs(@IntRange(from = 1) long seekForwardIncrementMs) {
wrappedBuilder.setSeekForwardIncrementMs(seekForwardIncrementMs); wrappedBuilder.setSeekForwardIncrementMs(seekForwardIncrementMs);
...@@ -311,6 +330,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -311,6 +330,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setReleaseTimeoutMs(long)} instead. * @deprecated Use {@link ExoPlayer.Builder#setReleaseTimeoutMs(long)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setReleaseTimeoutMs(long releaseTimeoutMs) { public Builder setReleaseTimeoutMs(long releaseTimeoutMs) {
wrappedBuilder.setReleaseTimeoutMs(releaseTimeoutMs); wrappedBuilder.setReleaseTimeoutMs(releaseTimeoutMs);
...@@ -320,6 +340,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -320,6 +340,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setDetachSurfaceTimeoutMs(long)} instead. * @deprecated Use {@link ExoPlayer.Builder#setDetachSurfaceTimeoutMs(long)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setDetachSurfaceTimeoutMs(long detachSurfaceTimeoutMs) { public Builder setDetachSurfaceTimeoutMs(long detachSurfaceTimeoutMs) {
wrappedBuilder.setDetachSurfaceTimeoutMs(detachSurfaceTimeoutMs); wrappedBuilder.setDetachSurfaceTimeoutMs(detachSurfaceTimeoutMs);
...@@ -329,6 +350,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -329,6 +350,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setPauseAtEndOfMediaItems(boolean)} instead. * @deprecated Use {@link ExoPlayer.Builder#setPauseAtEndOfMediaItems(boolean)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems) { public Builder setPauseAtEndOfMediaItems(boolean pauseAtEndOfMediaItems) {
wrappedBuilder.setPauseAtEndOfMediaItems(pauseAtEndOfMediaItems); wrappedBuilder.setPauseAtEndOfMediaItems(pauseAtEndOfMediaItems);
...@@ -339,6 +361,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -339,6 +361,7 @@ public class SimpleExoPlayer extends BasePlayer
* @deprecated Use {@link * @deprecated Use {@link
* ExoPlayer.Builder#setLivePlaybackSpeedControl(LivePlaybackSpeedControl)} instead. * ExoPlayer.Builder#setLivePlaybackSpeedControl(LivePlaybackSpeedControl)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Builder setLivePlaybackSpeedControl(LivePlaybackSpeedControl livePlaybackSpeedControl) { public Builder setLivePlaybackSpeedControl(LivePlaybackSpeedControl livePlaybackSpeedControl) {
wrappedBuilder.setLivePlaybackSpeedControl(livePlaybackSpeedControl); wrappedBuilder.setLivePlaybackSpeedControl(livePlaybackSpeedControl);
...@@ -348,6 +371,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -348,6 +371,7 @@ public class SimpleExoPlayer extends BasePlayer
/** /**
* @deprecated Use {@link ExoPlayer.Builder#setClock(Clock)} instead. * @deprecated Use {@link ExoPlayer.Builder#setClock(Clock)} instead.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
@VisibleForTesting @VisibleForTesting
public Builder setClock(Clock clock) { public Builder setClock(Clock clock) {
......
...@@ -56,6 +56,7 @@ import androidx.media3.extractor.Ac3Util; ...@@ -56,6 +56,7 @@ import androidx.media3.extractor.Ac3Util;
import androidx.media3.extractor.Ac4Util; import androidx.media3.extractor.Ac4Util;
import androidx.media3.extractor.DtsUtil; import androidx.media3.extractor.DtsUtil;
import androidx.media3.extractor.MpegAudioUtil; import androidx.media3.extractor.MpegAudioUtil;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.errorprone.annotations.InlineMe; import com.google.errorprone.annotations.InlineMe;
import com.google.errorprone.annotations.InlineMeValidationDisabled; import com.google.errorprone.annotations.InlineMeValidationDisabled;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
...@@ -286,6 +287,7 @@ public final class DefaultAudioSink implements AudioSink { ...@@ -286,6 +287,7 @@ public final class DefaultAudioSink implements AudioSink {
* *
* <p>Default is {@link AudioCapabilities#DEFAULT_AUDIO_CAPABILITIES}. * <p>Default is {@link AudioCapabilities#DEFAULT_AUDIO_CAPABILITIES}.
*/ */
@CanIgnoreReturnValue
public Builder setAudioCapabilities(AudioCapabilities audioCapabilities) { public Builder setAudioCapabilities(AudioCapabilities audioCapabilities) {
checkNotNull(audioCapabilities); checkNotNull(audioCapabilities);
this.audioCapabilities = audioCapabilities; this.audioCapabilities = audioCapabilities;
...@@ -299,6 +301,7 @@ public final class DefaultAudioSink implements AudioSink { ...@@ -299,6 +301,7 @@ public final class DefaultAudioSink implements AudioSink {
* *
* <p>The default value is an empty array. * <p>The default value is an empty array.
*/ */
@CanIgnoreReturnValue
public Builder setAudioProcessors(AudioProcessor[] audioProcessors) { public Builder setAudioProcessors(AudioProcessor[] audioProcessors) {
checkNotNull(audioProcessors); checkNotNull(audioProcessors);
return setAudioProcessorChain(new DefaultAudioProcessorChain(audioProcessors)); return setAudioProcessorChain(new DefaultAudioProcessorChain(audioProcessors));
...@@ -311,6 +314,7 @@ public final class DefaultAudioSink implements AudioSink { ...@@ -311,6 +314,7 @@ public final class DefaultAudioSink implements AudioSink {
* *
* <p>By default, no processing will be applied. * <p>By default, no processing will be applied.
*/ */
@CanIgnoreReturnValue
public Builder setAudioProcessorChain(AudioProcessorChain audioProcessorChain) { public Builder setAudioProcessorChain(AudioProcessorChain audioProcessorChain) {
checkNotNull(audioProcessorChain); checkNotNull(audioProcessorChain);
this.audioProcessorChain = audioProcessorChain; this.audioProcessorChain = audioProcessorChain;
...@@ -325,6 +329,7 @@ public final class DefaultAudioSink implements AudioSink { ...@@ -325,6 +329,7 @@ public final class DefaultAudioSink implements AudioSink {
* *
* <p>The default value is {@code false}. * <p>The default value is {@code false}.
*/ */
@CanIgnoreReturnValue
public Builder setEnableFloatOutput(boolean enableFloatOutput) { public Builder setEnableFloatOutput(boolean enableFloatOutput) {
this.enableFloatOutput = enableFloatOutput; this.enableFloatOutput = enableFloatOutput;
return this; return this;
...@@ -338,6 +343,7 @@ public final class DefaultAudioSink implements AudioSink { ...@@ -338,6 +343,7 @@ public final class DefaultAudioSink implements AudioSink {
* *
* <p>The default value is {@code false}. * <p>The default value is {@code false}.
*/ */
@CanIgnoreReturnValue
public Builder setEnableAudioTrackPlaybackParams(boolean enableAudioTrackPlaybackParams) { public Builder setEnableAudioTrackPlaybackParams(boolean enableAudioTrackPlaybackParams) {
this.enableAudioTrackPlaybackParams = enableAudioTrackPlaybackParams; this.enableAudioTrackPlaybackParams = enableAudioTrackPlaybackParams;
return this; return this;
...@@ -353,6 +359,7 @@ public final class DefaultAudioSink implements AudioSink { ...@@ -353,6 +359,7 @@ public final class DefaultAudioSink implements AudioSink {
* *
* <p>The default value is {@link #OFFLOAD_MODE_DISABLED}. * <p>The default value is {@link #OFFLOAD_MODE_DISABLED}.
*/ */
@CanIgnoreReturnValue
public Builder setOffloadMode(@OffloadMode int offloadMode) { public Builder setOffloadMode(@OffloadMode int offloadMode) {
this.offloadMode = offloadMode; this.offloadMode = offloadMode;
return this; return this;
...@@ -364,6 +371,7 @@ public final class DefaultAudioSink implements AudioSink { ...@@ -364,6 +371,7 @@ public final class DefaultAudioSink implements AudioSink {
* *
* <p>The default value is {@link AudioTrackBufferSizeProvider#DEFAULT}. * <p>The default value is {@link AudioTrackBufferSizeProvider#DEFAULT}.
*/ */
@CanIgnoreReturnValue
public Builder setAudioTrackBufferSizeProvider( public Builder setAudioTrackBufferSizeProvider(
AudioTrackBufferSizeProvider audioTrackBufferSizeProvider) { AudioTrackBufferSizeProvider audioTrackBufferSizeProvider) {
this.audioTrackBufferSizeProvider = audioTrackBufferSizeProvider; this.audioTrackBufferSizeProvider = audioTrackBufferSizeProvider;
......
...@@ -32,6 +32,7 @@ import androidx.media3.extractor.Ac3Util; ...@@ -32,6 +32,7 @@ import androidx.media3.extractor.Ac3Util;
import androidx.media3.extractor.Ac4Util; import androidx.media3.extractor.Ac4Util;
import androidx.media3.extractor.DtsUtil; import androidx.media3.extractor.DtsUtil;
import androidx.media3.extractor.MpegAudioUtil; import androidx.media3.extractor.MpegAudioUtil;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
/** Provide the buffer size to use when creating an {@link AudioTrack}. */ /** Provide the buffer size to use when creating an {@link AudioTrack}. */
@UnstableApi @UnstableApi
...@@ -78,6 +79,7 @@ public class DefaultAudioTrackBufferSizeProvider ...@@ -78,6 +79,7 @@ public class DefaultAudioTrackBufferSizeProvider
* Sets the minimum length for PCM {@link AudioTrack} buffers, in microseconds. Default is * Sets the minimum length for PCM {@link AudioTrack} buffers, in microseconds. Default is
* {@value #MIN_PCM_BUFFER_DURATION_US}. * {@value #MIN_PCM_BUFFER_DURATION_US}.
*/ */
@CanIgnoreReturnValue
public Builder setMinPcmBufferDurationUs(int minPcmBufferDurationUs) { public Builder setMinPcmBufferDurationUs(int minPcmBufferDurationUs) {
this.minPcmBufferDurationUs = minPcmBufferDurationUs; this.minPcmBufferDurationUs = minPcmBufferDurationUs;
return this; return this;
...@@ -87,6 +89,7 @@ public class DefaultAudioTrackBufferSizeProvider ...@@ -87,6 +89,7 @@ public class DefaultAudioTrackBufferSizeProvider
* Sets the maximum length for PCM {@link AudioTrack} buffers, in microseconds. Default is * Sets the maximum length for PCM {@link AudioTrack} buffers, in microseconds. Default is
* {@value #MAX_PCM_BUFFER_DURATION_US}. * {@value #MAX_PCM_BUFFER_DURATION_US}.
*/ */
@CanIgnoreReturnValue
public Builder setMaxPcmBufferDurationUs(int maxPcmBufferDurationUs) { public Builder setMaxPcmBufferDurationUs(int maxPcmBufferDurationUs) {
this.maxPcmBufferDurationUs = maxPcmBufferDurationUs; this.maxPcmBufferDurationUs = maxPcmBufferDurationUs;
return this; return this;
...@@ -96,6 +99,7 @@ public class DefaultAudioTrackBufferSizeProvider ...@@ -96,6 +99,7 @@ public class DefaultAudioTrackBufferSizeProvider
* Sets the multiplication factor to apply to the minimum buffer size requested. Default is * Sets the multiplication factor to apply to the minimum buffer size requested. Default is
* {@value #PCM_BUFFER_MULTIPLICATION_FACTOR}. * {@value #PCM_BUFFER_MULTIPLICATION_FACTOR}.
*/ */
@CanIgnoreReturnValue
public Builder setPcmBufferMultiplicationFactor(int pcmBufferMultiplicationFactor) { public Builder setPcmBufferMultiplicationFactor(int pcmBufferMultiplicationFactor) {
this.pcmBufferMultiplicationFactor = pcmBufferMultiplicationFactor; this.pcmBufferMultiplicationFactor = pcmBufferMultiplicationFactor;
return this; return this;
...@@ -105,6 +109,7 @@ public class DefaultAudioTrackBufferSizeProvider ...@@ -105,6 +109,7 @@ public class DefaultAudioTrackBufferSizeProvider
* Sets the length for passthrough {@link AudioTrack} buffers, in microseconds. Default is * Sets the length for passthrough {@link AudioTrack} buffers, in microseconds. Default is
* {@value #PASSTHROUGH_BUFFER_DURATION_US}. * {@value #PASSTHROUGH_BUFFER_DURATION_US}.
*/ */
@CanIgnoreReturnValue
public Builder setPassthroughBufferDurationUs(int passthroughBufferDurationUs) { public Builder setPassthroughBufferDurationUs(int passthroughBufferDurationUs) {
this.passthroughBufferDurationUs = passthroughBufferDurationUs; this.passthroughBufferDurationUs = passthroughBufferDurationUs;
return this; return this;
...@@ -114,6 +119,7 @@ public class DefaultAudioTrackBufferSizeProvider ...@@ -114,6 +119,7 @@ public class DefaultAudioTrackBufferSizeProvider
* The length for offload {@link AudioTrack} buffers, in microseconds. Default is {@value * The length for offload {@link AudioTrack} buffers, in microseconds. Default is {@value
* #OFFLOAD_BUFFER_DURATION_US}. * #OFFLOAD_BUFFER_DURATION_US}.
*/ */
@CanIgnoreReturnValue
public Builder setOffloadBufferDurationUs(int offloadBufferDurationUs) { public Builder setOffloadBufferDurationUs(int offloadBufferDurationUs) {
this.offloadBufferDurationUs = offloadBufferDurationUs; this.offloadBufferDurationUs = offloadBufferDurationUs;
return this; return this;
...@@ -123,6 +129,7 @@ public class DefaultAudioTrackBufferSizeProvider ...@@ -123,6 +129,7 @@ public class DefaultAudioTrackBufferSizeProvider
* Sets the multiplication factor to apply to the passthrough buffer for AC3 to avoid underruns * Sets the multiplication factor to apply to the passthrough buffer for AC3 to avoid underruns
* on some devices (e.g., Broadcom 7271). Default is {@value #AC3_BUFFER_MULTIPLICATION_FACTOR}. * on some devices (e.g., Broadcom 7271). Default is {@value #AC3_BUFFER_MULTIPLICATION_FACTOR}.
*/ */
@CanIgnoreReturnValue
public Builder setAc3BufferMultiplicationFactor(int ac3BufferMultiplicationFactor) { public Builder setAc3BufferMultiplicationFactor(int ac3BufferMultiplicationFactor) {
this.ac3BufferMultiplicationFactor = ac3BufferMultiplicationFactor; this.ac3BufferMultiplicationFactor = ac3BufferMultiplicationFactor;
return this; return this;
......
...@@ -47,6 +47,7 @@ import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy; ...@@ -47,6 +47,7 @@ import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -121,6 +122,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager { ...@@ -121,6 +122,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager {
* @param keyRequestParameters A map with parameters. * @param keyRequestParameters A map with parameters.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setKeyRequestParameters(@Nullable Map<String, String> keyRequestParameters) { public Builder setKeyRequestParameters(@Nullable Map<String, String> keyRequestParameters) {
this.keyRequestParameters.clear(); this.keyRequestParameters.clear();
if (keyRequestParameters != null) { if (keyRequestParameters != null) {
...@@ -136,6 +138,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager { ...@@ -136,6 +138,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager {
* @param exoMediaDrmProvider The {@link ExoMediaDrm.Provider}. * @param exoMediaDrmProvider The {@link ExoMediaDrm.Provider}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setUuidAndExoMediaDrmProvider( public Builder setUuidAndExoMediaDrmProvider(
UUID uuid, ExoMediaDrm.Provider exoMediaDrmProvider) { UUID uuid, ExoMediaDrm.Provider exoMediaDrmProvider) {
this.uuid = checkNotNull(uuid); this.uuid = checkNotNull(uuid);
...@@ -153,6 +156,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager { ...@@ -153,6 +156,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager {
* sessions. * sessions.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setMultiSession(boolean multiSession) { public Builder setMultiSession(boolean multiSession) {
this.multiSession = multiSession; this.multiSession = multiSession;
return this; return this;
...@@ -172,6 +176,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager { ...@@ -172,6 +176,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager {
* @throws IllegalArgumentException If {@code useDrmSessionsForClearContentTrackTypes} contains * @throws IllegalArgumentException If {@code useDrmSessionsForClearContentTrackTypes} contains
* track types other than {@link C#TRACK_TYPE_AUDIO} and {@link C#TRACK_TYPE_VIDEO}. * track types other than {@link C#TRACK_TYPE_AUDIO} and {@link C#TRACK_TYPE_VIDEO}.
*/ */
@CanIgnoreReturnValue
public Builder setUseDrmSessionsForClearContent( public Builder setUseDrmSessionsForClearContent(
@C.TrackType int... useDrmSessionsForClearContentTrackTypes) { @C.TrackType int... useDrmSessionsForClearContentTrackTypes) {
for (@C.TrackType int trackType : useDrmSessionsForClearContentTrackTypes) { for (@C.TrackType int trackType : useDrmSessionsForClearContentTrackTypes) {
...@@ -190,6 +195,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager { ...@@ -190,6 +195,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager {
* played when keys for the encrypted part of the content have yet to be loaded. * played when keys for the encrypted part of the content have yet to be loaded.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setPlayClearSamplesWithoutKeys(boolean playClearSamplesWithoutKeys) { public Builder setPlayClearSamplesWithoutKeys(boolean playClearSamplesWithoutKeys) {
this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys; this.playClearSamplesWithoutKeys = playClearSamplesWithoutKeys;
return this; return this;
...@@ -201,6 +207,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager { ...@@ -201,6 +207,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager {
* @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}. * @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) { public Builder setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
this.loadErrorHandlingPolicy = checkNotNull(loadErrorHandlingPolicy); this.loadErrorHandlingPolicy = checkNotNull(loadErrorHandlingPolicy);
return this; return this;
...@@ -221,6 +228,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager { ...@@ -221,6 +228,7 @@ public class DefaultDrmSessionManager implements DrmSessionManager {
* in milliseconds. Must be &gt; 0 or {@link C#TIME_UNSET} to disable keep-alive. * in milliseconds. Must be &gt; 0 or {@link C#TIME_UNSET} to disable keep-alive.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setSessionKeepaliveMs(long sessionKeepaliveMs) { public Builder setSessionKeepaliveMs(long sessionKeepaliveMs) {
checkArgument(sessionKeepaliveMs > 0 || sessionKeepaliveMs == C.TIME_UNSET); checkArgument(sessionKeepaliveMs > 0 || sessionKeepaliveMs == C.TIME_UNSET);
this.sessionKeepaliveMs = sessionKeepaliveMs; this.sessionKeepaliveMs = sessionKeepaliveMs;
......
...@@ -22,6 +22,7 @@ import androidx.media3.common.MimeTypes; ...@@ -22,6 +22,7 @@ import androidx.media3.common.MimeTypes;
import androidx.media3.common.util.Log; import androidx.media3.common.util.Log;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
...@@ -66,6 +67,7 @@ public final class DefaultMediaCodecAdapterFactory implements MediaCodecAdapter. ...@@ -66,6 +67,7 @@ public final class DefaultMediaCodecAdapterFactory implements MediaCodecAdapter.
* *
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultMediaCodecAdapterFactory forceEnableAsynchronous() { public DefaultMediaCodecAdapterFactory forceEnableAsynchronous() {
asynchronousMode = MODE_ENABLED; asynchronousMode = MODE_ENABLED;
return this; return this;
...@@ -76,6 +78,7 @@ public final class DefaultMediaCodecAdapterFactory implements MediaCodecAdapter. ...@@ -76,6 +78,7 @@ public final class DefaultMediaCodecAdapterFactory implements MediaCodecAdapter.
* *
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultMediaCodecAdapterFactory forceDisableAsynchronous() { public DefaultMediaCodecAdapterFactory forceDisableAsynchronous() {
asynchronousMode = MODE_DISABLED; asynchronousMode = MODE_DISABLED;
return this; return this;
......
...@@ -28,6 +28,7 @@ import androidx.media3.common.util.Assertions; ...@@ -28,6 +28,7 @@ import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -58,30 +59,35 @@ public final class DownloadRequest implements Parcelable { ...@@ -58,30 +59,35 @@ public final class DownloadRequest implements Parcelable {
} }
/** Sets the {@link DownloadRequest#mimeType}. */ /** Sets the {@link DownloadRequest#mimeType}. */
@CanIgnoreReturnValue
public Builder setMimeType(@Nullable String mimeType) { public Builder setMimeType(@Nullable String mimeType) {
this.mimeType = mimeType; this.mimeType = mimeType;
return this; return this;
} }
/** Sets the {@link DownloadRequest#streamKeys}. */ /** Sets the {@link DownloadRequest#streamKeys}. */
@CanIgnoreReturnValue
public Builder setStreamKeys(@Nullable List<StreamKey> streamKeys) { public Builder setStreamKeys(@Nullable List<StreamKey> streamKeys) {
this.streamKeys = streamKeys; this.streamKeys = streamKeys;
return this; return this;
} }
/** Sets the {@link DownloadRequest#keySetId}. */ /** Sets the {@link DownloadRequest#keySetId}. */
@CanIgnoreReturnValue
public Builder setKeySetId(@Nullable byte[] keySetId) { public Builder setKeySetId(@Nullable byte[] keySetId) {
this.keySetId = keySetId; this.keySetId = keySetId;
return this; return this;
} }
/** Sets the {@link DownloadRequest#customCacheKey}. */ /** Sets the {@link DownloadRequest#customCacheKey}. */
@CanIgnoreReturnValue
public Builder setCustomCacheKey(@Nullable String customCacheKey) { public Builder setCustomCacheKey(@Nullable String customCacheKey) {
this.customCacheKey = customCacheKey; this.customCacheKey = customCacheKey;
return this; return this;
} }
/** Sets the {@link DownloadRequest#data}. */ /** Sets the {@link DownloadRequest#data}. */
@CanIgnoreReturnValue
public Builder setData(@Nullable byte[] data) { public Builder setData(@Nullable byte[] data) {
this.data = data; this.data = data;
return this; return this;
......
...@@ -51,6 +51,7 @@ import androidx.media3.extractor.text.SubtitleExtractor; ...@@ -51,6 +51,7 @@ import androidx.media3.extractor.text.SubtitleExtractor;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.primitives.Ints; import com.google.common.primitives.Ints;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
...@@ -195,6 +196,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -195,6 +196,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* should be used for subtitles instead of {@link SingleSampleMediaSource}. * should be used for subtitles instead of {@link SingleSampleMediaSource}.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public DefaultMediaSourceFactory experimentalUseProgressiveMediaSourceForSubtitles( public DefaultMediaSourceFactory experimentalUseProgressiveMediaSourceForSubtitles(
boolean useProgressiveMediaSourceForSubtitles) { boolean useProgressiveMediaSourceForSubtitles) {
...@@ -214,6 +216,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -214,6 +216,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* @deprecated Use {@link #setLocalAdInsertionComponents(AdsLoader.Provider, AdViewProvider)} * @deprecated Use {@link #setLocalAdInsertionComponents(AdsLoader.Provider, AdViewProvider)}
* instead. * instead.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@Deprecated @Deprecated
public DefaultMediaSourceFactory setAdsLoaderProvider( public DefaultMediaSourceFactory setAdsLoaderProvider(
...@@ -233,6 +236,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -233,6 +236,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* @deprecated Use {@link #setLocalAdInsertionComponents(AdsLoader.Provider, AdViewProvider)} * @deprecated Use {@link #setLocalAdInsertionComponents(AdsLoader.Provider, AdViewProvider)}
* instead. * instead.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@Deprecated @Deprecated
public DefaultMediaSourceFactory setAdViewProvider(@Nullable AdViewProvider adViewProvider) { public DefaultMediaSourceFactory setAdViewProvider(@Nullable AdViewProvider adViewProvider) {
...@@ -251,6 +255,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -251,6 +255,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* @param adViewProvider A provider for information about views for the ad playback UI. * @param adViewProvider A provider for information about views for the ad playback UI.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultMediaSourceFactory setLocalAdInsertionComponents( public DefaultMediaSourceFactory setLocalAdInsertionComponents(
AdsLoader.Provider adsLoaderProvider, AdViewProvider adViewProvider) { AdsLoader.Provider adsLoaderProvider, AdViewProvider adViewProvider) {
this.adsLoaderProvider = checkNotNull(adsLoaderProvider); this.adsLoaderProvider = checkNotNull(adsLoaderProvider);
...@@ -267,6 +272,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -267,6 +272,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* *
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultMediaSourceFactory clearLocalAdInsertionComponents() { public DefaultMediaSourceFactory clearLocalAdInsertionComponents() {
this.adsLoaderProvider = null; this.adsLoaderProvider = null;
this.adViewProvider = null; this.adViewProvider = null;
...@@ -280,6 +286,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -280,6 +286,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* @param dataSourceFactory The {@link DataSource.Factory}. * @param dataSourceFactory The {@link DataSource.Factory}.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public DefaultMediaSourceFactory setDataSourceFactory(DataSource.Factory dataSourceFactory) { public DefaultMediaSourceFactory setDataSourceFactory(DataSource.Factory dataSourceFactory) {
this.dataSourceFactory = dataSourceFactory; this.dataSourceFactory = dataSourceFactory;
delegateFactoryLoader.setDataSourceFactory(dataSourceFactory); delegateFactoryLoader.setDataSourceFactory(dataSourceFactory);
...@@ -296,6 +303,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -296,6 +303,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* content, or {@code null} to remove a previously set {@link MediaSource.Factory}. * content, or {@code null} to remove a previously set {@link MediaSource.Factory}.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public DefaultMediaSourceFactory setServerSideAdInsertionMediaSourceFactory( public DefaultMediaSourceFactory setServerSideAdInsertionMediaSourceFactory(
@Nullable MediaSource.Factory serverSideAdInsertionMediaSourceFactory) { @Nullable MediaSource.Factory serverSideAdInsertionMediaSourceFactory) {
...@@ -310,6 +318,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -310,6 +318,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* use the media-defined default. * use the media-defined default.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public DefaultMediaSourceFactory setLiveTargetOffsetMs(long liveTargetOffsetMs) { public DefaultMediaSourceFactory setLiveTargetOffsetMs(long liveTargetOffsetMs) {
this.liveTargetOffsetMs = liveTargetOffsetMs; this.liveTargetOffsetMs = liveTargetOffsetMs;
...@@ -323,6 +332,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -323,6 +332,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* C#TIME_UNSET} to use the media-defined default. * C#TIME_UNSET} to use the media-defined default.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public DefaultMediaSourceFactory setLiveMinOffsetMs(long liveMinOffsetMs) { public DefaultMediaSourceFactory setLiveMinOffsetMs(long liveMinOffsetMs) {
this.liveMinOffsetMs = liveMinOffsetMs; this.liveMinOffsetMs = liveMinOffsetMs;
...@@ -336,6 +346,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -336,6 +346,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* C#TIME_UNSET} to use the media-defined default. * C#TIME_UNSET} to use the media-defined default.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public DefaultMediaSourceFactory setLiveMaxOffsetMs(long liveMaxOffsetMs) { public DefaultMediaSourceFactory setLiveMaxOffsetMs(long liveMaxOffsetMs) {
this.liveMaxOffsetMs = liveMaxOffsetMs; this.liveMaxOffsetMs = liveMaxOffsetMs;
...@@ -349,6 +360,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -349,6 +360,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* C#RATE_UNSET} to use the media-defined default. * C#RATE_UNSET} to use the media-defined default.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public DefaultMediaSourceFactory setLiveMinSpeed(float minSpeed) { public DefaultMediaSourceFactory setLiveMinSpeed(float minSpeed) {
this.liveMinSpeed = minSpeed; this.liveMinSpeed = minSpeed;
...@@ -362,12 +374,14 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -362,12 +374,14 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
* C#RATE_UNSET} to use the media-defined default. * C#RATE_UNSET} to use the media-defined default.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public DefaultMediaSourceFactory setLiveMaxSpeed(float maxSpeed) { public DefaultMediaSourceFactory setLiveMaxSpeed(float maxSpeed) {
this.liveMaxSpeed = maxSpeed; this.liveMaxSpeed = maxSpeed;
return this; return this;
} }
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@Override @Override
public DefaultMediaSourceFactory setDrmSessionManagerProvider( public DefaultMediaSourceFactory setDrmSessionManagerProvider(
...@@ -381,6 +395,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory { ...@@ -381,6 +395,7 @@ public final class DefaultMediaSourceFactory implements MediaSourceFactory {
return this; return this;
} }
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
@Override @Override
public DefaultMediaSourceFactory setLoadErrorHandlingPolicy( public DefaultMediaSourceFactory setLoadErrorHandlingPolicy(
......
...@@ -35,6 +35,7 @@ import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy; ...@@ -35,6 +35,7 @@ import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
import androidx.media3.extractor.DefaultExtractorsFactory; import androidx.media3.extractor.DefaultExtractorsFactory;
import androidx.media3.extractor.Extractor; import androidx.media3.extractor.Extractor;
import androidx.media3.extractor.ExtractorsFactory; import androidx.media3.extractor.ExtractorsFactory;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
/** /**
* Provides one period that loads data from a {@link Uri} and extracted using an {@link Extractor}. * Provides one period that loads data from a {@link Uri} and extracted using an {@link Extractor}.
...@@ -155,6 +156,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource ...@@ -155,6 +156,7 @@ public final class ProgressiveMediaSource extends BaseMediaSource
this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes;
} }
@CanIgnoreReturnValue
@Override @Override
public Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) { public Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
this.loadErrorHandlingPolicy = this.loadErrorHandlingPolicy =
...@@ -176,11 +178,13 @@ public final class ProgressiveMediaSource extends BaseMediaSource ...@@ -176,11 +178,13 @@ public final class ProgressiveMediaSource extends BaseMediaSource
* MediaPeriod.Callback#onContinueLoadingRequested(SequenceableLoader)}. * MediaPeriod.Callback#onContinueLoadingRequested(SequenceableLoader)}.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setContinueLoadingCheckIntervalBytes(int continueLoadingCheckIntervalBytes) { public Factory setContinueLoadingCheckIntervalBytes(int continueLoadingCheckIntervalBytes) {
this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes; this.continueLoadingCheckIntervalBytes = continueLoadingCheckIntervalBytes;
return this; return this;
} }
@CanIgnoreReturnValue
@Override @Override
public Factory setDrmSessionManagerProvider( public Factory setDrmSessionManagerProvider(
DrmSessionManagerProvider drmSessionManagerProvider) { DrmSessionManagerProvider drmSessionManagerProvider) {
......
...@@ -35,6 +35,7 @@ import androidx.media3.exoplayer.FormatHolder; ...@@ -35,6 +35,7 @@ import androidx.media3.exoplayer.FormatHolder;
import androidx.media3.exoplayer.SeekParameters; import androidx.media3.exoplayer.SeekParameters;
import androidx.media3.exoplayer.trackselection.ExoTrackSelection; import androidx.media3.exoplayer.trackselection.ExoTrackSelection;
import androidx.media3.exoplayer.upstream.Allocator; import androidx.media3.exoplayer.upstream.Allocator;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.ArrayList; import java.util.ArrayList;
import org.checkerframework.checker.nullness.compatqual.NullableType; import org.checkerframework.checker.nullness.compatqual.NullableType;
...@@ -54,6 +55,7 @@ public final class SilenceMediaSource extends BaseMediaSource { ...@@ -54,6 +55,7 @@ public final class SilenceMediaSource extends BaseMediaSource {
* @param durationUs The duration of silent audio to output, in microseconds. * @param durationUs The duration of silent audio to output, in microseconds.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setDurationUs(@IntRange(from = 1) long durationUs) { public Factory setDurationUs(@IntRange(from = 1) long durationUs) {
this.durationUs = durationUs; this.durationUs = durationUs;
return this; return this;
...@@ -66,6 +68,7 @@ public final class SilenceMediaSource extends BaseMediaSource { ...@@ -66,6 +68,7 @@ public final class SilenceMediaSource extends BaseMediaSource {
* @param tag A tag for the media source. * @param tag A tag for the media source.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setTag(@Nullable Object tag) { public Factory setTag(@Nullable Object tag) {
this.tag = tag; this.tag = tag;
return this; return this;
......
...@@ -32,6 +32,7 @@ import androidx.media3.exoplayer.upstream.Allocator; ...@@ -32,6 +32,7 @@ import androidx.media3.exoplayer.upstream.Allocator;
import androidx.media3.exoplayer.upstream.DefaultLoadErrorHandlingPolicy; import androidx.media3.exoplayer.upstream.DefaultLoadErrorHandlingPolicy;
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy; import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
/** /**
* Loads data at a given {@link Uri} as a single sample belonging to a single {@link MediaPeriod}. * Loads data at a given {@link Uri} as a single sample belonging to a single {@link MediaPeriod}.
...@@ -68,6 +69,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource { ...@@ -68,6 +69,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
* @param tag A tag for the media source. * @param tag A tag for the media source.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setTag(@Nullable Object tag) { public Factory setTag(@Nullable Object tag) {
this.tag = tag; this.tag = tag;
return this; return this;
...@@ -79,6 +81,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource { ...@@ -79,6 +81,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
* #createMediaSource(MediaItem.SubtitleConfiguration, long)}). {@code trackId} will only be * #createMediaSource(MediaItem.SubtitleConfiguration, long)}). {@code trackId} will only be
* used if {@link MediaItem.SubtitleConfiguration#id} is {@code null}. * used if {@link MediaItem.SubtitleConfiguration#id} is {@code null}.
*/ */
@CanIgnoreReturnValue
@Deprecated @Deprecated
public Factory setTrackId(@Nullable String trackId) { public Factory setTrackId(@Nullable String trackId) {
this.trackId = trackId; this.trackId = trackId;
...@@ -92,6 +95,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource { ...@@ -92,6 +95,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
* @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}. * @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setLoadErrorHandlingPolicy( public Factory setLoadErrorHandlingPolicy(
@Nullable LoadErrorHandlingPolicy loadErrorHandlingPolicy) { @Nullable LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
this.loadErrorHandlingPolicy = this.loadErrorHandlingPolicy =
...@@ -110,6 +114,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource { ...@@ -110,6 +114,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
* normally by {@link SampleStream#maybeThrowError()}. * normally by {@link SampleStream#maybeThrowError()}.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setTreatLoadErrorsAsEndOfStream(boolean treatLoadErrorsAsEndOfStream) { public Factory setTreatLoadErrorsAsEndOfStream(boolean treatLoadErrorsAsEndOfStream) {
this.treatLoadErrorsAsEndOfStream = treatLoadErrorsAsEndOfStream; this.treatLoadErrorsAsEndOfStream = treatLoadErrorsAsEndOfStream;
return this; return this;
......
...@@ -31,6 +31,7 @@ import androidx.media3.exoplayer.upstream.BandwidthMeter.EventListener.EventDisp ...@@ -31,6 +31,7 @@ import androidx.media3.exoplayer.upstream.BandwidthMeter.EventListener.EventDisp
import com.google.common.base.Ascii; import com.google.common.base.Ascii;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -141,6 +142,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList ...@@ -141,6 +142,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
* @param slidingWindowMaxWeight The maximum weight for the sliding window. * @param slidingWindowMaxWeight The maximum weight for the sliding window.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setSlidingWindowMaxWeight(int slidingWindowMaxWeight) { public Builder setSlidingWindowMaxWeight(int slidingWindowMaxWeight) {
this.slidingWindowMaxWeight = slidingWindowMaxWeight; this.slidingWindowMaxWeight = slidingWindowMaxWeight;
return this; return this;
...@@ -153,6 +155,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList ...@@ -153,6 +155,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
* @param initialBitrateEstimate The initial bitrate estimate in bits per second. * @param initialBitrateEstimate The initial bitrate estimate in bits per second.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setInitialBitrateEstimate(long initialBitrateEstimate) { public Builder setInitialBitrateEstimate(long initialBitrateEstimate) {
for (Integer networkType : initialBitrateEstimates.keySet()) { for (Integer networkType : initialBitrateEstimates.keySet()) {
setInitialBitrateEstimate(networkType, initialBitrateEstimate); setInitialBitrateEstimate(networkType, initialBitrateEstimate);
...@@ -168,6 +171,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList ...@@ -168,6 +171,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
* @param initialBitrateEstimate The initial bitrate estimate in bits per second. * @param initialBitrateEstimate The initial bitrate estimate in bits per second.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setInitialBitrateEstimate( public Builder setInitialBitrateEstimate(
@C.NetworkType int networkType, long initialBitrateEstimate) { @C.NetworkType int networkType, long initialBitrateEstimate) {
initialBitrateEstimates.put(networkType, initialBitrateEstimate); initialBitrateEstimates.put(networkType, initialBitrateEstimate);
...@@ -182,6 +186,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList ...@@ -182,6 +186,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
* estimates should be used. * estimates should be used.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setInitialBitrateEstimate(String countryCode) { public Builder setInitialBitrateEstimate(String countryCode) {
initialBitrateEstimates = initialBitrateEstimates =
getInitialBitrateEstimatesForCountry(Ascii.toUpperCase(countryCode)); getInitialBitrateEstimatesForCountry(Ascii.toUpperCase(countryCode));
...@@ -195,6 +200,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList ...@@ -195,6 +200,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
* @param clock The clock used to estimate bandwidth from data transfers. * @param clock The clock used to estimate bandwidth from data transfers.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setClock(Clock clock) { public Builder setClock(Clock clock) {
this.clock = clock; this.clock = clock;
return this; return this;
...@@ -206,6 +212,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList ...@@ -206,6 +212,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
* @param resetOnNetworkTypeChange Whether to reset if the network type changes. * @param resetOnNetworkTypeChange Whether to reset if the network type changes.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setResetOnNetworkTypeChange(boolean resetOnNetworkTypeChange) { public Builder setResetOnNetworkTypeChange(boolean resetOnNetworkTypeChange) {
this.resetOnNetworkTypeChange = resetOnNetworkTypeChange; this.resetOnNetworkTypeChange = resetOnNetworkTypeChange;
return this; return this;
......
...@@ -165,6 +165,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; ...@@ -165,6 +165,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Range; import com.google.common.collect.Range;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -12193,6 +12194,7 @@ public final class ExoPlayerTest { ...@@ -12193,6 +12194,7 @@ public final class ExoPlayerTest {
} }
/** Call {@link Renderer.WakeupListener#onSleep()} on the next {@link #render(long, long)} */ /** Call {@link Renderer.WakeupListener#onSleep()} on the next {@link #render(long, long)} */
@CanIgnoreReturnValue
public FakeSleepRenderer sleepOnNextRender() { public FakeSleepRenderer sleepOnNextRender() {
sleepOnNextRender.set(true); sleepOnNextRender.set(true);
return this; return this;
......
...@@ -25,6 +25,7 @@ android { ...@@ -25,6 +25,7 @@ android {
dependencies { dependencies {
implementation project(modulePrefix + 'lib-exoplayer') implementation project(modulePrefix + 'lib-exoplayer')
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
......
...@@ -77,6 +77,7 @@ import androidx.media3.exoplayer.upstream.ParsingLoadable; ...@@ -77,6 +77,7 @@ import androidx.media3.exoplayer.upstream.ParsingLoadable;
import androidx.media3.exoplayer.util.SntpClient; import androidx.media3.exoplayer.util.SntpClient;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.math.LongMath; import com.google.common.math.LongMath;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
...@@ -158,6 +159,7 @@ public final class DashMediaSource extends BaseMediaSource { ...@@ -158,6 +159,7 @@ public final class DashMediaSource extends BaseMediaSource {
compositeSequenceableLoaderFactory = new DefaultCompositeSequenceableLoaderFactory(); compositeSequenceableLoaderFactory = new DefaultCompositeSequenceableLoaderFactory();
} }
@CanIgnoreReturnValue
@Override @Override
public Factory setDrmSessionManagerProvider( public Factory setDrmSessionManagerProvider(
DrmSessionManagerProvider drmSessionManagerProvider) { DrmSessionManagerProvider drmSessionManagerProvider) {
...@@ -170,6 +172,7 @@ public final class DashMediaSource extends BaseMediaSource { ...@@ -170,6 +172,7 @@ public final class DashMediaSource extends BaseMediaSource {
return this; return this;
} }
@CanIgnoreReturnValue
@Override @Override
public Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) { public Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
this.loadErrorHandlingPolicy = this.loadErrorHandlingPolicy =
...@@ -190,6 +193,7 @@ public final class DashMediaSource extends BaseMediaSource { ...@@ -190,6 +193,7 @@ public final class DashMediaSource extends BaseMediaSource {
* @param fallbackTargetLiveOffsetMs The fallback live target offset in milliseconds. * @param fallbackTargetLiveOffsetMs The fallback live target offset in milliseconds.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setFallbackTargetLiveOffsetMs(long fallbackTargetLiveOffsetMs) { public Factory setFallbackTargetLiveOffsetMs(long fallbackTargetLiveOffsetMs) {
this.fallbackTargetLiveOffsetMs = fallbackTargetLiveOffsetMs; this.fallbackTargetLiveOffsetMs = fallbackTargetLiveOffsetMs;
return this; return this;
...@@ -201,6 +205,7 @@ public final class DashMediaSource extends BaseMediaSource { ...@@ -201,6 +205,7 @@ public final class DashMediaSource extends BaseMediaSource {
* @param manifestParser A parser for loaded manifest data. * @param manifestParser A parser for loaded manifest data.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setManifestParser( public Factory setManifestParser(
@Nullable ParsingLoadable.Parser<? extends DashManifest> manifestParser) { @Nullable ParsingLoadable.Parser<? extends DashManifest> manifestParser) {
this.manifestParser = manifestParser; this.manifestParser = manifestParser;
...@@ -217,6 +222,7 @@ public final class DashMediaSource extends BaseMediaSource { ...@@ -217,6 +222,7 @@ public final class DashMediaSource extends BaseMediaSource {
* audio etc...). * audio etc...).
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setCompositeSequenceableLoaderFactory( public Factory setCompositeSequenceableLoaderFactory(
CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) { CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) {
this.compositeSequenceableLoaderFactory = this.compositeSequenceableLoaderFactory =
......
...@@ -25,6 +25,7 @@ android { ...@@ -25,6 +25,7 @@ android {
dependencies { dependencies {
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
......
...@@ -56,6 +56,7 @@ import androidx.media3.exoplayer.upstream.Allocator; ...@@ -56,6 +56,7 @@ import androidx.media3.exoplayer.upstream.Allocator;
import androidx.media3.exoplayer.upstream.DefaultLoadErrorHandlingPolicy; import androidx.media3.exoplayer.upstream.DefaultLoadErrorHandlingPolicy;
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy; import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
import androidx.media3.extractor.Extractor; import androidx.media3.extractor.Extractor;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
...@@ -171,12 +172,14 @@ public final class HlsMediaSource extends BaseMediaSource ...@@ -171,12 +172,14 @@ public final class HlsMediaSource extends BaseMediaSource
* segments. * segments.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setExtractorFactory(@Nullable HlsExtractorFactory extractorFactory) { public Factory setExtractorFactory(@Nullable HlsExtractorFactory extractorFactory) {
this.extractorFactory = this.extractorFactory =
extractorFactory != null ? extractorFactory : HlsExtractorFactory.DEFAULT; extractorFactory != null ? extractorFactory : HlsExtractorFactory.DEFAULT;
return this; return this;
} }
@CanIgnoreReturnValue
@Override @Override
public Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) { public Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
this.loadErrorHandlingPolicy = this.loadErrorHandlingPolicy =
...@@ -194,6 +197,7 @@ public final class HlsMediaSource extends BaseMediaSource ...@@ -194,6 +197,7 @@ public final class HlsMediaSource extends BaseMediaSource
* @param playlistParserFactory An {@link HlsPlaylistParserFactory}. * @param playlistParserFactory An {@link HlsPlaylistParserFactory}.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setPlaylistParserFactory(HlsPlaylistParserFactory playlistParserFactory) { public Factory setPlaylistParserFactory(HlsPlaylistParserFactory playlistParserFactory) {
this.playlistParserFactory = this.playlistParserFactory =
checkNotNull( checkNotNull(
...@@ -210,6 +214,7 @@ public final class HlsMediaSource extends BaseMediaSource ...@@ -210,6 +214,7 @@ public final class HlsMediaSource extends BaseMediaSource
* @param playlistTrackerFactory A factory for {@link HlsPlaylistTracker} instances. * @param playlistTrackerFactory A factory for {@link HlsPlaylistTracker} instances.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setPlaylistTrackerFactory(HlsPlaylistTracker.Factory playlistTrackerFactory) { public Factory setPlaylistTrackerFactory(HlsPlaylistTracker.Factory playlistTrackerFactory) {
this.playlistTrackerFactory = this.playlistTrackerFactory =
checkNotNull( checkNotNull(
...@@ -229,6 +234,7 @@ public final class HlsMediaSource extends BaseMediaSource ...@@ -229,6 +234,7 @@ public final class HlsMediaSource extends BaseMediaSource
* audio etc...). * audio etc...).
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setCompositeSequenceableLoaderFactory( public Factory setCompositeSequenceableLoaderFactory(
CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) { CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) {
this.compositeSequenceableLoaderFactory = this.compositeSequenceableLoaderFactory =
...@@ -248,6 +254,7 @@ public final class HlsMediaSource extends BaseMediaSource ...@@ -248,6 +254,7 @@ public final class HlsMediaSource extends BaseMediaSource
* @param allowChunklessPreparation Whether chunkless preparation is allowed. * @param allowChunklessPreparation Whether chunkless preparation is allowed.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setAllowChunklessPreparation(boolean allowChunklessPreparation) { public Factory setAllowChunklessPreparation(boolean allowChunklessPreparation) {
this.allowChunklessPreparation = allowChunklessPreparation; this.allowChunklessPreparation = allowChunklessPreparation;
return this; return this;
...@@ -272,6 +279,7 @@ public final class HlsMediaSource extends BaseMediaSource ...@@ -272,6 +279,7 @@ public final class HlsMediaSource extends BaseMediaSource
* @param metadataType The type of metadata to extract. * @param metadataType The type of metadata to extract.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setMetadataType(@MetadataType int metadataType) { public Factory setMetadataType(@MetadataType int metadataType) {
this.metadataType = metadataType; this.metadataType = metadataType;
return this; return this;
...@@ -286,11 +294,13 @@ public final class HlsMediaSource extends BaseMediaSource ...@@ -286,11 +294,13 @@ public final class HlsMediaSource extends BaseMediaSource
* @param useSessionKeys Whether to use #EXT-X-SESSION-KEY tags. * @param useSessionKeys Whether to use #EXT-X-SESSION-KEY tags.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setUseSessionKeys(boolean useSessionKeys) { public Factory setUseSessionKeys(boolean useSessionKeys) {
this.useSessionKeys = useSessionKeys; this.useSessionKeys = useSessionKeys;
return this; return this;
} }
@CanIgnoreReturnValue
@Override @Override
public Factory setDrmSessionManagerProvider( public Factory setDrmSessionManagerProvider(
DrmSessionManagerProvider drmSessionManagerProvider) { DrmSessionManagerProvider drmSessionManagerProvider) {
...@@ -311,6 +321,7 @@ public final class HlsMediaSource extends BaseMediaSource ...@@ -311,6 +321,7 @@ public final class HlsMediaSource extends BaseMediaSource
* the time since the Unix epoch, in milliseconds. * the time since the Unix epoch, in milliseconds.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
@VisibleForTesting @VisibleForTesting
/* package */ Factory setElapsedRealTimeOffsetMs(long elapsedRealTimeOffsetMs) { /* package */ Factory setElapsedRealTimeOffsetMs(long elapsedRealTimeOffsetMs) {
this.elapsedRealTimeOffsetMs = elapsedRealTimeOffsetMs; this.elapsedRealTimeOffsetMs = elapsedRealTimeOffsetMs;
......
...@@ -28,6 +28,7 @@ dependencies { ...@@ -28,6 +28,7 @@ dependencies {
api 'com.google.ads.interactivemedia.v3:interactivemedia:3.26.0' api 'com.google.ads.interactivemedia.v3:interactivemedia:3.26.0'
implementation project(modulePrefix + 'lib-exoplayer') implementation project(modulePrefix + 'lib-exoplayer')
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
androidTestImplementation project(modulePrefix + 'test-utils') androidTestImplementation project(modulePrefix + 'test-utils')
......
...@@ -56,6 +56,7 @@ import com.google.ads.interactivemedia.v3.api.UiElement; ...@@ -56,6 +56,7 @@ import com.google.ads.interactivemedia.v3.api.UiElement;
import com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer; import com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
...@@ -152,6 +153,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -152,6 +153,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @param imaSdkSettings The {@link ImaSdkSettings}. * @param imaSdkSettings The {@link ImaSdkSettings}.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setImaSdkSettings(ImaSdkSettings imaSdkSettings) { public Builder setImaSdkSettings(ImaSdkSettings imaSdkSettings) {
this.imaSdkSettings = checkNotNull(imaSdkSettings); this.imaSdkSettings = checkNotNull(imaSdkSettings);
...@@ -166,6 +168,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -166,6 +168,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @param adErrorListener The ad error listener. * @param adErrorListener The ad error listener.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setAdErrorListener(AdErrorListener adErrorListener) { public Builder setAdErrorListener(AdErrorListener adErrorListener) {
this.adErrorListener = checkNotNull(adErrorListener); this.adErrorListener = checkNotNull(adErrorListener);
...@@ -179,6 +182,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -179,6 +182,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @param adEventListener The ad event listener. * @param adEventListener The ad event listener.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setAdEventListener(AdEventListener adEventListener) { public Builder setAdEventListener(AdEventListener adEventListener) {
this.adEventListener = checkNotNull(adEventListener); this.adEventListener = checkNotNull(adEventListener);
...@@ -195,6 +199,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -195,6 +199,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @return This builder, for convenience. * @return This builder, for convenience.
* @see com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback * @see com.google.ads.interactivemedia.v3.api.player.VideoAdPlayer.VideoAdPlayerCallback
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setVideoAdPlayerCallback( public Builder setVideoAdPlayerCallback(
VideoAdPlayer.VideoAdPlayerCallback videoAdPlayerCallback) { VideoAdPlayer.VideoAdPlayerCallback videoAdPlayerCallback) {
...@@ -209,6 +214,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -209,6 +214,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @return This builder, for convenience. * @return This builder, for convenience.
* @see AdsRenderingSettings#setUiElements(Set) * @see AdsRenderingSettings#setUiElements(Set)
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setAdUiElements(Set<UiElement> adUiElements) { public Builder setAdUiElements(Set<UiElement> adUiElements) {
this.adUiElements = ImmutableSet.copyOf(checkNotNull(adUiElements)); this.adUiElements = ImmutableSet.copyOf(checkNotNull(adUiElements));
...@@ -222,6 +228,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -222,6 +228,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @return This builder, for convenience. * @return This builder, for convenience.
* @see AdDisplayContainer#setCompanionSlots(Collection) * @see AdDisplayContainer#setCompanionSlots(Collection)
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setCompanionAdSlots(Collection<CompanionAdSlot> companionAdSlots) { public Builder setCompanionAdSlots(Collection<CompanionAdSlot> companionAdSlots) {
this.companionAdSlots = ImmutableList.copyOf(checkNotNull(companionAdSlots)); this.companionAdSlots = ImmutableList.copyOf(checkNotNull(companionAdSlots));
...@@ -240,6 +247,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -240,6 +247,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @return This builder, for convenience. * @return This builder, for convenience.
* @see AdsRenderingSettings#setMimeTypes(List) * @see AdsRenderingSettings#setMimeTypes(List)
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setAdMediaMimeTypes(List<String> adMediaMimeTypes) { public Builder setAdMediaMimeTypes(List<String> adMediaMimeTypes) {
this.adMediaMimeTypes = ImmutableList.copyOf(checkNotNull(adMediaMimeTypes)); this.adMediaMimeTypes = ImmutableList.copyOf(checkNotNull(adMediaMimeTypes));
...@@ -255,6 +263,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -255,6 +263,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @return This builder, for convenience. * @return This builder, for convenience.
* @see AdsRequest#setContinuousPlayback(boolean) * @see AdsRequest#setContinuousPlayback(boolean)
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setEnableContinuousPlayback(boolean enableContinuousPlayback) { public Builder setEnableContinuousPlayback(boolean enableContinuousPlayback) {
this.enableContinuousPlayback = enableContinuousPlayback; this.enableContinuousPlayback = enableContinuousPlayback;
...@@ -274,6 +283,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -274,6 +283,7 @@ public final class ImaAdsLoader implements AdsLoader {
* C#TIME_UNSET} for no timeout. * C#TIME_UNSET} for no timeout.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setAdPreloadTimeoutMs(long adPreloadTimeoutMs) { public Builder setAdPreloadTimeoutMs(long adPreloadTimeoutMs) {
checkArgument(adPreloadTimeoutMs == C.TIME_UNSET || adPreloadTimeoutMs > 0); checkArgument(adPreloadTimeoutMs == C.TIME_UNSET || adPreloadTimeoutMs > 0);
...@@ -288,6 +298,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -288,6 +298,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @return This builder, for convenience. * @return This builder, for convenience.
* @see AdsRequest#setVastLoadTimeout(float) * @see AdsRequest#setVastLoadTimeout(float)
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setVastLoadTimeoutMs(@IntRange(from = 1) int vastLoadTimeoutMs) { public Builder setVastLoadTimeoutMs(@IntRange(from = 1) int vastLoadTimeoutMs) {
checkArgument(vastLoadTimeoutMs > 0); checkArgument(vastLoadTimeoutMs > 0);
...@@ -302,6 +313,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -302,6 +313,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @return This builder, for convenience. * @return This builder, for convenience.
* @see AdsRenderingSettings#setLoadVideoTimeout(int) * @see AdsRenderingSettings#setLoadVideoTimeout(int)
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setMediaLoadTimeoutMs(@IntRange(from = 1) int mediaLoadTimeoutMs) { public Builder setMediaLoadTimeoutMs(@IntRange(from = 1) int mediaLoadTimeoutMs) {
checkArgument(mediaLoadTimeoutMs > 0); checkArgument(mediaLoadTimeoutMs > 0);
...@@ -316,6 +328,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -316,6 +328,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @return This builder, for convenience. * @return This builder, for convenience.
* @see AdsRenderingSettings#setBitrateKbps(int) * @see AdsRenderingSettings#setBitrateKbps(int)
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setMaxMediaBitrate(@IntRange(from = 1) int bitrate) { public Builder setMaxMediaBitrate(@IntRange(from = 1) int bitrate) {
checkArgument(bitrate > 0); checkArgument(bitrate > 0);
...@@ -332,6 +345,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -332,6 +345,7 @@ public final class ImaAdsLoader implements AdsLoader {
* @return This builder, for convenience. * @return This builder, for convenience.
* @see AdsRenderingSettings#setFocusSkipButtonWhenAvailable(boolean) * @see AdsRenderingSettings#setFocusSkipButtonWhenAvailable(boolean)
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setFocusSkipButtonWhenAvailable(boolean focusSkipButtonWhenAvailable) { public Builder setFocusSkipButtonWhenAvailable(boolean focusSkipButtonWhenAvailable) {
this.focusSkipButtonWhenAvailable = focusSkipButtonWhenAvailable; this.focusSkipButtonWhenAvailable = focusSkipButtonWhenAvailable;
...@@ -348,6 +362,7 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -348,6 +362,7 @@ public final class ImaAdsLoader implements AdsLoader {
* beginning playback. * beginning playback.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setPlayAdBeforeStartPosition(boolean playAdBeforeStartPosition) { public Builder setPlayAdBeforeStartPosition(boolean playAdBeforeStartPosition) {
this.playAdBeforeStartPosition = playAdBeforeStartPosition; this.playAdBeforeStartPosition = playAdBeforeStartPosition;
...@@ -364,12 +379,14 @@ public final class ImaAdsLoader implements AdsLoader { ...@@ -364,12 +379,14 @@ public final class ImaAdsLoader implements AdsLoader {
* @return This builder, for convenience. * @return This builder, for convenience.
* @see ImaSdkSettings#setDebugMode(boolean) * @see ImaSdkSettings#setDebugMode(boolean)
*/ */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setDebugModeEnabled(boolean debugModeEnabled) { public Builder setDebugModeEnabled(boolean debugModeEnabled) {
this.debugModeEnabled = debugModeEnabled; this.debugModeEnabled = debugModeEnabled;
return this; return this;
} }
@CanIgnoreReturnValue
@VisibleForTesting @VisibleForTesting
/* package */ Builder setImaFactory(ImaUtil.ImaFactory imaFactory) { /* package */ Builder setImaFactory(ImaUtil.ImaFactory imaFactory) {
this.imaFactory = checkNotNull(imaFactory); this.imaFactory = checkNotNull(imaFactory);
......
...@@ -93,6 +93,7 @@ import com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate; ...@@ -93,6 +93,7 @@ import com.google.ads.interactivemedia.v3.api.player.VideoProgressUpdate;
import com.google.ads.interactivemedia.v3.api.player.VideoStreamPlayer; import com.google.ads.interactivemedia.v3.api.player.VideoStreamPlayer;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
...@@ -134,6 +135,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou ...@@ -134,6 +135,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
this.contentMediaSourceFactory = contentMediaSourceFactory; this.contentMediaSourceFactory = contentMediaSourceFactory;
} }
@CanIgnoreReturnValue
@Override @Override
public MediaSource.Factory setLoadErrorHandlingPolicy( public MediaSource.Factory setLoadErrorHandlingPolicy(
LoadErrorHandlingPolicy loadErrorHandlingPolicy) { LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
...@@ -141,6 +143,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou ...@@ -141,6 +143,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
return this; return this;
} }
@CanIgnoreReturnValue
@Override @Override
public MediaSource.Factory setDrmSessionManagerProvider( public MediaSource.Factory setDrmSessionManagerProvider(
DrmSessionManagerProvider drmSessionManagerProvider) { DrmSessionManagerProvider drmSessionManagerProvider) {
...@@ -215,6 +218,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou ...@@ -215,6 +218,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
* @param imaSdkSettings The {@link ImaSdkSettings}. * @param imaSdkSettings The {@link ImaSdkSettings}.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public AdsLoader.Builder setImaSdkSettings(ImaSdkSettings imaSdkSettings) { public AdsLoader.Builder setImaSdkSettings(ImaSdkSettings imaSdkSettings) {
this.imaSdkSettings = imaSdkSettings; this.imaSdkSettings = imaSdkSettings;
return this; return this;
...@@ -227,6 +231,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou ...@@ -227,6 +231,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
* @param adEventListener The ad event listener. * @param adEventListener The ad event listener.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public AdsLoader.Builder setAdEventListener(AdEventListener adEventListener) { public AdsLoader.Builder setAdEventListener(AdEventListener adEventListener) {
this.adEventListener = adEventListener; this.adEventListener = adEventListener;
return this; return this;
...@@ -239,6 +244,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou ...@@ -239,6 +244,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
* @param adErrorListener The {@link AdErrorEvent.AdErrorListener}. * @param adErrorListener The {@link AdErrorEvent.AdErrorListener}.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public AdsLoader.Builder setAdErrorListener(AdErrorEvent.AdErrorListener adErrorListener) { public AdsLoader.Builder setAdErrorListener(AdErrorEvent.AdErrorListener adErrorListener) {
this.adErrorListener = adErrorListener; this.adErrorListener = adErrorListener;
return this; return this;
...@@ -251,6 +257,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou ...@@ -251,6 +257,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
* @return This builder, for convenience. * @return This builder, for convenience.
* @see AdDisplayContainer#setCompanionSlots(Collection) * @see AdDisplayContainer#setCompanionSlots(Collection)
*/ */
@CanIgnoreReturnValue
public AdsLoader.Builder setCompanionAdSlots(Collection<CompanionAdSlot> companionAdSlots) { public AdsLoader.Builder setCompanionAdSlots(Collection<CompanionAdSlot> companionAdSlots) {
this.companionAdSlots = ImmutableList.copyOf(companionAdSlots); this.companionAdSlots = ImmutableList.copyOf(companionAdSlots);
return this; return this;
...@@ -264,6 +271,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou ...@@ -264,6 +271,7 @@ public final class ImaServerSideAdInsertionMediaSource extends CompositeMediaSou
* @param state The state to resume with. * @param state The state to resume with.
* @return This builder, for convenience. * @return This builder, for convenience.
*/ */
@CanIgnoreReturnValue
public AdsLoader.Builder setAdsLoaderState(State state) { public AdsLoader.Builder setAdsLoaderState(State state) {
this.state = state; this.state = state;
return this; return this;
......
...@@ -29,6 +29,7 @@ import com.google.ads.interactivemedia.v3.api.ImaSdkFactory; ...@@ -29,6 +29,7 @@ import com.google.ads.interactivemedia.v3.api.ImaSdkFactory;
import com.google.ads.interactivemedia.v3.api.StreamRequest; import com.google.ads.interactivemedia.v3.api.StreamRequest;
import com.google.ads.interactivemedia.v3.api.StreamRequest.StreamFormat; import com.google.ads.interactivemedia.v3.api.StreamRequest.StreamFormat;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -85,6 +86,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -85,6 +86,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param adsId The ads identifier. * @param adsId The ads identifier.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setAdsId(String adsId) { public ImaServerSideAdInsertionUriBuilder setAdsId(String adsId) {
this.adsId = adsId; this.adsId = adsId;
return this; return this;
...@@ -96,6 +98,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -96,6 +98,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param assetKey Live stream asset key. * @param assetKey Live stream asset key.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setAssetKey(@Nullable String assetKey) { public ImaServerSideAdInsertionUriBuilder setAssetKey(@Nullable String assetKey) {
this.assetKey = assetKey; this.assetKey = assetKey;
return this; return this;
...@@ -109,6 +112,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -109,6 +112,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param authToken Live stream authorization token. * @param authToken Live stream authorization token.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setAuthToken(@Nullable String authToken) { public ImaServerSideAdInsertionUriBuilder setAuthToken(@Nullable String authToken) {
this.authToken = authToken; this.authToken = authToken;
return this; return this;
...@@ -120,6 +124,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -120,6 +124,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param contentSourceId VOD stream content source id. * @param contentSourceId VOD stream content source id.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setContentSourceId(@Nullable String contentSourceId) { public ImaServerSideAdInsertionUriBuilder setContentSourceId(@Nullable String contentSourceId) {
this.contentSourceId = contentSourceId; this.contentSourceId = contentSourceId;
return this; return this;
...@@ -131,6 +136,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -131,6 +136,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param videoId VOD stream video id. * @param videoId VOD stream video id.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setVideoId(@Nullable String videoId) { public ImaServerSideAdInsertionUriBuilder setVideoId(@Nullable String videoId) {
this.videoId = videoId; this.videoId = videoId;
return this; return this;
...@@ -142,6 +148,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -142,6 +148,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param format {@link C#TYPE_DASH} or {@link C#TYPE_HLS}. * @param format {@link C#TYPE_DASH} or {@link C#TYPE_HLS}.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setFormat(@ContentType int format) { public ImaServerSideAdInsertionUriBuilder setFormat(@ContentType int format) {
checkArgument(format == C.CONTENT_TYPE_DASH || format == C.CONTENT_TYPE_HLS); checkArgument(format == C.CONTENT_TYPE_DASH || format == C.CONTENT_TYPE_HLS);
this.format = format; this.format = format;
...@@ -156,6 +163,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -156,6 +163,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param apiKey Stream api key. * @param apiKey Stream api key.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setApiKey(@Nullable String apiKey) { public ImaServerSideAdInsertionUriBuilder setApiKey(@Nullable String apiKey) {
this.apiKey = apiKey; this.apiKey = apiKey;
return this; return this;
...@@ -169,6 +177,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -169,6 +177,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param streamActivityMonitorId ID for debugging the stream with the stream activity monitor. * @param streamActivityMonitorId ID for debugging the stream with the stream activity monitor.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setStreamActivityMonitorId( public ImaServerSideAdInsertionUriBuilder setStreamActivityMonitorId(
@Nullable String streamActivityMonitorId) { @Nullable String streamActivityMonitorId) {
this.streamActivityMonitorId = streamActivityMonitorId; this.streamActivityMonitorId = streamActivityMonitorId;
...@@ -187,6 +196,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -187,6 +196,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param adTagParameters A map of extra parameters to pass to the ad server. * @param adTagParameters A map of extra parameters to pass to the ad server.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setAdTagParameters( public ImaServerSideAdInsertionUriBuilder setAdTagParameters(
Map<String, String> adTagParameters) { Map<String, String> adTagParameters) {
this.adTagParameters = ImmutableMap.copyOf(adTagParameters); this.adTagParameters = ImmutableMap.copyOf(adTagParameters);
...@@ -200,6 +210,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -200,6 +210,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param manifestSuffix Stream manifest's suffix. * @param manifestSuffix Stream manifest's suffix.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setManifestSuffix(@Nullable String manifestSuffix) { public ImaServerSideAdInsertionUriBuilder setManifestSuffix(@Nullable String manifestSuffix) {
this.manifestSuffix = manifestSuffix; this.manifestSuffix = manifestSuffix;
return this; return this;
...@@ -213,6 +224,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -213,6 +224,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param contentUrl Deep link to the content's screen. * @param contentUrl Deep link to the content's screen.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setContentUrl(@Nullable String contentUrl) { public ImaServerSideAdInsertionUriBuilder setContentUrl(@Nullable String contentUrl) {
this.contentUrl = contentUrl; this.contentUrl = contentUrl;
return this; return this;
...@@ -226,6 +238,7 @@ public final class ImaServerSideAdInsertionUriBuilder { ...@@ -226,6 +238,7 @@ public final class ImaServerSideAdInsertionUriBuilder {
* @param loadVideoTimeoutMs The timeout after which to give up resolving the video URI. * @param loadVideoTimeoutMs The timeout after which to give up resolving the video URI.
* @return This instance, for convenience. * @return This instance, for convenience.
*/ */
@CanIgnoreReturnValue
public ImaServerSideAdInsertionUriBuilder setLoadVideoTimeoutMs(int loadVideoTimeoutMs) { public ImaServerSideAdInsertionUriBuilder setLoadVideoTimeoutMs(int loadVideoTimeoutMs) {
this.loadVideoTimeoutMs = loadVideoTimeoutMs; this.loadVideoTimeoutMs = loadVideoTimeoutMs;
return this; return this;
......
...@@ -25,6 +25,7 @@ android { ...@@ -25,6 +25,7 @@ android {
dependencies { dependencies {
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
......
...@@ -30,6 +30,7 @@ import androidx.media3.common.ParserException; ...@@ -30,6 +30,7 @@ import androidx.media3.common.ParserException;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -149,6 +150,7 @@ import java.util.HashMap; ...@@ -149,6 +150,7 @@ import java.util.HashMap;
* @param mediaTitle The assigned media title. * @param mediaTitle The assigned media title.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setMediaTitle(String mediaTitle) { public Builder setMediaTitle(String mediaTitle) {
this.mediaTitle = mediaTitle; this.mediaTitle = mediaTitle;
return this; return this;
...@@ -160,6 +162,7 @@ import java.util.HashMap; ...@@ -160,6 +162,7 @@ import java.util.HashMap;
* @param connection The connection parameter. * @param connection The connection parameter.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setConnection(String connection) { public Builder setConnection(String connection) {
this.connection = connection; this.connection = connection;
return this; return this;
...@@ -171,6 +174,7 @@ import java.util.HashMap; ...@@ -171,6 +174,7 @@ import java.util.HashMap;
* @param bitrate The estimated bitrate measured in bits per second. * @param bitrate The estimated bitrate measured in bits per second.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setBitrate(int bitrate) { public Builder setBitrate(int bitrate) {
this.bitrate = bitrate; this.bitrate = bitrate;
return this; return this;
...@@ -182,6 +186,7 @@ import java.util.HashMap; ...@@ -182,6 +186,7 @@ import java.util.HashMap;
* @param key The encryption parameter. * @param key The encryption parameter.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setKey(String key) { public Builder setKey(String key) {
this.key = key; this.key = key;
return this; return this;
...@@ -196,6 +201,7 @@ import java.util.HashMap; ...@@ -196,6 +201,7 @@ import java.util.HashMap;
* @param attributeValue The value of the attribute, or "" if the attribute bears no value. * @param attributeValue The value of the attribute, or "" if the attribute bears no value.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder addAttribute(String attributeName, String attributeValue) { public Builder addAttribute(String attributeName, String attributeValue) {
attributes.put(attributeName, attributeValue); attributes.put(attributeName, attributeValue);
return this; return this;
......
...@@ -25,6 +25,7 @@ import androidx.media3.common.util.ParsableByteArray; ...@@ -25,6 +25,7 @@ import androidx.media3.common.util.ParsableByteArray;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.common.math.IntMath; import com.google.common.math.IntMath;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
/** /**
...@@ -71,24 +72,28 @@ public final class RtpPacket { ...@@ -71,24 +72,28 @@ public final class RtpPacket {
private byte[] payloadData = EMPTY; private byte[] payloadData = EMPTY;
/** Sets the {@link RtpPacket#padding}. The default is false. */ /** Sets the {@link RtpPacket#padding}. The default is false. */
@CanIgnoreReturnValue
public Builder setPadding(boolean padding) { public Builder setPadding(boolean padding) {
this.padding = padding; this.padding = padding;
return this; return this;
} }
/** Sets {@link RtpPacket#marker}. The default is false. */ /** Sets {@link RtpPacket#marker}. The default is false. */
@CanIgnoreReturnValue
public Builder setMarker(boolean marker) { public Builder setMarker(boolean marker) {
this.marker = marker; this.marker = marker;
return this; return this;
} }
/** Sets {@link RtpPacket#payloadType}. The default is 0. */ /** Sets {@link RtpPacket#payloadType}. The default is 0. */
@CanIgnoreReturnValue
public Builder setPayloadType(byte payloadType) { public Builder setPayloadType(byte payloadType) {
this.payloadType = payloadType; this.payloadType = payloadType;
return this; return this;
} }
/** Sets {@link RtpPacket#sequenceNumber}. The default is 0. */ /** Sets {@link RtpPacket#sequenceNumber}. The default is 0. */
@CanIgnoreReturnValue
public Builder setSequenceNumber(int sequenceNumber) { public Builder setSequenceNumber(int sequenceNumber) {
checkArgument(sequenceNumber >= MIN_SEQUENCE_NUMBER && sequenceNumber <= MAX_SEQUENCE_NUMBER); checkArgument(sequenceNumber >= MIN_SEQUENCE_NUMBER && sequenceNumber <= MAX_SEQUENCE_NUMBER);
this.sequenceNumber = sequenceNumber & 0xFFFF; this.sequenceNumber = sequenceNumber & 0xFFFF;
...@@ -96,18 +101,21 @@ public final class RtpPacket { ...@@ -96,18 +101,21 @@ public final class RtpPacket {
} }
/** Sets {@link RtpPacket#timestamp}. The default is 0. */ /** Sets {@link RtpPacket#timestamp}. The default is 0. */
@CanIgnoreReturnValue
public Builder setTimestamp(long timestamp) { public Builder setTimestamp(long timestamp) {
this.timestamp = timestamp; this.timestamp = timestamp;
return this; return this;
} }
/** Sets {@link RtpPacket#ssrc}. The default is 0. */ /** Sets {@link RtpPacket#ssrc}. The default is 0. */
@CanIgnoreReturnValue
public Builder setSsrc(int ssrc) { public Builder setSsrc(int ssrc) {
this.ssrc = ssrc; this.ssrc = ssrc;
return this; return this;
} }
/** Sets {@link RtpPacket#csrc}. The default is an empty byte array. */ /** Sets {@link RtpPacket#csrc}. The default is an empty byte array. */
@CanIgnoreReturnValue
public Builder setCsrc(byte[] csrc) { public Builder setCsrc(byte[] csrc) {
checkNotNull(csrc); checkNotNull(csrc);
this.csrc = csrc; this.csrc = csrc;
...@@ -115,6 +123,7 @@ public final class RtpPacket { ...@@ -115,6 +123,7 @@ public final class RtpPacket {
} }
/** Sets {@link RtpPacket#payloadData}. The default is an empty byte array. */ /** Sets {@link RtpPacket#payloadData}. The default is an empty byte array. */
@CanIgnoreReturnValue
public Builder setPayloadData(byte[] payloadData) { public Builder setPayloadData(byte[] payloadData) {
checkNotNull(payloadData); checkNotNull(payloadData);
this.payloadData = payloadData; this.payloadData = payloadData;
......
...@@ -23,6 +23,7 @@ import com.google.common.base.Ascii; ...@@ -23,6 +23,7 @@ import com.google.common.base.Ascii;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -115,6 +116,7 @@ import java.util.Map; ...@@ -115,6 +116,7 @@ import java.util.Map;
* @param headerValue The value of the header. * @param headerValue The value of the header.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder add(String headerName, String headerValue) { public Builder add(String headerName, String headerValue) {
namesAndValuesBuilder.put(convertToStandardHeaderName(headerName.trim()), headerValue.trim()); namesAndValuesBuilder.put(convertToStandardHeaderName(headerName.trim()), headerValue.trim());
return this; return this;
...@@ -127,6 +129,7 @@ import java.util.Map; ...@@ -127,6 +129,7 @@ import java.util.Map;
* &lt;headerValue&gt; * &lt;headerValue&gt;
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder addAll(List<String> headers) { public Builder addAll(List<String> headers) {
for (int i = 0; i < headers.size(); i++) { for (int i = 0; i < headers.size(); i++) {
String[] header = Util.splitAtFirst(headers.get(i), ":\\s?"); String[] header = Util.splitAtFirst(headers.get(i), ":\\s?");
...@@ -144,6 +147,7 @@ import java.util.Map; ...@@ -144,6 +147,7 @@ import java.util.Map;
* header values. * header values.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder addAll(Map<String, String> headers) { public Builder addAll(Map<String, String> headers) {
for (Map.Entry<String, String> header : headers.entrySet()) { for (Map.Entry<String, String> header : headers.entrySet()) {
add(header.getKey(), header.getValue()); add(header.getKey(), header.getValue());
......
...@@ -39,6 +39,7 @@ import androidx.media3.exoplayer.source.MediaSourceFactory; ...@@ -39,6 +39,7 @@ import androidx.media3.exoplayer.source.MediaSourceFactory;
import androidx.media3.exoplayer.source.SinglePeriodTimeline; import androidx.media3.exoplayer.source.SinglePeriodTimeline;
import androidx.media3.exoplayer.upstream.Allocator; import androidx.media3.exoplayer.upstream.Allocator;
import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy; import androidx.media3.exoplayer.upstream.LoadErrorHandlingPolicy;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import javax.net.SocketFactory; import javax.net.SocketFactory;
...@@ -89,6 +90,7 @@ public final class RtspMediaSource extends BaseMediaSource { ...@@ -89,6 +90,7 @@ public final class RtspMediaSource extends BaseMediaSource {
* @param forceUseRtpTcp Whether force to use TCP for streaming. * @param forceUseRtpTcp Whether force to use TCP for streaming.
* @return This Factory, for convenience. * @return This Factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setForceUseRtpTcp(boolean forceUseRtpTcp) { public Factory setForceUseRtpTcp(boolean forceUseRtpTcp) {
this.forceUseRtpTcp = forceUseRtpTcp; this.forceUseRtpTcp = forceUseRtpTcp;
return this; return this;
...@@ -100,6 +102,7 @@ public final class RtspMediaSource extends BaseMediaSource { ...@@ -100,6 +102,7 @@ public final class RtspMediaSource extends BaseMediaSource {
* @param userAgent The user agent. * @param userAgent The user agent.
* @return This Factory, for convenience. * @return This Factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setUserAgent(String userAgent) { public Factory setUserAgent(String userAgent) {
this.userAgent = userAgent; this.userAgent = userAgent;
return this; return this;
...@@ -112,6 +115,7 @@ public final class RtspMediaSource extends BaseMediaSource { ...@@ -112,6 +115,7 @@ public final class RtspMediaSource extends BaseMediaSource {
* @param socketFactory A socket factory. * @param socketFactory A socket factory.
* @return This Factory, for convenience. * @return This Factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setSocketFactory(SocketFactory socketFactory) { public Factory setSocketFactory(SocketFactory socketFactory) {
this.socketFactory = socketFactory; this.socketFactory = socketFactory;
return this; return this;
...@@ -126,6 +130,7 @@ public final class RtspMediaSource extends BaseMediaSource { ...@@ -126,6 +130,7 @@ public final class RtspMediaSource extends BaseMediaSource {
* @param debugLoggingEnabled Whether to log RTSP messages. * @param debugLoggingEnabled Whether to log RTSP messages.
* @return This Factory, for convenience. * @return This Factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setDebugLoggingEnabled(boolean debugLoggingEnabled) { public Factory setDebugLoggingEnabled(boolean debugLoggingEnabled) {
this.debugLoggingEnabled = debugLoggingEnabled; this.debugLoggingEnabled = debugLoggingEnabled;
return this; return this;
...@@ -140,6 +145,7 @@ public final class RtspMediaSource extends BaseMediaSource { ...@@ -140,6 +145,7 @@ public final class RtspMediaSource extends BaseMediaSource {
* @param timeoutMs The timeout measured in milliseconds. * @param timeoutMs The timeout measured in milliseconds.
* @return This Factory, for convenience. * @return This Factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setTimeoutMs(@IntRange(from = 1) long timeoutMs) { public Factory setTimeoutMs(@IntRange(from = 1) long timeoutMs) {
checkArgument(timeoutMs > 0); checkArgument(timeoutMs > 0);
this.timeoutMs = timeoutMs; this.timeoutMs = timeoutMs;
......
...@@ -25,6 +25,7 @@ import androidx.media3.common.util.UnstableApi; ...@@ -25,6 +25,7 @@ import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.HashMap; import java.util.HashMap;
/** /**
...@@ -66,6 +67,7 @@ import java.util.HashMap; ...@@ -66,6 +67,7 @@ import java.util.HashMap;
* @param sessionName The {@link SessionDescription#sessionName}. * @param sessionName The {@link SessionDescription#sessionName}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setSessionName(String sessionName) { public Builder setSessionName(String sessionName) {
this.sessionName = sessionName; this.sessionName = sessionName;
return this; return this;
...@@ -77,6 +79,7 @@ import java.util.HashMap; ...@@ -77,6 +79,7 @@ import java.util.HashMap;
* @param sessionInfo The {@link SessionDescription#sessionInfo}. * @param sessionInfo The {@link SessionDescription#sessionInfo}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setSessionInfo(String sessionInfo) { public Builder setSessionInfo(String sessionInfo) {
this.sessionInfo = sessionInfo; this.sessionInfo = sessionInfo;
return this; return this;
...@@ -88,6 +91,7 @@ import java.util.HashMap; ...@@ -88,6 +91,7 @@ import java.util.HashMap;
* @param uri The {@link SessionDescription#uri}. * @param uri The {@link SessionDescription#uri}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setUri(Uri uri) { public Builder setUri(Uri uri) {
this.uri = uri; this.uri = uri;
return this; return this;
...@@ -101,6 +105,7 @@ import java.util.HashMap; ...@@ -101,6 +105,7 @@ import java.util.HashMap;
* @param origin The {@link SessionDescription#origin}. * @param origin The {@link SessionDescription#origin}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setOrigin(String origin) { public Builder setOrigin(String origin) {
this.origin = origin; this.origin = origin;
return this; return this;
...@@ -112,6 +117,7 @@ import java.util.HashMap; ...@@ -112,6 +117,7 @@ import java.util.HashMap;
* @param connection The {@link SessionDescription#connection}. * @param connection The {@link SessionDescription#connection}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setConnection(String connection) { public Builder setConnection(String connection) {
this.connection = connection; this.connection = connection;
return this; return this;
...@@ -123,6 +129,7 @@ import java.util.HashMap; ...@@ -123,6 +129,7 @@ import java.util.HashMap;
* @param bitrate The {@link SessionDescription#bitrate} in bits per second. * @param bitrate The {@link SessionDescription#bitrate} in bits per second.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setBitrate(int bitrate) { public Builder setBitrate(int bitrate) {
this.bitrate = bitrate; this.bitrate = bitrate;
return this; return this;
...@@ -136,6 +143,7 @@ import java.util.HashMap; ...@@ -136,6 +143,7 @@ import java.util.HashMap;
* @param timing The {@link SessionDescription#timing}. * @param timing The {@link SessionDescription#timing}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setTiming(String timing) { public Builder setTiming(String timing) {
this.timing = timing; this.timing = timing;
return this; return this;
...@@ -147,6 +155,7 @@ import java.util.HashMap; ...@@ -147,6 +155,7 @@ import java.util.HashMap;
* @param key The {@link SessionDescription#key}. * @param key The {@link SessionDescription#key}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setKey(String key) { public Builder setKey(String key) {
this.key = key; this.key = key;
return this; return this;
...@@ -158,6 +167,7 @@ import java.util.HashMap; ...@@ -158,6 +167,7 @@ import java.util.HashMap;
* @param emailAddress The {@link SessionDescription#emailAddress}. * @param emailAddress The {@link SessionDescription#emailAddress}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setEmailAddress(String emailAddress) { public Builder setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress; this.emailAddress = emailAddress;
return this; return this;
...@@ -169,6 +179,7 @@ import java.util.HashMap; ...@@ -169,6 +179,7 @@ import java.util.HashMap;
* @param phoneNumber The {@link SessionDescription#phoneNumber}. * @param phoneNumber The {@link SessionDescription#phoneNumber}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder setPhoneNumber(String phoneNumber) { public Builder setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber; this.phoneNumber = phoneNumber;
return this; return this;
...@@ -181,6 +192,7 @@ import java.util.HashMap; ...@@ -181,6 +192,7 @@ import java.util.HashMap;
* @param attributeValue The value of the attribute. * @param attributeValue The value of the attribute.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder addAttribute(String attributeName, String attributeValue) { public Builder addAttribute(String attributeName, String attributeValue) {
attributes.put(attributeName, attributeValue); attributes.put(attributeName, attributeValue);
return this; return this;
...@@ -192,6 +204,7 @@ import java.util.HashMap; ...@@ -192,6 +204,7 @@ import java.util.HashMap;
* @param mediaDescription The {@link MediaDescription}. * @param mediaDescription The {@link MediaDescription}.
* @return This builder. * @return This builder.
*/ */
@CanIgnoreReturnValue
public Builder addMediaDescription(MediaDescription mediaDescription) { public Builder addMediaDescription(MediaDescription mediaDescription) {
mediaDescriptionListBuilder.add(mediaDescription); mediaDescriptionListBuilder.add(mediaDescription);
return this; return this;
......
...@@ -25,6 +25,7 @@ android { ...@@ -25,6 +25,7 @@ android {
dependencies { dependencies {
implementation project(modulePrefix + 'lib-exoplayer') implementation project(modulePrefix + 'lib-exoplayer')
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
......
...@@ -64,6 +64,7 @@ import androidx.media3.exoplayer.upstream.Loader.LoadErrorAction; ...@@ -64,6 +64,7 @@ import androidx.media3.exoplayer.upstream.Loader.LoadErrorAction;
import androidx.media3.exoplayer.upstream.LoaderErrorThrower; import androidx.media3.exoplayer.upstream.LoaderErrorThrower;
import androidx.media3.exoplayer.upstream.ParsingLoadable; import androidx.media3.exoplayer.upstream.ParsingLoadable;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -136,6 +137,7 @@ public final class SsMediaSource extends BaseMediaSource ...@@ -136,6 +137,7 @@ public final class SsMediaSource extends BaseMediaSource
compositeSequenceableLoaderFactory = new DefaultCompositeSequenceableLoaderFactory(); compositeSequenceableLoaderFactory = new DefaultCompositeSequenceableLoaderFactory();
} }
@CanIgnoreReturnValue
@Override @Override
public Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) { public Factory setLoadErrorHandlingPolicy(LoadErrorHandlingPolicy loadErrorHandlingPolicy) {
this.loadErrorHandlingPolicy = this.loadErrorHandlingPolicy =
...@@ -156,6 +158,7 @@ public final class SsMediaSource extends BaseMediaSource ...@@ -156,6 +158,7 @@ public final class SsMediaSource extends BaseMediaSource
* default start position should precede the end of the live window. * default start position should precede the end of the live window.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setLivePresentationDelayMs(long livePresentationDelayMs) { public Factory setLivePresentationDelayMs(long livePresentationDelayMs) {
this.livePresentationDelayMs = livePresentationDelayMs; this.livePresentationDelayMs = livePresentationDelayMs;
return this; return this;
...@@ -167,6 +170,7 @@ public final class SsMediaSource extends BaseMediaSource ...@@ -167,6 +170,7 @@ public final class SsMediaSource extends BaseMediaSource
* @param manifestParser A parser for loaded manifest data. * @param manifestParser A parser for loaded manifest data.
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setManifestParser( public Factory setManifestParser(
@Nullable ParsingLoadable.Parser<? extends SsManifest> manifestParser) { @Nullable ParsingLoadable.Parser<? extends SsManifest> manifestParser) {
this.manifestParser = manifestParser; this.manifestParser = manifestParser;
...@@ -182,6 +186,7 @@ public final class SsMediaSource extends BaseMediaSource ...@@ -182,6 +186,7 @@ public final class SsMediaSource extends BaseMediaSource
* audio etc.). * audio etc.).
* @return This factory, for convenience. * @return This factory, for convenience.
*/ */
@CanIgnoreReturnValue
public Factory setCompositeSequenceableLoaderFactory( public Factory setCompositeSequenceableLoaderFactory(
CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) { CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory) {
this.compositeSequenceableLoaderFactory = this.compositeSequenceableLoaderFactory =
...@@ -193,6 +198,7 @@ public final class SsMediaSource extends BaseMediaSource ...@@ -193,6 +198,7 @@ public final class SsMediaSource extends BaseMediaSource
return this; return this;
} }
@CanIgnoreReturnValue
@Override @Override
public Factory setDrmSessionManagerProvider( public Factory setDrmSessionManagerProvider(
DrmSessionManagerProvider drmSessionManagerProvider) { DrmSessionManagerProvider drmSessionManagerProvider) {
......
...@@ -28,6 +28,7 @@ dependencies { ...@@ -28,6 +28,7 @@ dependencies {
implementation project(modulePrefix + 'lib-common') implementation project(modulePrefix + 'lib-common')
// TODO(b/203752187): Remove this dependency. // TODO(b/203752187): Remove this dependency.
implementation project(modulePrefix + 'lib-decoder') implementation project(modulePrefix + 'lib-decoder')
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion compileOnly 'org.checkerframework:checker-compat-qual:' + checkerframeworkCompatVersion
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
......
...@@ -44,6 +44,7 @@ import androidx.media3.extractor.ts.PsExtractor; ...@@ -44,6 +44,7 @@ import androidx.media3.extractor.ts.PsExtractor;
import androidx.media3.extractor.ts.TsExtractor; import androidx.media3.extractor.ts.TsExtractor;
import androidx.media3.extractor.ts.TsPayloadReader; import androidx.media3.extractor.ts.TsPayloadReader;
import androidx.media3.extractor.wav.WavExtractor; import androidx.media3.extractor.wav.WavExtractor;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -145,6 +146,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -145,6 +146,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* assumption should be enabled for all extractors that support it. * assumption should be enabled for all extractors that support it.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setConstantBitrateSeekingEnabled( public synchronized DefaultExtractorsFactory setConstantBitrateSeekingEnabled(
boolean constantBitrateSeekingEnabled) { boolean constantBitrateSeekingEnabled) {
this.constantBitrateSeekingEnabled = constantBitrateSeekingEnabled; this.constantBitrateSeekingEnabled = constantBitrateSeekingEnabled;
...@@ -169,6 +171,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -169,6 +171,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* duration is unknown. * duration is unknown.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setConstantBitrateSeekingAlwaysEnabled( public synchronized DefaultExtractorsFactory setConstantBitrateSeekingAlwaysEnabled(
boolean constantBitrateSeekingAlwaysEnabled) { boolean constantBitrateSeekingAlwaysEnabled) {
this.constantBitrateSeekingAlwaysEnabled = constantBitrateSeekingAlwaysEnabled; this.constantBitrateSeekingAlwaysEnabled = constantBitrateSeekingAlwaysEnabled;
...@@ -182,6 +185,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -182,6 +185,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* @param flags The flags to use. * @param flags The flags to use.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setAdtsExtractorFlags( public synchronized DefaultExtractorsFactory setAdtsExtractorFlags(
@AdtsExtractor.Flags int flags) { @AdtsExtractor.Flags int flags) {
this.adtsFlags = flags; this.adtsFlags = flags;
...@@ -195,6 +199,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -195,6 +199,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* @param flags The flags to use. * @param flags The flags to use.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setAmrExtractorFlags(@AmrExtractor.Flags int flags) { public synchronized DefaultExtractorsFactory setAmrExtractorFlags(@AmrExtractor.Flags int flags) {
this.amrFlags = flags; this.amrFlags = flags;
return this; return this;
...@@ -209,6 +214,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -209,6 +214,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* @param flags The flags to use. * @param flags The flags to use.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setFlacExtractorFlags( public synchronized DefaultExtractorsFactory setFlacExtractorFlags(
@FlacExtractor.Flags int flags) { @FlacExtractor.Flags int flags) {
this.flacFlags = flags; this.flacFlags = flags;
...@@ -222,6 +228,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -222,6 +228,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* @param flags The flags to use. * @param flags The flags to use.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setMatroskaExtractorFlags( public synchronized DefaultExtractorsFactory setMatroskaExtractorFlags(
@MatroskaExtractor.Flags int flags) { @MatroskaExtractor.Flags int flags) {
this.matroskaFlags = flags; this.matroskaFlags = flags;
...@@ -235,6 +242,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -235,6 +242,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* @param flags The flags to use. * @param flags The flags to use.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setMp4ExtractorFlags(@Mp4Extractor.Flags int flags) { public synchronized DefaultExtractorsFactory setMp4ExtractorFlags(@Mp4Extractor.Flags int flags) {
this.mp4Flags = flags; this.mp4Flags = flags;
return this; return this;
...@@ -247,6 +255,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -247,6 +255,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* @param flags The flags to use. * @param flags The flags to use.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setFragmentedMp4ExtractorFlags( public synchronized DefaultExtractorsFactory setFragmentedMp4ExtractorFlags(
@FragmentedMp4Extractor.Flags int flags) { @FragmentedMp4Extractor.Flags int flags) {
this.fragmentedMp4Flags = flags; this.fragmentedMp4Flags = flags;
...@@ -260,6 +269,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -260,6 +269,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* @param flags The flags to use. * @param flags The flags to use.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setMp3ExtractorFlags(@Mp3Extractor.Flags int flags) { public synchronized DefaultExtractorsFactory setMp3ExtractorFlags(@Mp3Extractor.Flags int flags) {
mp3Flags = flags; mp3Flags = flags;
return this; return this;
...@@ -272,6 +282,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -272,6 +282,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* @param mode The mode to use. * @param mode The mode to use.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setTsExtractorMode(@TsExtractor.Mode int mode) { public synchronized DefaultExtractorsFactory setTsExtractorMode(@TsExtractor.Mode int mode) {
tsMode = mode; tsMode = mode;
return this; return this;
...@@ -285,6 +296,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -285,6 +296,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* @param flags The flags to use. * @param flags The flags to use.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setTsExtractorFlags( public synchronized DefaultExtractorsFactory setTsExtractorFlags(
@DefaultTsPayloadReaderFactory.Flags int flags) { @DefaultTsPayloadReaderFactory.Flags int flags) {
tsFlags = flags; tsFlags = flags;
...@@ -299,6 +311,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory { ...@@ -299,6 +311,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
* @param timestampSearchBytes The number of search bytes to use. * @param timestampSearchBytes The number of search bytes to use.
* @return The factory, for convenience. * @return The factory, for convenience.
*/ */
@CanIgnoreReturnValue
public synchronized DefaultExtractorsFactory setTsExtractorTimestampSearchBytes( public synchronized DefaultExtractorsFactory setTsExtractorTimestampSearchBytes(
int timestampSearchBytes) { int timestampSearchBytes) {
tsTimestampSearchBytes = timestampSearchBytes; tsTimestampSearchBytes = timestampSearchBytes;
......
...@@ -22,6 +22,7 @@ import android.text.Layout; ...@@ -22,6 +22,7 @@ import android.text.Layout;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.media3.common.text.TextAnnotation; import androidx.media3.common.text.TextAnnotation;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -125,6 +126,7 @@ import java.lang.annotation.Target; ...@@ -125,6 +126,7 @@ import java.lang.annotation.Target;
return linethrough == ON; return linethrough == ON;
} }
@CanIgnoreReturnValue
public TtmlStyle setLinethrough(boolean linethrough) { public TtmlStyle setLinethrough(boolean linethrough) {
this.linethrough = linethrough ? ON : OFF; this.linethrough = linethrough ? ON : OFF;
return this; return this;
...@@ -134,16 +136,19 @@ import java.lang.annotation.Target; ...@@ -134,16 +136,19 @@ import java.lang.annotation.Target;
return underline == ON; return underline == ON;
} }
@CanIgnoreReturnValue
public TtmlStyle setUnderline(boolean underline) { public TtmlStyle setUnderline(boolean underline) {
this.underline = underline ? ON : OFF; this.underline = underline ? ON : OFF;
return this; return this;
} }
@CanIgnoreReturnValue
public TtmlStyle setBold(boolean bold) { public TtmlStyle setBold(boolean bold) {
this.bold = bold ? ON : OFF; this.bold = bold ? ON : OFF;
return this; return this;
} }
@CanIgnoreReturnValue
public TtmlStyle setItalic(boolean italic) { public TtmlStyle setItalic(boolean italic) {
this.italic = italic ? ON : OFF; this.italic = italic ? ON : OFF;
return this; return this;
...@@ -154,6 +159,7 @@ import java.lang.annotation.Target; ...@@ -154,6 +159,7 @@ import java.lang.annotation.Target;
return fontFamily; return fontFamily;
} }
@CanIgnoreReturnValue
public TtmlStyle setFontFamily(@Nullable String fontFamily) { public TtmlStyle setFontFamily(@Nullable String fontFamily) {
this.fontFamily = fontFamily; this.fontFamily = fontFamily;
return this; return this;
...@@ -166,6 +172,7 @@ import java.lang.annotation.Target; ...@@ -166,6 +172,7 @@ import java.lang.annotation.Target;
return fontColor; return fontColor;
} }
@CanIgnoreReturnValue
public TtmlStyle setFontColor(int fontColor) { public TtmlStyle setFontColor(int fontColor) {
this.fontColor = fontColor; this.fontColor = fontColor;
hasFontColor = true; hasFontColor = true;
...@@ -183,6 +190,7 @@ import java.lang.annotation.Target; ...@@ -183,6 +190,7 @@ import java.lang.annotation.Target;
return backgroundColor; return backgroundColor;
} }
@CanIgnoreReturnValue
public TtmlStyle setBackgroundColor(int backgroundColor) { public TtmlStyle setBackgroundColor(int backgroundColor) {
this.backgroundColor = backgroundColor; this.backgroundColor = backgroundColor;
hasBackgroundColor = true; hasBackgroundColor = true;
...@@ -193,6 +201,7 @@ import java.lang.annotation.Target; ...@@ -193,6 +201,7 @@ import java.lang.annotation.Target;
return hasBackgroundColor; return hasBackgroundColor;
} }
@CanIgnoreReturnValue
public TtmlStyle setShearPercentage(float shearPercentage) { public TtmlStyle setShearPercentage(float shearPercentage) {
this.shearPercentage = shearPercentage; this.shearPercentage = shearPercentage;
return this; return this;
...@@ -208,6 +217,7 @@ import java.lang.annotation.Target; ...@@ -208,6 +217,7 @@ import java.lang.annotation.Target;
* *
* @param ancestor the referential style to inherit from * @param ancestor the referential style to inherit from
*/ */
@CanIgnoreReturnValue
public TtmlStyle chain(@Nullable TtmlStyle ancestor) { public TtmlStyle chain(@Nullable TtmlStyle ancestor) {
return inherit(ancestor, true); return inherit(ancestor, true);
} }
...@@ -219,10 +229,12 @@ import java.lang.annotation.Target; ...@@ -219,10 +229,12 @@ import java.lang.annotation.Target;
* *
* @param ancestor the ancestor style to inherit from * @param ancestor the ancestor style to inherit from
*/ */
@CanIgnoreReturnValue
public TtmlStyle inherit(@Nullable TtmlStyle ancestor) { public TtmlStyle inherit(@Nullable TtmlStyle ancestor) {
return inherit(ancestor, false); return inherit(ancestor, false);
} }
@CanIgnoreReturnValue
private TtmlStyle inherit(@Nullable TtmlStyle ancestor, boolean chaining) { private TtmlStyle inherit(@Nullable TtmlStyle ancestor, boolean chaining) {
if (ancestor != null) { if (ancestor != null) {
if (!hasFontColor && ancestor.hasFontColor) { if (!hasFontColor && ancestor.hasFontColor) {
...@@ -276,6 +288,7 @@ import java.lang.annotation.Target; ...@@ -276,6 +288,7 @@ import java.lang.annotation.Target;
return this; return this;
} }
@CanIgnoreReturnValue
public TtmlStyle setId(@Nullable String id) { public TtmlStyle setId(@Nullable String id) {
this.id = id; this.id = id;
return this; return this;
...@@ -286,6 +299,7 @@ import java.lang.annotation.Target; ...@@ -286,6 +299,7 @@ import java.lang.annotation.Target;
return id; return id;
} }
@CanIgnoreReturnValue
public TtmlStyle setRubyType(@RubyType int rubyType) { public TtmlStyle setRubyType(@RubyType int rubyType) {
this.rubyType = rubyType; this.rubyType = rubyType;
return this; return this;
...@@ -295,6 +309,7 @@ import java.lang.annotation.Target; ...@@ -295,6 +309,7 @@ import java.lang.annotation.Target;
return rubyType; return rubyType;
} }
@CanIgnoreReturnValue
public TtmlStyle setRubyPosition(@TextAnnotation.Position int position) { public TtmlStyle setRubyPosition(@TextAnnotation.Position int position) {
this.rubyPosition = position; this.rubyPosition = position;
return this; return this;
...@@ -309,6 +324,7 @@ import java.lang.annotation.Target; ...@@ -309,6 +324,7 @@ import java.lang.annotation.Target;
return textAlign; return textAlign;
} }
@CanIgnoreReturnValue
public TtmlStyle setTextAlign(@Nullable Layout.Alignment textAlign) { public TtmlStyle setTextAlign(@Nullable Layout.Alignment textAlign) {
this.textAlign = textAlign; this.textAlign = textAlign;
return this; return this;
...@@ -319,6 +335,7 @@ import java.lang.annotation.Target; ...@@ -319,6 +335,7 @@ import java.lang.annotation.Target;
return multiRowAlign; return multiRowAlign;
} }
@CanIgnoreReturnValue
public TtmlStyle setMultiRowAlign(@Nullable Layout.Alignment multiRowAlign) { public TtmlStyle setMultiRowAlign(@Nullable Layout.Alignment multiRowAlign) {
this.multiRowAlign = multiRowAlign; this.multiRowAlign = multiRowAlign;
return this; return this;
...@@ -329,6 +346,7 @@ import java.lang.annotation.Target; ...@@ -329,6 +346,7 @@ import java.lang.annotation.Target;
return textCombine == ON; return textCombine == ON;
} }
@CanIgnoreReturnValue
public TtmlStyle setTextCombine(boolean combine) { public TtmlStyle setTextCombine(boolean combine) {
this.textCombine = combine ? ON : OFF; this.textCombine = combine ? ON : OFF;
return this; return this;
...@@ -339,16 +357,19 @@ import java.lang.annotation.Target; ...@@ -339,16 +357,19 @@ import java.lang.annotation.Target;
return textEmphasis; return textEmphasis;
} }
@CanIgnoreReturnValue
public TtmlStyle setTextEmphasis(@Nullable TextEmphasis textEmphasis) { public TtmlStyle setTextEmphasis(@Nullable TextEmphasis textEmphasis) {
this.textEmphasis = textEmphasis; this.textEmphasis = textEmphasis;
return this; return this;
} }
@CanIgnoreReturnValue
public TtmlStyle setFontSize(float fontSize) { public TtmlStyle setFontSize(float fontSize) {
this.fontSize = fontSize; this.fontSize = fontSize;
return this; return this;
} }
@CanIgnoreReturnValue
public TtmlStyle setFontSizeUnit(int fontSizeUnit) { public TtmlStyle setFontSizeUnit(int fontSizeUnit) {
this.fontSizeUnit = fontSizeUnit; this.fontSizeUnit = fontSizeUnit;
return this; return this;
......
...@@ -25,6 +25,7 @@ import androidx.annotation.Nullable; ...@@ -25,6 +25,7 @@ import androidx.annotation.Nullable;
import androidx.media3.common.text.TextAnnotation; import androidx.media3.common.text.TextAnnotation;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import com.google.common.base.Ascii; import com.google.common.base.Ascii;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -197,6 +198,7 @@ public final class WebvttCssStyle { ...@@ -197,6 +198,7 @@ public final class WebvttCssStyle {
return linethrough == ON; return linethrough == ON;
} }
@CanIgnoreReturnValue
public WebvttCssStyle setLinethrough(boolean linethrough) { public WebvttCssStyle setLinethrough(boolean linethrough) {
this.linethrough = linethrough ? ON : OFF; this.linethrough = linethrough ? ON : OFF;
return this; return this;
...@@ -206,16 +208,19 @@ public final class WebvttCssStyle { ...@@ -206,16 +208,19 @@ public final class WebvttCssStyle {
return underline == ON; return underline == ON;
} }
@CanIgnoreReturnValue
public WebvttCssStyle setUnderline(boolean underline) { public WebvttCssStyle setUnderline(boolean underline) {
this.underline = underline ? ON : OFF; this.underline = underline ? ON : OFF;
return this; return this;
} }
@CanIgnoreReturnValue
public WebvttCssStyle setBold(boolean bold) { public WebvttCssStyle setBold(boolean bold) {
this.bold = bold ? ON : OFF; this.bold = bold ? ON : OFF;
return this; return this;
} }
@CanIgnoreReturnValue
public WebvttCssStyle setItalic(boolean italic) { public WebvttCssStyle setItalic(boolean italic) {
this.italic = italic ? ON : OFF; this.italic = italic ? ON : OFF;
return this; return this;
...@@ -226,6 +231,7 @@ public final class WebvttCssStyle { ...@@ -226,6 +231,7 @@ public final class WebvttCssStyle {
return fontFamily; return fontFamily;
} }
@CanIgnoreReturnValue
public WebvttCssStyle setFontFamily(@Nullable String fontFamily) { public WebvttCssStyle setFontFamily(@Nullable String fontFamily) {
this.fontFamily = fontFamily == null ? null : Ascii.toLowerCase(fontFamily); this.fontFamily = fontFamily == null ? null : Ascii.toLowerCase(fontFamily);
return this; return this;
...@@ -238,6 +244,7 @@ public final class WebvttCssStyle { ...@@ -238,6 +244,7 @@ public final class WebvttCssStyle {
return fontColor; return fontColor;
} }
@CanIgnoreReturnValue
public WebvttCssStyle setFontColor(int color) { public WebvttCssStyle setFontColor(int color) {
this.fontColor = color; this.fontColor = color;
hasFontColor = true; hasFontColor = true;
...@@ -255,6 +262,7 @@ public final class WebvttCssStyle { ...@@ -255,6 +262,7 @@ public final class WebvttCssStyle {
return backgroundColor; return backgroundColor;
} }
@CanIgnoreReturnValue
public WebvttCssStyle setBackgroundColor(int backgroundColor) { public WebvttCssStyle setBackgroundColor(int backgroundColor) {
this.backgroundColor = backgroundColor; this.backgroundColor = backgroundColor;
hasBackgroundColor = true; hasBackgroundColor = true;
...@@ -265,11 +273,13 @@ public final class WebvttCssStyle { ...@@ -265,11 +273,13 @@ public final class WebvttCssStyle {
return hasBackgroundColor; return hasBackgroundColor;
} }
@CanIgnoreReturnValue
public WebvttCssStyle setFontSize(float fontSize) { public WebvttCssStyle setFontSize(float fontSize) {
this.fontSize = fontSize; this.fontSize = fontSize;
return this; return this;
} }
@CanIgnoreReturnValue
public WebvttCssStyle setFontSizeUnit(@FontSizeUnit int unit) { public WebvttCssStyle setFontSizeUnit(@FontSizeUnit int unit) {
this.fontSizeUnit = unit; this.fontSizeUnit = unit;
return this; return this;
...@@ -283,6 +293,7 @@ public final class WebvttCssStyle { ...@@ -283,6 +293,7 @@ public final class WebvttCssStyle {
return fontSize; return fontSize;
} }
@CanIgnoreReturnValue
public WebvttCssStyle setRubyPosition(@TextAnnotation.Position int rubyPosition) { public WebvttCssStyle setRubyPosition(@TextAnnotation.Position int rubyPosition) {
this.rubyPosition = rubyPosition; this.rubyPosition = rubyPosition;
return this; return this;
...@@ -292,6 +303,7 @@ public final class WebvttCssStyle { ...@@ -292,6 +303,7 @@ public final class WebvttCssStyle {
return rubyPosition; return rubyPosition;
} }
@CanIgnoreReturnValue
public WebvttCssStyle setCombineUpright(boolean enabled) { public WebvttCssStyle setCombineUpright(boolean enabled) {
this.combineUpright = enabled; this.combineUpright = enabled;
return this; return this;
......
...@@ -26,6 +26,7 @@ import androidx.annotation.Nullable; ...@@ -26,6 +26,7 @@ import androidx.annotation.Nullable;
import androidx.media3.common.Bundleable; import androidx.media3.common.Bundleable;
import androidx.media3.common.Player; import androidx.media3.common.Player;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -65,6 +66,7 @@ public final class CommandButton implements Bundleable { ...@@ -65,6 +66,7 @@ public final class CommandButton implements Bundleable {
* @param sessionCommand The session command. * @param sessionCommand The session command.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@CanIgnoreReturnValue
public Builder setSessionCommand(SessionCommand sessionCommand) { public Builder setSessionCommand(SessionCommand sessionCommand) {
checkNotNull(sessionCommand, "sessionCommand should not be null."); checkNotNull(sessionCommand, "sessionCommand should not be null.");
checkArgument( checkArgument(
...@@ -83,6 +85,7 @@ public final class CommandButton implements Bundleable { ...@@ -83,6 +85,7 @@ public final class CommandButton implements Bundleable {
* @param playerCommand The player command. * @param playerCommand The player command.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@CanIgnoreReturnValue
public Builder setPlayerCommand(@Player.Command int playerCommand) { public Builder setPlayerCommand(@Player.Command int playerCommand) {
checkArgument( checkArgument(
sessionCommand == null, sessionCommand == null,
...@@ -102,6 +105,7 @@ public final class CommandButton implements Bundleable { ...@@ -102,6 +105,7 @@ public final class CommandButton implements Bundleable {
* @param resId The resource id of an icon. * @param resId The resource id of an icon.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@CanIgnoreReturnValue
public Builder setIconResId(@DrawableRes int resId) { public Builder setIconResId(@DrawableRes int resId) {
iconResId = resId; iconResId = resId;
return this; return this;
...@@ -113,6 +117,7 @@ public final class CommandButton implements Bundleable { ...@@ -113,6 +117,7 @@ public final class CommandButton implements Bundleable {
* @param displayName The display name. * @param displayName The display name.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@CanIgnoreReturnValue
public Builder setDisplayName(CharSequence displayName) { public Builder setDisplayName(CharSequence displayName) {
this.displayName = displayName; this.displayName = displayName;
return this; return this;
...@@ -124,6 +129,7 @@ public final class CommandButton implements Bundleable { ...@@ -124,6 +129,7 @@ public final class CommandButton implements Bundleable {
* @param enabled Whether the button is enabled. * @param enabled Whether the button is enabled.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@CanIgnoreReturnValue
public Builder setEnabled(boolean enabled) { public Builder setEnabled(boolean enabled) {
this.enabled = enabled; this.enabled = enabled;
return this; return this;
...@@ -135,6 +141,7 @@ public final class CommandButton implements Bundleable { ...@@ -135,6 +141,7 @@ public final class CommandButton implements Bundleable {
* @param extras The extra {@link Bundle}. * @param extras The extra {@link Bundle}.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@CanIgnoreReturnValue
public Builder setExtras(Bundle extras) { public Builder setExtras(Bundle extras) {
this.extras = new Bundle(extras); this.extras = new Bundle(extras);
return this; return this;
......
...@@ -37,6 +37,7 @@ import androidx.media3.session.MediaLibraryService.LibraryParams; ...@@ -37,6 +37,7 @@ import androidx.media3.session.MediaLibraryService.LibraryParams;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import org.checkerframework.checker.initialization.qual.NotOnlyInitialized; import org.checkerframework.checker.initialization.qual.NotOnlyInitialized;
import org.checkerframework.checker.initialization.qual.UnderInitialization; import org.checkerframework.checker.initialization.qual.UnderInitialization;
...@@ -87,6 +88,7 @@ public final class MediaBrowser extends MediaController { ...@@ -87,6 +88,7 @@ public final class MediaBrowser extends MediaController {
* @param connectionHints A bundle containing the connection hints. * @param connectionHints A bundle containing the connection hints.
* @return The builder to allow chaining. * @return The builder to allow chaining.
*/ */
@CanIgnoreReturnValue
public Builder setConnectionHints(Bundle connectionHints) { public Builder setConnectionHints(Bundle connectionHints) {
this.connectionHints = new Bundle(checkNotNull(connectionHints)); this.connectionHints = new Bundle(checkNotNull(connectionHints));
return this; return this;
...@@ -98,6 +100,7 @@ public final class MediaBrowser extends MediaController { ...@@ -98,6 +100,7 @@ public final class MediaBrowser extends MediaController {
* @param listener The listener. * @param listener The listener.
* @return The builder to allow chaining. * @return The builder to allow chaining.
*/ */
@CanIgnoreReturnValue
public Builder setListener(Listener listener) { public Builder setListener(Listener listener) {
this.listener = checkNotNull(listener); this.listener = checkNotNull(listener);
return this; return this;
...@@ -112,6 +115,7 @@ public final class MediaBrowser extends MediaController { ...@@ -112,6 +115,7 @@ public final class MediaBrowser extends MediaController {
* @param looper The looper. * @param looper The looper.
* @return The builder to allow chaining. * @return The builder to allow chaining.
*/ */
@CanIgnoreReturnValue
public Builder setApplicationLooper(Looper looper) { public Builder setApplicationLooper(Looper looper) {
applicationLooper = checkNotNull(looper); applicationLooper = checkNotNull(looper);
return this; return this;
......
...@@ -59,6 +59,7 @@ import androidx.media3.common.util.Util; ...@@ -59,6 +59,7 @@ import androidx.media3.common.util.Util;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.List; import java.util.List;
import java.util.concurrent.CancellationException; import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
...@@ -222,6 +223,7 @@ public class MediaController implements Player { ...@@ -222,6 +223,7 @@ public class MediaController implements Player {
* @param connectionHints A bundle containing the connection hints. * @param connectionHints A bundle containing the connection hints.
* @return The builder to allow chaining. * @return The builder to allow chaining.
*/ */
@CanIgnoreReturnValue
public Builder setConnectionHints(Bundle connectionHints) { public Builder setConnectionHints(Bundle connectionHints) {
this.connectionHints = new Bundle(checkNotNull(connectionHints)); this.connectionHints = new Bundle(checkNotNull(connectionHints));
return this; return this;
...@@ -233,6 +235,7 @@ public class MediaController implements Player { ...@@ -233,6 +235,7 @@ public class MediaController implements Player {
* @param listener The listener. * @param listener The listener.
* @return The builder to allow chaining. * @return The builder to allow chaining.
*/ */
@CanIgnoreReturnValue
public Builder setListener(Listener listener) { public Builder setListener(Listener listener) {
this.listener = checkNotNull(listener); this.listener = checkNotNull(listener);
return this; return this;
...@@ -247,6 +250,7 @@ public class MediaController implements Player { ...@@ -247,6 +250,7 @@ public class MediaController implements Player {
* @param looper The looper. * @param looper The looper.
* @return The builder to allow chaining. * @return The builder to allow chaining.
*/ */
@CanIgnoreReturnValue
public Builder setApplicationLooper(Looper looper) { public Builder setApplicationLooper(Looper looper) {
applicationLooper = checkNotNull(looper); applicationLooper = checkNotNull(looper);
return this; return this;
......
...@@ -39,6 +39,7 @@ import androidx.media3.session.MediaSession.ControllerInfo; ...@@ -39,6 +39,7 @@ import androidx.media3.session.MediaSession.ControllerInfo;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -592,24 +593,28 @@ public abstract class MediaLibraryService extends MediaSessionService { ...@@ -592,24 +593,28 @@ public abstract class MediaLibraryService extends MediaSessionService {
} }
/** Sets whether the media items are recently played. */ /** Sets whether the media items are recently played. */
@CanIgnoreReturnValue
public Builder setRecent(boolean recent) { public Builder setRecent(boolean recent) {
this.recent = recent; this.recent = recent;
return this; return this;
} }
/** Sets whether the media items can be played without an internet connection. */ /** Sets whether the media items can be played without an internet connection. */
@CanIgnoreReturnValue
public Builder setOffline(boolean offline) { public Builder setOffline(boolean offline) {
this.offline = offline; this.offline = offline;
return this; return this;
} }
/** Sets whether the media items are suggested. */ /** Sets whether the media items are suggested. */
@CanIgnoreReturnValue
public Builder setSuggested(boolean suggested) { public Builder setSuggested(boolean suggested) {
this.suggested = suggested; this.suggested = suggested;
return this; return this;
} }
/** Set an extra {@link Bundle}. */ /** Set an extra {@link Bundle}. */
@CanIgnoreReturnValue
@UnstableApi @UnstableApi
public Builder setExtras(Bundle extras) { public Builder setExtras(Bundle extras) {
this.extras = checkNotNull(extras); this.extras = checkNotNull(extras);
......
...@@ -30,6 +30,7 @@ import androidx.annotation.RequiresApi; ...@@ -30,6 +30,7 @@ import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationBuilderWithBuilderAccessor; import androidx.core.app.NotificationBuilderWithBuilderAccessor;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import org.checkerframework.checker.nullness.compatqual.NullableType; import org.checkerframework.checker.nullness.compatqual.NullableType;
/** /**
...@@ -124,6 +125,7 @@ public class MediaStyleNotificationHelper { ...@@ -124,6 +125,7 @@ public class MediaStyleNotificationHelper {
* *
* @param actions the indices of the actions to show in the compact notification view * @param actions the indices of the actions to show in the compact notification view
*/ */
@CanIgnoreReturnValue
public MediaStyle setShowActionsInCompactView(int... actions) { public MediaStyle setShowActionsInCompactView(int... actions) {
actionsToShowInCompact = actions; actionsToShowInCompact = actions;
return this; return this;
...@@ -153,6 +155,7 @@ public class MediaStyleNotificationHelper { ...@@ -153,6 +155,7 @@ public class MediaStyleNotificationHelper {
* *
* @param show whether to show a cancel button * @param show whether to show a cancel button
*/ */
@CanIgnoreReturnValue
public MediaStyle setShowCancelButton(boolean show) { public MediaStyle setShowCancelButton(boolean show) {
if (Build.VERSION.SDK_INT < 21) { if (Build.VERSION.SDK_INT < 21) {
showCancelButton = show; showCancelButton = show;
...@@ -166,6 +169,7 @@ public class MediaStyleNotificationHelper { ...@@ -166,6 +169,7 @@ public class MediaStyleNotificationHelper {
* *
* @param pendingIntent the intent to be sent when the cancel button is pressed * @param pendingIntent the intent to be sent when the cancel button is pressed
*/ */
@CanIgnoreReturnValue
public MediaStyle setCancelButtonIntent(PendingIntent pendingIntent) { public MediaStyle setCancelButtonIntent(PendingIntent pendingIntent) {
cancelButtonIntent = pendingIntent; cancelButtonIntent = pendingIntent;
return this; return this;
......
...@@ -47,6 +47,7 @@ import androidx.media3.common.VideoSize; ...@@ -47,6 +47,7 @@ import androidx.media3.common.VideoSize;
import androidx.media3.common.text.CueGroup; import androidx.media3.common.text.CueGroup;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -127,154 +128,184 @@ import java.lang.annotation.Target; ...@@ -127,154 +128,184 @@ import java.lang.annotation.Target;
trackSelectionParameters = playerInfo.trackSelectionParameters; trackSelectionParameters = playerInfo.trackSelectionParameters;
} }
@CanIgnoreReturnValue
public Builder setPlayerError(@Nullable PlaybackException playerError) { public Builder setPlayerError(@Nullable PlaybackException playerError) {
this.playerError = playerError; this.playerError = playerError;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setMediaItemTransitionReason( public Builder setMediaItemTransitionReason(
@Player.MediaItemTransitionReason int mediaItemTransitionReason) { @Player.MediaItemTransitionReason int mediaItemTransitionReason) {
this.mediaItemTransitionReason = mediaItemTransitionReason; this.mediaItemTransitionReason = mediaItemTransitionReason;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setSessionPositionInfo(SessionPositionInfo sessionPositionInfo) { public Builder setSessionPositionInfo(SessionPositionInfo sessionPositionInfo) {
this.sessionPositionInfo = sessionPositionInfo; this.sessionPositionInfo = sessionPositionInfo;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setOldPositionInfo(PositionInfo oldPositionInfo) { public Builder setOldPositionInfo(PositionInfo oldPositionInfo) {
this.oldPositionInfo = oldPositionInfo; this.oldPositionInfo = oldPositionInfo;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setNewPositionInfo(PositionInfo newPositionInfo) { public Builder setNewPositionInfo(PositionInfo newPositionInfo) {
this.newPositionInfo = newPositionInfo; this.newPositionInfo = newPositionInfo;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setDiscontinuityReason(@Player.DiscontinuityReason int discontinuityReason) { public Builder setDiscontinuityReason(@Player.DiscontinuityReason int discontinuityReason) {
this.discontinuityReason = discontinuityReason; this.discontinuityReason = discontinuityReason;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setPlaybackParameters(PlaybackParameters playbackParameters) { public Builder setPlaybackParameters(PlaybackParameters playbackParameters) {
this.playbackParameters = playbackParameters; this.playbackParameters = playbackParameters;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setRepeatMode(@Player.RepeatMode int repeatMode) { public Builder setRepeatMode(@Player.RepeatMode int repeatMode) {
this.repeatMode = repeatMode; this.repeatMode = repeatMode;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setShuffleModeEnabled(boolean shuffleModeEnabled) { public Builder setShuffleModeEnabled(boolean shuffleModeEnabled) {
this.shuffleModeEnabled = shuffleModeEnabled; this.shuffleModeEnabled = shuffleModeEnabled;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setTimeline(Timeline timeline) { public Builder setTimeline(Timeline timeline) {
this.timeline = timeline; this.timeline = timeline;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setVideoSize(VideoSize videoSize) { public Builder setVideoSize(VideoSize videoSize) {
this.videoSize = videoSize; this.videoSize = videoSize;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setPlaylistMetadata(MediaMetadata playlistMetadata) { public Builder setPlaylistMetadata(MediaMetadata playlistMetadata) {
this.playlistMetadata = playlistMetadata; this.playlistMetadata = playlistMetadata;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setVolume(@FloatRange(from = 0, to = 1) float volume) { public Builder setVolume(@FloatRange(from = 0, to = 1) float volume) {
this.volume = volume; this.volume = volume;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setAudioAttributes(AudioAttributes audioAttributes) { public Builder setAudioAttributes(AudioAttributes audioAttributes) {
this.audioAttributes = audioAttributes; this.audioAttributes = audioAttributes;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setCues(CueGroup cueGroup) { public Builder setCues(CueGroup cueGroup) {
this.cueGroup = cueGroup; this.cueGroup = cueGroup;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setDeviceInfo(DeviceInfo deviceInfo) { public Builder setDeviceInfo(DeviceInfo deviceInfo) {
this.deviceInfo = deviceInfo; this.deviceInfo = deviceInfo;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setDeviceVolume(int deviceVolume) { public Builder setDeviceVolume(int deviceVolume) {
this.deviceVolume = deviceVolume; this.deviceVolume = deviceVolume;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setDeviceMuted(boolean deviceMuted) { public Builder setDeviceMuted(boolean deviceMuted) {
this.deviceMuted = deviceMuted; this.deviceMuted = deviceMuted;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setPlayWhenReady(boolean playWhenReady) { public Builder setPlayWhenReady(boolean playWhenReady) {
this.playWhenReady = playWhenReady; this.playWhenReady = playWhenReady;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setPlayWhenReadyChangedReason( public Builder setPlayWhenReadyChangedReason(
@Player.PlayWhenReadyChangeReason int playWhenReadyChangedReason) { @Player.PlayWhenReadyChangeReason int playWhenReadyChangedReason) {
this.playWhenReadyChangedReason = playWhenReadyChangedReason; this.playWhenReadyChangedReason = playWhenReadyChangedReason;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setIsPlaying(boolean isPlaying) { public Builder setIsPlaying(boolean isPlaying) {
this.isPlaying = isPlaying; this.isPlaying = isPlaying;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setIsLoading(boolean isLoading) { public Builder setIsLoading(boolean isLoading) {
this.isLoading = isLoading; this.isLoading = isLoading;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setPlaybackSuppressionReason( public Builder setPlaybackSuppressionReason(
@PlaybackSuppressionReason int playbackSuppressionReason) { @PlaybackSuppressionReason int playbackSuppressionReason) {
this.playbackSuppressionReason = playbackSuppressionReason; this.playbackSuppressionReason = playbackSuppressionReason;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setPlaybackState(@State int playbackState) { public Builder setPlaybackState(@State int playbackState) {
this.playbackState = playbackState; this.playbackState = playbackState;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setMediaMetadata(MediaMetadata mediaMetadata) { public Builder setMediaMetadata(MediaMetadata mediaMetadata) {
this.mediaMetadata = mediaMetadata; this.mediaMetadata = mediaMetadata;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setSeekBackIncrement(long seekBackIncrementMs) { public Builder setSeekBackIncrement(long seekBackIncrementMs) {
this.seekBackIncrementMs = seekBackIncrementMs; this.seekBackIncrementMs = seekBackIncrementMs;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setSeekForwardIncrement(long seekForwardIncrementMs) { public Builder setSeekForwardIncrement(long seekForwardIncrementMs) {
this.seekForwardIncrementMs = seekForwardIncrementMs; this.seekForwardIncrementMs = seekForwardIncrementMs;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setMaxSeekToPreviousPositionMs(long maxSeekToPreviousPositionMs) { public Builder setMaxSeekToPreviousPositionMs(long maxSeekToPreviousPositionMs) {
this.maxSeekToPreviousPositionMs = maxSeekToPreviousPositionMs; this.maxSeekToPreviousPositionMs = maxSeekToPreviousPositionMs;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setCurrentTracks(Tracks tracks) { public Builder setCurrentTracks(Tracks tracks) {
currentTracks = tracks; currentTracks = tracks;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setTrackSelectionParameters(TrackSelectionParameters parameters) { public Builder setTrackSelectionParameters(TrackSelectionParameters parameters) {
trackSelectionParameters = parameters; trackSelectionParameters = parameters;
return this; return this;
......
...@@ -29,6 +29,7 @@ import androidx.media3.common.util.Log; ...@@ -29,6 +29,7 @@ import androidx.media3.common.util.Log;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.session.SessionCommand.CommandCode; import androidx.media3.session.SessionCommand.CommandCode;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -65,6 +66,7 @@ public final class SessionCommands implements Bundleable { ...@@ -65,6 +66,7 @@ public final class SessionCommands implements Bundleable {
* @param command A command to add. * @param command A command to add.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@CanIgnoreReturnValue
public Builder add(SessionCommand command) { public Builder add(SessionCommand command) {
commands.add(checkNotNull(command)); commands.add(checkNotNull(command));
return this; return this;
...@@ -77,6 +79,7 @@ public final class SessionCommands implements Bundleable { ...@@ -77,6 +79,7 @@ public final class SessionCommands implements Bundleable {
* @param commandCode A command code to build command and add. * @param commandCode A command code to build command and add.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@CanIgnoreReturnValue
public Builder add(@CommandCode int commandCode) { public Builder add(@CommandCode int commandCode) {
checkArgument(commandCode != COMMAND_CODE_CUSTOM); checkArgument(commandCode != COMMAND_CODE_CUSTOM);
commands.add(new SessionCommand(commandCode)); commands.add(new SessionCommand(commandCode));
...@@ -89,6 +92,7 @@ public final class SessionCommands implements Bundleable { ...@@ -89,6 +92,7 @@ public final class SessionCommands implements Bundleable {
* @param command A command to find. * @param command A command to find.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@CanIgnoreReturnValue
public Builder remove(SessionCommand command) { public Builder remove(SessionCommand command) {
commands.remove(checkNotNull(command)); commands.remove(checkNotNull(command));
return this; return this;
...@@ -101,6 +105,7 @@ public final class SessionCommands implements Bundleable { ...@@ -101,6 +105,7 @@ public final class SessionCommands implements Bundleable {
* @param commandCode A command code to find. * @param commandCode A command code to find.
* @return This builder for chaining. * @return This builder for chaining.
*/ */
@CanIgnoreReturnValue
public Builder remove(@CommandCode int commandCode) { public Builder remove(@CommandCode int commandCode) {
checkArgument(commandCode != COMMAND_CODE_CUSTOM); checkArgument(commandCode != COMMAND_CODE_CUSTOM);
for (SessionCommand command : commands) { for (SessionCommand command : commands) {
...@@ -117,7 +122,8 @@ public final class SessionCommands implements Bundleable { ...@@ -117,7 +122,8 @@ public final class SessionCommands implements Bundleable {
* *
* @return This builder for chaining. * @return This builder for chaining.
*/ */
/* package */ Builder addAllSessionCommands() { /* package */ @CanIgnoreReturnValue
Builder addAllSessionCommands() {
addCommandCodes(SessionCommand.SESSION_COMMANDS); addCommandCodes(SessionCommand.SESSION_COMMANDS);
return this; return this;
} }
...@@ -127,7 +133,8 @@ public final class SessionCommands implements Bundleable { ...@@ -127,7 +133,8 @@ public final class SessionCommands implements Bundleable {
* *
* @return This builder for chaining. * @return This builder for chaining.
*/ */
/* package */ Builder addAllLibraryCommands() { /* package */ @CanIgnoreReturnValue
Builder addAllLibraryCommands() {
addCommandCodes(SessionCommand.LIBRARY_COMMANDS); addCommandCodes(SessionCommand.LIBRARY_COMMANDS);
return this; return this;
} }
...@@ -137,7 +144,8 @@ public final class SessionCommands implements Bundleable { ...@@ -137,7 +144,8 @@ public final class SessionCommands implements Bundleable {
* *
* @return This builder for chaining. * @return This builder for chaining.
*/ */
/* package */ Builder addAllPredefinedCommands() { /* package */ @CanIgnoreReturnValue
Builder addAllPredefinedCommands() {
addAllSessionCommands(); addAllSessionCommands();
addAllLibraryCommands(); addAllLibraryCommands();
return this; return this;
......
...@@ -59,6 +59,7 @@ import androidx.media3.test.utils.HostActivity.HostedTest; ...@@ -59,6 +59,7 @@ import androidx.media3.test.utils.HostActivity.HostedTest;
import androidx.test.core.app.ApplicationProvider; import androidx.test.core.app.ApplicationProvider;
import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.platform.app.InstrumentationRegistry;
import com.google.common.primitives.Ints; import com.google.common.primitives.Ints;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -128,16 +129,19 @@ import java.util.List; ...@@ -128,16 +129,19 @@ import java.util.List;
this.activity = activity; this.activity = activity;
} }
@CanIgnoreReturnValue
public DashTestRunner setStreamName(String streamName) { public DashTestRunner setStreamName(String streamName) {
this.streamName = streamName; this.streamName = streamName;
return this; return this;
} }
@CanIgnoreReturnValue
public DashTestRunner setFullPlaybackNoSeeking(boolean fullPlaybackNoSeeking) { public DashTestRunner setFullPlaybackNoSeeking(boolean fullPlaybackNoSeeking) {
this.fullPlaybackNoSeeking = fullPlaybackNoSeeking; this.fullPlaybackNoSeeking = fullPlaybackNoSeeking;
return this; return this;
} }
@CanIgnoreReturnValue
public DashTestRunner setCanIncludeAdditionalVideoFormats( public DashTestRunner setCanIncludeAdditionalVideoFormats(
boolean canIncludeAdditionalVideoFormats) { boolean canIncludeAdditionalVideoFormats) {
this.canIncludeAdditionalVideoFormats = this.canIncludeAdditionalVideoFormats =
...@@ -145,27 +149,32 @@ import java.util.List; ...@@ -145,27 +149,32 @@ import java.util.List;
return this; return this;
} }
@CanIgnoreReturnValue
public DashTestRunner setActionSchedule(ActionSchedule actionSchedule) { public DashTestRunner setActionSchedule(ActionSchedule actionSchedule) {
this.actionSchedule = actionSchedule; this.actionSchedule = actionSchedule;
return this; return this;
} }
@CanIgnoreReturnValue
public DashTestRunner setOfflineLicenseKeySetId(byte[] offlineLicenseKeySetId) { public DashTestRunner setOfflineLicenseKeySetId(byte[] offlineLicenseKeySetId) {
this.offlineLicenseKeySetId = offlineLicenseKeySetId; this.offlineLicenseKeySetId = offlineLicenseKeySetId;
return this; return this;
} }
@CanIgnoreReturnValue
public DashTestRunner setAudioVideoFormats(String audioFormat, String... videoFormats) { public DashTestRunner setAudioVideoFormats(String audioFormat, String... videoFormats) {
this.audioFormat = audioFormat; this.audioFormat = audioFormat;
this.videoFormats = videoFormats; this.videoFormats = videoFormats;
return this; return this;
} }
@CanIgnoreReturnValue
public DashTestRunner setManifestUrl(String manifestUrl) { public DashTestRunner setManifestUrl(String manifestUrl) {
this.manifestUrl = manifestUrl; this.manifestUrl = manifestUrl;
return this; return this;
} }
@CanIgnoreReturnValue
public DashTestRunner setWidevineInfo(String mimeType, boolean videoIdRequiredInLicenseUrl) { public DashTestRunner setWidevineInfo(String mimeType, boolean videoIdRequiredInLicenseUrl) {
this.useL1Widevine = isL1WidevineAvailable(mimeType); this.useL1Widevine = isL1WidevineAvailable(mimeType);
this.widevineLicenseUrl = this.widevineLicenseUrl =
...@@ -173,6 +182,7 @@ import java.util.List; ...@@ -173,6 +182,7 @@ import java.util.List;
return this; return this;
} }
@CanIgnoreReturnValue
public DashTestRunner setDataSourceFactory(DataSource.Factory dataSourceFactory) { public DashTestRunner setDataSourceFactory(DataSource.Factory dataSourceFactory) {
this.dataSourceFactory = dataSourceFactory; this.dataSourceFactory = dataSourceFactory;
return this; return this;
......
...@@ -44,6 +44,7 @@ import androidx.media3.common.util.UnstableApi; ...@@ -44,6 +44,7 @@ import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -1329,17 +1330,20 @@ public class MockPlayer implements Player { ...@@ -1329,17 +1330,20 @@ public class MockPlayer implements Player {
applicationLooper = Util.getCurrentOrMainLooper(); applicationLooper = Util.getCurrentOrMainLooper();
} }
@CanIgnoreReturnValue
public Builder setChangePlayerStateWithTransportControl( public Builder setChangePlayerStateWithTransportControl(
boolean changePlayerStateWithTransportControl) { boolean changePlayerStateWithTransportControl) {
this.changePlayerStateWithTransportControl = changePlayerStateWithTransportControl; this.changePlayerStateWithTransportControl = changePlayerStateWithTransportControl;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setApplicationLooper(Looper applicationLooper) { public Builder setApplicationLooper(Looper applicationLooper) {
this.applicationLooper = applicationLooper; this.applicationLooper = applicationLooper;
return this; return this;
} }
@CanIgnoreReturnValue
public Builder setMediaItems(int itemCount) { public Builder setMediaItems(int itemCount) {
this.itemCount = itemCount; this.itemCount = itemCount;
return this; return this;
......
...@@ -85,6 +85,7 @@ import androidx.media3.common.util.Log; ...@@ -85,6 +85,7 @@ import androidx.media3.common.util.Log;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.test.session.common.IRemoteMediaSession; import androidx.media3.test.session.common.IRemoteMediaSession;
import androidx.media3.test.session.common.TestUtils; import androidx.media3.test.session.common.TestUtils;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
...@@ -503,6 +504,7 @@ public class RemoteMediaSession { ...@@ -503,6 +504,7 @@ public class RemoteMediaSession {
bundle = new Bundle(); bundle = new Bundle();
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setPlayerError(@Nullable PlaybackException playerError) { public MockPlayerConfigBuilder setPlayerError(@Nullable PlaybackException playerError) {
if (playerError != null) { if (playerError != null) {
bundle.putBundle(KEY_PLAYER_ERROR, playerError.toBundle()); bundle.putBundle(KEY_PLAYER_ERROR, playerError.toBundle());
...@@ -510,189 +512,226 @@ public class RemoteMediaSession { ...@@ -510,189 +512,226 @@ public class RemoteMediaSession {
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setDuration(long duration) { public MockPlayerConfigBuilder setDuration(long duration) {
bundle.putLong(KEY_DURATION, duration); bundle.putLong(KEY_DURATION, duration);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setCurrentPosition(long pos) { public MockPlayerConfigBuilder setCurrentPosition(long pos) {
bundle.putLong(KEY_CURRENT_POSITION, pos); bundle.putLong(KEY_CURRENT_POSITION, pos);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setBufferedPosition(long buffPos) { public MockPlayerConfigBuilder setBufferedPosition(long buffPos) {
bundle.putLong(KEY_BUFFERED_POSITION, buffPos); bundle.putLong(KEY_BUFFERED_POSITION, buffPos);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setBufferedPercentage(int bufferedPercentage) { public MockPlayerConfigBuilder setBufferedPercentage(int bufferedPercentage) {
bundle.putInt(KEY_BUFFERED_PERCENTAGE, bufferedPercentage); bundle.putInt(KEY_BUFFERED_PERCENTAGE, bufferedPercentage);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setTotalBufferedDuration(long totalBufferedDuration) { public MockPlayerConfigBuilder setTotalBufferedDuration(long totalBufferedDuration) {
bundle.putLong(KEY_TOTAL_BUFFERED_DURATION, totalBufferedDuration); bundle.putLong(KEY_TOTAL_BUFFERED_DURATION, totalBufferedDuration);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setCurrentLiveOffset(long currentLiveOffset) { public MockPlayerConfigBuilder setCurrentLiveOffset(long currentLiveOffset) {
bundle.putLong(KEY_CURRENT_LIVE_OFFSET, currentLiveOffset); bundle.putLong(KEY_CURRENT_LIVE_OFFSET, currentLiveOffset);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setContentDuration(long contentDuration) { public MockPlayerConfigBuilder setContentDuration(long contentDuration) {
bundle.putLong(KEY_CONTENT_DURATION, contentDuration); bundle.putLong(KEY_CONTENT_DURATION, contentDuration);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setContentPosition(long contentPosition) { public MockPlayerConfigBuilder setContentPosition(long contentPosition) {
bundle.putLong(KEY_CONTENT_POSITION, contentPosition); bundle.putLong(KEY_CONTENT_POSITION, contentPosition);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setContentBufferedPosition(long contentBufferedPosition) { public MockPlayerConfigBuilder setContentBufferedPosition(long contentBufferedPosition) {
bundle.putLong(KEY_CONTENT_BUFFERED_POSITION, contentBufferedPosition); bundle.putLong(KEY_CONTENT_BUFFERED_POSITION, contentBufferedPosition);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setIsPlayingAd(boolean isPlayingAd) { public MockPlayerConfigBuilder setIsPlayingAd(boolean isPlayingAd) {
bundle.putBoolean(KEY_IS_PLAYING_AD, isPlayingAd); bundle.putBoolean(KEY_IS_PLAYING_AD, isPlayingAd);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setCurrentAdGroupIndex(int currentAdGroupIndex) { public MockPlayerConfigBuilder setCurrentAdGroupIndex(int currentAdGroupIndex) {
bundle.putInt(KEY_CURRENT_AD_GROUP_INDEX, currentAdGroupIndex); bundle.putInt(KEY_CURRENT_AD_GROUP_INDEX, currentAdGroupIndex);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setCurrentAdIndexInAdGroup(int currentAdIndexInAdGroup) { public MockPlayerConfigBuilder setCurrentAdIndexInAdGroup(int currentAdIndexInAdGroup) {
bundle.putInt(KEY_CURRENT_AD_INDEX_IN_AD_GROUP, currentAdIndexInAdGroup); bundle.putInt(KEY_CURRENT_AD_INDEX_IN_AD_GROUP, currentAdIndexInAdGroup);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setPlaybackParameters(PlaybackParameters playbackParameters) { public MockPlayerConfigBuilder setPlaybackParameters(PlaybackParameters playbackParameters) {
bundle.putBundle(KEY_PLAYBACK_PARAMETERS, playbackParameters.toBundle()); bundle.putBundle(KEY_PLAYBACK_PARAMETERS, playbackParameters.toBundle());
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setAudioAttributes(AudioAttributes audioAttributes) { public MockPlayerConfigBuilder setAudioAttributes(AudioAttributes audioAttributes) {
bundle.putBundle(KEY_AUDIO_ATTRIBUTES, audioAttributes.toBundle()); bundle.putBundle(KEY_AUDIO_ATTRIBUTES, audioAttributes.toBundle());
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setTimeline(Timeline timeline) { public MockPlayerConfigBuilder setTimeline(Timeline timeline) {
bundle.putBundle(KEY_TIMELINE, timeline.toBundle()); bundle.putBundle(KEY_TIMELINE, timeline.toBundle());
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setCurrentMediaItemIndex(int index) { public MockPlayerConfigBuilder setCurrentMediaItemIndex(int index) {
bundle.putInt(KEY_CURRENT_MEDIA_ITEM_INDEX, index); bundle.putInt(KEY_CURRENT_MEDIA_ITEM_INDEX, index);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setCurrentPeriodIndex(int index) { public MockPlayerConfigBuilder setCurrentPeriodIndex(int index) {
bundle.putInt(KEY_CURRENT_PERIOD_INDEX, index); bundle.putInt(KEY_CURRENT_PERIOD_INDEX, index);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setPlaylistMetadata(MediaMetadata playlistMetadata) { public MockPlayerConfigBuilder setPlaylistMetadata(MediaMetadata playlistMetadata) {
bundle.putBundle(KEY_PLAYLIST_METADATA, playlistMetadata.toBundle()); bundle.putBundle(KEY_PLAYLIST_METADATA, playlistMetadata.toBundle());
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setVideoSize(VideoSize videoSize) { public MockPlayerConfigBuilder setVideoSize(VideoSize videoSize) {
bundle.putBundle(KEY_VIDEO_SIZE, videoSize.toBundle()); bundle.putBundle(KEY_VIDEO_SIZE, videoSize.toBundle());
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setVolume(float volume) { public MockPlayerConfigBuilder setVolume(float volume) {
bundle.putFloat(KEY_VOLUME, volume); bundle.putFloat(KEY_VOLUME, volume);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setCurrentCues(CueGroup cueGroup) { public MockPlayerConfigBuilder setCurrentCues(CueGroup cueGroup) {
bundle.putBundle(KEY_CURRENT_CUE_GROUP, cueGroup.toBundle()); bundle.putBundle(KEY_CURRENT_CUE_GROUP, cueGroup.toBundle());
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setDeviceInfo(DeviceInfo deviceInfo) { public MockPlayerConfigBuilder setDeviceInfo(DeviceInfo deviceInfo) {
bundle.putBundle(KEY_DEVICE_INFO, deviceInfo.toBundle()); bundle.putBundle(KEY_DEVICE_INFO, deviceInfo.toBundle());
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setDeviceVolume(int volume) { public MockPlayerConfigBuilder setDeviceVolume(int volume) {
bundle.putInt(KEY_DEVICE_VOLUME, volume); bundle.putInt(KEY_DEVICE_VOLUME, volume);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setDeviceMuted(boolean muted) { public MockPlayerConfigBuilder setDeviceMuted(boolean muted) {
bundle.putBoolean(KEY_DEVICE_MUTED, muted); bundle.putBoolean(KEY_DEVICE_MUTED, muted);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setPlayWhenReady(boolean playWhenReady) { public MockPlayerConfigBuilder setPlayWhenReady(boolean playWhenReady) {
bundle.putBoolean(KEY_PLAY_WHEN_READY, playWhenReady); bundle.putBoolean(KEY_PLAY_WHEN_READY, playWhenReady);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setPlaybackSuppressionReason( public MockPlayerConfigBuilder setPlaybackSuppressionReason(
@Player.PlaybackSuppressionReason int playbackSuppressionReason) { @Player.PlaybackSuppressionReason int playbackSuppressionReason) {
bundle.putInt(KEY_PLAYBACK_SUPPRESSION_REASON, playbackSuppressionReason); bundle.putInt(KEY_PLAYBACK_SUPPRESSION_REASON, playbackSuppressionReason);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setPlaybackState(@Player.State int state) { public MockPlayerConfigBuilder setPlaybackState(@Player.State int state) {
bundle.putInt(KEY_PLAYBACK_STATE, state); bundle.putInt(KEY_PLAYBACK_STATE, state);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setIsPlaying(boolean isPlaying) { public MockPlayerConfigBuilder setIsPlaying(boolean isPlaying) {
bundle.putBoolean(KEY_IS_PLAYING, isPlaying); bundle.putBoolean(KEY_IS_PLAYING, isPlaying);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setIsLoading(boolean isLoading) { public MockPlayerConfigBuilder setIsLoading(boolean isLoading) {
bundle.putBoolean(KEY_IS_LOADING, isLoading); bundle.putBoolean(KEY_IS_LOADING, isLoading);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setRepeatMode(@Player.RepeatMode int repeatMode) { public MockPlayerConfigBuilder setRepeatMode(@Player.RepeatMode int repeatMode) {
bundle.putInt(KEY_REPEAT_MODE, repeatMode); bundle.putInt(KEY_REPEAT_MODE, repeatMode);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setShuffleModeEnabled(boolean shuffleModeEnabled) { public MockPlayerConfigBuilder setShuffleModeEnabled(boolean shuffleModeEnabled) {
bundle.putBoolean(KEY_SHUFFLE_MODE_ENABLED, shuffleModeEnabled); bundle.putBoolean(KEY_SHUFFLE_MODE_ENABLED, shuffleModeEnabled);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setSeekBackIncrement(long seekBackIncrementMs) { public MockPlayerConfigBuilder setSeekBackIncrement(long seekBackIncrementMs) {
bundle.putLong(KEY_SEEK_BACK_INCREMENT_MS, seekBackIncrementMs); bundle.putLong(KEY_SEEK_BACK_INCREMENT_MS, seekBackIncrementMs);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setSeekForwardIncrement(long seekForwardIncrementMs) { public MockPlayerConfigBuilder setSeekForwardIncrement(long seekForwardIncrementMs) {
bundle.putLong(KEY_SEEK_FORWARD_INCREMENT_MS, seekForwardIncrementMs); bundle.putLong(KEY_SEEK_FORWARD_INCREMENT_MS, seekForwardIncrementMs);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setMediaMetadata(MediaMetadata mediaMetadata) { public MockPlayerConfigBuilder setMediaMetadata(MediaMetadata mediaMetadata) {
bundle.putBundle(KEY_MEDIA_METADATA, mediaMetadata.toBundle()); bundle.putBundle(KEY_MEDIA_METADATA, mediaMetadata.toBundle());
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setMaxSeekToPreviousPositionMs( public MockPlayerConfigBuilder setMaxSeekToPreviousPositionMs(
long maxSeekToPreviousPositionMs) { long maxSeekToPreviousPositionMs) {
bundle.putLong(KEY_MAX_SEEK_TO_PREVIOUS_POSITION_MS, maxSeekToPreviousPositionMs); bundle.putLong(KEY_MAX_SEEK_TO_PREVIOUS_POSITION_MS, maxSeekToPreviousPositionMs);
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setTrackSelectionParameters( public MockPlayerConfigBuilder setTrackSelectionParameters(
TrackSelectionParameters parameters) { TrackSelectionParameters parameters) {
bundle.putBundle(KEY_TRACK_SELECTION_PARAMETERS, parameters.toBundle()); bundle.putBundle(KEY_TRACK_SELECTION_PARAMETERS, parameters.toBundle());
return this; return this;
} }
@CanIgnoreReturnValue
public MockPlayerConfigBuilder setCurrentTracks(Tracks tracks) { public MockPlayerConfigBuilder setCurrentTracks(Tracks tracks) {
bundle.putBundle(KEY_CURRENT_TRACKS, tracks.toBundle()); bundle.putBundle(KEY_CURRENT_TRACKS, tracks.toBundle());
return this; return this;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment