Skip to content

Commit

Permalink
Add missing @nullable to SimpleExoPlayer fields and methods.
Browse files Browse the repository at this point in the history
Issue:#5402
PiperOrigin-RevId: 229758525
  • Loading branch information
tonihei authored and ojw28 committed Jan 21, 2019
1 parent 9911c11 commit 29376b3
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,25 +94,25 @@ public interface VideoListener extends com.google.android.exoplayer2.video.Video

private final AudioFocusManager audioFocusManager;

private Format videoFormat;
private Format audioFormat;
@Nullable private Format videoFormat;
@Nullable private Format audioFormat;

private Surface surface;
@Nullable private Surface surface;
private boolean ownsSurface;
private @C.VideoScalingMode int videoScalingMode;
private SurfaceHolder surfaceHolder;
private TextureView textureView;
@Nullable private SurfaceHolder surfaceHolder;
@Nullable private TextureView textureView;
private int surfaceWidth;
private int surfaceHeight;
private DecoderCounters videoDecoderCounters;
private DecoderCounters audioDecoderCounters;
@Nullable private DecoderCounters videoDecoderCounters;
@Nullable private DecoderCounters audioDecoderCounters;
private int audioSessionId;
private AudioAttributes audioAttributes;
private float audioVolume;
private MediaSource mediaSource;
@Nullable private MediaSource mediaSource;
private List<Cue> currentCues;
private VideoFrameMetadataListener videoFrameMetadataListener;
private CameraMotionListener cameraMotionListener;
@Nullable private VideoFrameMetadataListener videoFrameMetadataListener;
@Nullable private CameraMotionListener cameraMotionListener;
private boolean hasNotifiedFullWrongThreadWarning;

/**
Expand Down Expand Up @@ -558,30 +558,26 @@ public void setPlaybackParams(@Nullable PlaybackParams params) {
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() {
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() {
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() {
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() {
return audioDecoderCounters;
}
Expand Down Expand Up @@ -1048,7 +1044,8 @@ public Timeline getCurrentTimeline() {
}

@Override
public @Nullable Object getCurrentManifest() {
@Nullable
public Object getCurrentManifest() {
verifyApplicationThread();
return player.getCurrentManifest();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,40 @@ protected String getPlayerStateString() {
/** Returns a string containing video debugging information. */
protected String getVideoString() {
Format format = player.getVideoFormat();
if (format == null) {
DecoderCounters decoderCounters = player.getVideoDecoderCounters();
if (format == null || decoderCounters == null) {
return "";
}
return "\n" + format.sampleMimeType + "(id:" + format.id + " r:" + format.width + "x"
+ format.height + getPixelAspectRatioString(format.pixelWidthHeightRatio)
+ getDecoderCountersBufferCountString(player.getVideoDecoderCounters()) + ")";
return "\n"
+ format.sampleMimeType
+ "(id:"
+ format.id
+ " r:"
+ format.width
+ "x"
+ format.height
+ getPixelAspectRatioString(format.pixelWidthHeightRatio)
+ getDecoderCountersBufferCountString(decoderCounters)
+ ")";
}

/** Returns a string containing audio debugging information. */
protected String getAudioString() {
Format format = player.getAudioFormat();
if (format == null) {
DecoderCounters decoderCounters = player.getAudioDecoderCounters();
if (format == null || decoderCounters == null) {
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
+ getDecoderCountersBufferCountString(player.getAudioDecoderCounters()) + ")";
+ getDecoderCountersBufferCountString(decoderCounters)
+ ")";
}

private static String getDecoderCountersBufferCountString(DecoderCounters counters) {
Expand Down

0 comments on commit 29376b3

Please sign in to comment.