Add missing @Nullable to SimpleExoPlayer fields and methods.

Issue:#5402
PiperOrigin-RevId: 229758525
This commit is contained in:
tonihei 2019-01-17 17:08:52 +00:00 committed by Oliver Woodman
parent 22413b8037
commit ac86d3b5f6
2 changed files with 44 additions and 30 deletions

View File

@ -94,25 +94,25 @@ public class SimpleExoPlayer extends BasePlayer
private final AudioFocusManager audioFocusManager; private final AudioFocusManager audioFocusManager;
private Format videoFormat; @Nullable private Format videoFormat;
private Format audioFormat; @Nullable private Format audioFormat;
private Surface surface; @Nullable private Surface surface;
private boolean ownsSurface; private boolean ownsSurface;
private @C.VideoScalingMode int videoScalingMode; private @C.VideoScalingMode int videoScalingMode;
private SurfaceHolder surfaceHolder; @Nullable private SurfaceHolder surfaceHolder;
private TextureView textureView; @Nullable private TextureView textureView;
private int surfaceWidth; private int surfaceWidth;
private int surfaceHeight; private int surfaceHeight;
private DecoderCounters videoDecoderCounters; @Nullable private DecoderCounters videoDecoderCounters;
private DecoderCounters audioDecoderCounters; @Nullable private DecoderCounters audioDecoderCounters;
private int audioSessionId; private int audioSessionId;
private AudioAttributes audioAttributes; private AudioAttributes audioAttributes;
private float audioVolume; private float audioVolume;
private MediaSource mediaSource; @Nullable private MediaSource mediaSource;
private List<Cue> currentCues; private List<Cue> currentCues;
private VideoFrameMetadataListener videoFrameMetadataListener; @Nullable private VideoFrameMetadataListener videoFrameMetadataListener;
private CameraMotionListener cameraMotionListener; @Nullable private CameraMotionListener cameraMotionListener;
private boolean hasNotifiedFullWrongThreadWarning; private boolean hasNotifiedFullWrongThreadWarning;
/** /**
@ -558,30 +558,26 @@ public class SimpleExoPlayer extends BasePlayer
setPlaybackParameters(playbackParameters); setPlaybackParameters(playbackParameters);
} }
/** /** Returns the video format currently being played, or null if no video is being played. */
* Returns the video format currently being played, or null if no video is being played. @Nullable
*/
public Format getVideoFormat() { public Format getVideoFormat() {
return videoFormat; return videoFormat;
} }
/** /** Returns the audio format currently being played, or null if no audio is being played. */
* Returns the audio format currently being played, or null if no audio is being played. @Nullable
*/
public Format getAudioFormat() { public Format getAudioFormat() {
return audioFormat; return audioFormat;
} }
/** /** Returns {@link DecoderCounters} for video, or null if no video is being played. */
* Returns {@link DecoderCounters} for video, or null if no video is being played. @Nullable
*/
public DecoderCounters getVideoDecoderCounters() { public DecoderCounters getVideoDecoderCounters() {
return videoDecoderCounters; return videoDecoderCounters;
} }
/** /** Returns {@link DecoderCounters} for audio, or null if no audio is being played. */
* Returns {@link DecoderCounters} for audio, or null if no audio is being played. @Nullable
*/
public DecoderCounters getAudioDecoderCounters() { public DecoderCounters getAudioDecoderCounters() {
return audioDecoderCounters; return audioDecoderCounters;
} }
@ -1053,7 +1049,8 @@ public class SimpleExoPlayer extends BasePlayer
} }
@Override @Override
public @Nullable Object getCurrentManifest() { @Nullable
public Object getCurrentManifest() {
verifyApplicationThread(); verifyApplicationThread();
return player.getCurrentManifest(); return player.getCurrentManifest();
} }

View File

@ -137,23 +137,40 @@ public class DebugTextViewHelper implements Player.EventListener, Runnable {
/** Returns a string containing video debugging information. */ /** Returns a string containing video debugging information. */
protected String getVideoString() { protected String getVideoString() {
Format format = player.getVideoFormat(); Format format = player.getVideoFormat();
if (format == null) { DecoderCounters decoderCounters = player.getVideoDecoderCounters();
if (format == null || decoderCounters == null) {
return ""; return "";
} }
return "\n" + format.sampleMimeType + "(id:" + format.id + " r:" + format.width + "x" return "\n"
+ format.height + getPixelAspectRatioString(format.pixelWidthHeightRatio) + format.sampleMimeType
+ getDecoderCountersBufferCountString(player.getVideoDecoderCounters()) + ")"; + "(id:"
+ format.id
+ " r:"
+ format.width
+ "x"
+ format.height
+ getPixelAspectRatioString(format.pixelWidthHeightRatio)
+ getDecoderCountersBufferCountString(decoderCounters)
+ ")";
} }
/** Returns a string containing audio debugging information. */ /** Returns a string containing audio debugging information. */
protected String getAudioString() { protected String getAudioString() {
Format format = player.getAudioFormat(); Format format = player.getAudioFormat();
if (format == null) { DecoderCounters decoderCounters = player.getAudioDecoderCounters();
if (format == null || decoderCounters == null) {
return ""; return "";
} }
return "\n" + format.sampleMimeType + "(id:" + format.id + " hz:" + format.sampleRate + " ch:" return "\n"
+ format.sampleMimeType
+ "(id:"
+ format.id
+ " hz:"
+ format.sampleRate
+ " ch:"
+ format.channelCount + format.channelCount
+ getDecoderCountersBufferCountString(player.getAudioDecoderCounters()) + ")"; + getDecoderCountersBufferCountString(decoderCounters)
+ ")";
} }
private static String getDecoderCountersBufferCountString(DecoderCounters counters) { private static String getDecoderCountersBufferCountString(DecoderCounters counters) {