Add some missing @Nullable to public API to improve Kotlin compatiblity.
Kotlin will throw NPE whenever a method returns null or an interface is called with a null parameter and the respective values are not marked as @Nullable. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=213262886
This commit is contained in:
parent
76255dfae7
commit
c18ee3f96d
@ -296,7 +296,7 @@ public class SimpleExoPlayer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVideoSurface(Surface surface) {
|
||||
public void setVideoSurface(@Nullable Surface surface) {
|
||||
removeSurfaceCallbacks();
|
||||
setVideoSurfaceInternal(surface, false);
|
||||
int newSurfaceSize = surface == null ? 0 : C.LENGTH_UNSET;
|
||||
@ -828,7 +828,7 @@ public class SimpleExoPlayer
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExoPlaybackException getPlaybackError() {
|
||||
public @Nullable ExoPlaybackException getPlaybackError() {
|
||||
return player.getPlaybackError();
|
||||
}
|
||||
|
||||
@ -1028,7 +1028,7 @@ public class SimpleExoPlayer
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCurrentManifest() {
|
||||
public @Nullable Object getCurrentManifest() {
|
||||
return player.getCurrentManifest();
|
||||
}
|
||||
|
||||
@ -1134,7 +1134,7 @@ public class SimpleExoPlayer
|
||||
}
|
||||
}
|
||||
|
||||
private void setVideoSurfaceInternal(Surface surface, boolean ownsSurface) {
|
||||
private void setVideoSurfaceInternal(@Nullable Surface surface, boolean ownsSurface) {
|
||||
// Note: We don't turn this method into a no-op if the surface is being replaced with itself
|
||||
// so as to ensure onRenderedFirstFrame callbacks are still called in this case.
|
||||
List<PlayerMessage> messages = new ArrayList<>();
|
||||
|
@ -299,7 +299,7 @@ public class AnalyticsCollector
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onRenderedFirstFrame(Surface surface) {
|
||||
public final void onRenderedFirstFrame(@Nullable Surface surface) {
|
||||
EventTime eventTime = generateReadingMediaPeriodEventTime();
|
||||
for (AnalyticsListener listener : listeners) {
|
||||
listener.onRenderedFirstFrame(eventTime, surface);
|
||||
|
@ -448,7 +448,7 @@ public interface AnalyticsListener {
|
||||
* @param surface The {@link Surface} to which a first frame has been rendered, or {@code null} if
|
||||
* the renderer renders to something that isn't a {@link Surface}.
|
||||
*/
|
||||
default void onRenderedFirstFrame(EventTime eventTime, Surface surface) {}
|
||||
default void onRenderedFirstFrame(EventTime eventTime, @Nullable Surface surface) {}
|
||||
|
||||
/**
|
||||
* Called each time a drm session is acquired.
|
||||
|
@ -323,8 +323,8 @@ public class EventLogger implements AnalyticsListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderedFirstFrame(EventTime eventTime, Surface surface) {
|
||||
logd(eventTime, "renderedFirstFrame", surface.toString());
|
||||
public void onRenderedFirstFrame(EventTime eventTime, @Nullable Surface surface) {
|
||||
logd(eventTime, "renderedFirstFrame", String.valueOf(surface));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,7 +96,7 @@ public interface VideoRendererEventListener {
|
||||
* @param surface The {@link Surface} to which a first frame has been rendered, or {@code null} if
|
||||
* the renderer renders to something that isn't a {@link Surface}.
|
||||
*/
|
||||
void onRenderedFirstFrame(Surface surface);
|
||||
void onRenderedFirstFrame(@Nullable Surface surface);
|
||||
|
||||
/**
|
||||
* Called when the renderer is disabled.
|
||||
@ -124,20 +124,16 @@ public interface VideoRendererEventListener {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes {@link VideoRendererEventListener#onVideoEnabled(DecoderCounters)}.
|
||||
*/
|
||||
public void enabled(final DecoderCounters decoderCounters) {
|
||||
/** Invokes {@link VideoRendererEventListener#onVideoEnabled(DecoderCounters)}. */
|
||||
public void enabled(DecoderCounters decoderCounters) {
|
||||
if (listener != null) {
|
||||
handler.post(() -> listener.onVideoEnabled(decoderCounters));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes {@link VideoRendererEventListener#onVideoDecoderInitialized(String, long, long)}.
|
||||
*/
|
||||
public void decoderInitialized(final String decoderName,
|
||||
final long initializedTimestampMs, final long initializationDurationMs) {
|
||||
/** Invokes {@link VideoRendererEventListener#onVideoDecoderInitialized(String, long, long)}. */
|
||||
public void decoderInitialized(
|
||||
String decoderName, long initializedTimestampMs, long initializationDurationMs) {
|
||||
if (listener != null) {
|
||||
handler.post(
|
||||
() ->
|
||||
@ -146,29 +142,26 @@ public interface VideoRendererEventListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes {@link VideoRendererEventListener#onVideoInputFormatChanged(Format)}.
|
||||
*/
|
||||
public void inputFormatChanged(final Format format) {
|
||||
/** Invokes {@link VideoRendererEventListener#onVideoInputFormatChanged(Format)}. */
|
||||
public void inputFormatChanged(Format format) {
|
||||
if (listener != null) {
|
||||
handler.post(() -> listener.onVideoInputFormatChanged(format));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes {@link VideoRendererEventListener#onDroppedFrames(int, long)}.
|
||||
*/
|
||||
public void droppedFrames(final int droppedFrameCount, final long elapsedMs) {
|
||||
/** Invokes {@link VideoRendererEventListener#onDroppedFrames(int, long)}. */
|
||||
public void droppedFrames(int droppedFrameCount, long elapsedMs) {
|
||||
if (listener != null) {
|
||||
handler.post(() -> listener.onDroppedFrames(droppedFrameCount, elapsedMs));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes {@link VideoRendererEventListener#onVideoSizeChanged(int, int, int, float)}.
|
||||
*/
|
||||
public void videoSizeChanged(final int width, final int height,
|
||||
final int unappliedRotationDegrees, final float pixelWidthHeightRatio) {
|
||||
/** Invokes {@link VideoRendererEventListener#onVideoSizeChanged(int, int, int, float)}. */
|
||||
public void videoSizeChanged(
|
||||
int width,
|
||||
int height,
|
||||
final int unappliedRotationDegrees,
|
||||
final float pixelWidthHeightRatio) {
|
||||
if (listener != null) {
|
||||
handler.post(
|
||||
() ->
|
||||
@ -177,19 +170,15 @@ public interface VideoRendererEventListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes {@link VideoRendererEventListener#onRenderedFirstFrame(Surface)}.
|
||||
*/
|
||||
public void renderedFirstFrame(final Surface surface) {
|
||||
/** Invokes {@link VideoRendererEventListener#onRenderedFirstFrame(Surface)}. */
|
||||
public void renderedFirstFrame(@Nullable Surface surface) {
|
||||
if (listener != null) {
|
||||
handler.post(() -> listener.onRenderedFirstFrame(surface));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes {@link VideoRendererEventListener#onVideoDisabled(DecoderCounters)}.
|
||||
*/
|
||||
public void disabled(final DecoderCounters counters) {
|
||||
/** Invokes {@link VideoRendererEventListener#onVideoDisabled(DecoderCounters)}. */
|
||||
public void disabled(DecoderCounters counters) {
|
||||
if (listener != null) {
|
||||
handler.post(
|
||||
() -> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user