Add some missing thread verifications
This adds some missing calls to verifyApplicationThread to ExoPlayerImpl. Now all public methods start with this call, except listener registrations because registration after construction on a background thread is allowed and supported. PiperOrigin-RevId: 428009498
This commit is contained in:
parent
6dae8746ad
commit
4ef007cae7
@ -398,6 +398,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public AudioComponent getAudioComponent() {
|
public AudioComponent getAudioComponent() {
|
||||||
|
verifyApplicationThread();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,6 +406,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public VideoComponent getVideoComponent() {
|
public VideoComponent getVideoComponent() {
|
||||||
|
verifyApplicationThread();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,6 +414,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public TextComponent getTextComponent() {
|
public TextComponent getTextComponent() {
|
||||||
|
verifyApplicationThread();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,6 +422,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public DeviceComponent getDeviceComponent() {
|
public DeviceComponent getDeviceComponent() {
|
||||||
|
verifyApplicationThread();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -492,6 +496,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void retry() {
|
public void retry() {
|
||||||
|
verifyApplicationThread();
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -922,6 +927,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
|
verifyApplicationThread();
|
||||||
stop(/* reset= */ false);
|
stop(/* reset= */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,6 +1211,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @C.VideoScalingMode int getVideoScalingMode() {
|
public @C.VideoScalingMode int getVideoScalingMode() {
|
||||||
|
verifyApplicationThread();
|
||||||
return videoScalingMode;
|
return videoScalingMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1222,11 +1229,13 @@ import java.util.concurrent.TimeoutException;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @C.VideoChangeFrameRateStrategy int getVideoChangeFrameRateStrategy() {
|
public @C.VideoChangeFrameRateStrategy int getVideoChangeFrameRateStrategy() {
|
||||||
|
verifyApplicationThread();
|
||||||
return videoChangeFrameRateStrategy;
|
return videoChangeFrameRateStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VideoSize getVideoSize() {
|
public VideoSize getVideoSize() {
|
||||||
|
verifyApplicationThread();
|
||||||
return videoSize;
|
return videoSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1373,6 +1382,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AudioAttributes getAudioAttributes() {
|
public AudioAttributes getAudioAttributes() {
|
||||||
|
verifyApplicationThread();
|
||||||
return audioAttributes;
|
return audioAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1403,6 +1413,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAudioSessionId() {
|
public int getAudioSessionId() {
|
||||||
|
verifyApplicationThread();
|
||||||
return audioSessionId;
|
return audioSessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1414,6 +1425,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearAuxEffectInfo() {
|
public void clearAuxEffectInfo() {
|
||||||
|
verifyApplicationThread();
|
||||||
setAuxEffectInfo(new AuxEffectInfo(AuxEffectInfo.NO_AUX_EFFECT_ID, /* sendLevel= */ 0f));
|
setAuxEffectInfo(new AuxEffectInfo(AuxEffectInfo.NO_AUX_EFFECT_ID, /* sendLevel= */ 0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1432,11 +1444,13 @@ import java.util.concurrent.TimeoutException;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getVolume() {
|
public float getVolume() {
|
||||||
|
verifyApplicationThread();
|
||||||
return volume;
|
return volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getSkipSilenceEnabled() {
|
public boolean getSkipSilenceEnabled() {
|
||||||
|
verifyApplicationThread();
|
||||||
return skipSilenceEnabled;
|
return skipSilenceEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1455,6 +1469,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnalyticsCollector getAnalyticsCollector() {
|
public AnalyticsCollector getAnalyticsCollector() {
|
||||||
|
verifyApplicationThread();
|
||||||
return analyticsCollector;
|
return analyticsCollector;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1501,24 +1516,28 @@ import java.util.concurrent.TimeoutException;
|
|||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public Format getVideoFormat() {
|
public Format getVideoFormat() {
|
||||||
|
verifyApplicationThread();
|
||||||
return videoFormat;
|
return videoFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public Format getAudioFormat() {
|
public Format getAudioFormat() {
|
||||||
|
verifyApplicationThread();
|
||||||
return audioFormat;
|
return audioFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public DecoderCounters getVideoDecoderCounters() {
|
public DecoderCounters getVideoDecoderCounters() {
|
||||||
|
verifyApplicationThread();
|
||||||
return videoDecoderCounters;
|
return videoDecoderCounters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public DecoderCounters getAudioDecoderCounters() {
|
public DecoderCounters getAudioDecoderCounters() {
|
||||||
|
verifyApplicationThread();
|
||||||
return audioDecoderCounters;
|
return audioDecoderCounters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1588,6 +1607,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setHandleWakeLock(boolean handleWakeLock) {
|
public void setHandleWakeLock(boolean handleWakeLock) {
|
||||||
|
verifyApplicationThread();
|
||||||
setWakeMode(handleWakeLock ? C.WAKE_MODE_LOCAL : C.WAKE_MODE_NONE);
|
setWakeMode(handleWakeLock ? C.WAKE_MODE_LOCAL : C.WAKE_MODE_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user