Commit a317746e by tonihei Committed by Oliver Woodman

Ensure constructor condition is unblocked even for unchecked exceptions

The condition is meant to be unblocked whenever the constructor is
left. This should include unchecked exceptions (that may be thrown
due to bugs in the dependent components, or user-inhected factories)

PiperOrigin-RevId: 366235361
parent c80e7b0a
...@@ -638,6 +638,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -638,6 +638,7 @@ public class SimpleExoPlayer extends BasePlayer
/** @param builder The {@link Builder} to obtain all construction parameters. */ /** @param builder The {@link Builder} to obtain all construction parameters. */
protected SimpleExoPlayer(Builder builder) { protected SimpleExoPlayer(Builder builder) {
constructorFinished = new ConditionVariable(); constructorFinished = new ConditionVariable();
try {
applicationContext = builder.context.getApplicationContext(); applicationContext = builder.context.getApplicationContext();
analyticsCollector = builder.analyticsCollector; analyticsCollector = builder.analyticsCollector;
priorityTaskManager = builder.priorityTaskManager; priorityTaskManager = builder.priorityTaskManager;
...@@ -707,7 +708,8 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -707,7 +708,8 @@ public class SimpleExoPlayer extends BasePlayer
audioBecomingNoisyManager.setEnabled(builder.handleAudioBecomingNoisy); audioBecomingNoisyManager.setEnabled(builder.handleAudioBecomingNoisy);
audioFocusManager = new AudioFocusManager(builder.context, eventHandler, componentListener); audioFocusManager = new AudioFocusManager(builder.context, eventHandler, componentListener);
audioFocusManager.setAudioAttributes(builder.handleAudioFocus ? audioAttributes : null); audioFocusManager.setAudioAttributes(builder.handleAudioFocus ? audioAttributes : null);
streamVolumeManager = new StreamVolumeManager(builder.context, eventHandler, componentListener); streamVolumeManager =
new StreamVolumeManager(builder.context, eventHandler, componentListener);
streamVolumeManager.setStreamType(Util.getStreamTypeForAudioUsage(audioAttributes.usage)); streamVolumeManager.setStreamType(Util.getStreamTypeForAudioUsage(audioAttributes.usage));
wakeLockManager = new WakeLockManager(builder.context); wakeLockManager = new WakeLockManager(builder.context);
wakeLockManager.setEnabled(builder.wakeMode != C.WAKE_MODE_NONE); wakeLockManager.setEnabled(builder.wakeMode != C.WAKE_MODE_NONE);
...@@ -721,9 +723,10 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -721,9 +723,10 @@ public class SimpleExoPlayer extends BasePlayer
sendRendererMessage(C.TRACK_TYPE_VIDEO, Renderer.MSG_SET_SCALING_MODE, videoScalingMode); sendRendererMessage(C.TRACK_TYPE_VIDEO, Renderer.MSG_SET_SCALING_MODE, videoScalingMode);
sendRendererMessage( sendRendererMessage(
C.TRACK_TYPE_AUDIO, Renderer.MSG_SET_SKIP_SILENCE_ENABLED, skipSilenceEnabled); C.TRACK_TYPE_AUDIO, Renderer.MSG_SET_SKIP_SILENCE_ENABLED, skipSilenceEnabled);
} finally {
constructorFinished.open(); constructorFinished.open();
} }
}
@Override @Override
public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled) { public void experimentalSetOffloadSchedulingEnabled(boolean offloadSchedulingEnabled) {
......
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