Commit f394697d by andrewlewis Committed by Oliver Woodman

Fix updating rate with codec reuse while disabled

While disabled the renderer does not have non-null stream formats. This means
that setting the operating rate could cause a NullPointerException if there was
a codec for reuse.

Check for being enabled/started before trying to set the operating rate. After
the renderer is enabled it should receive a new input format which will update
the operating rate as needed.

PiperOrigin-RevId: 235494384
parent caeaa957
...@@ -559,7 +559,9 @@ public abstract class MediaCodecRenderer extends BaseRenderer { ...@@ -559,7 +559,9 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
@Override @Override
public final void setOperatingRate(float operatingRate) throws ExoPlaybackException { public final void setOperatingRate(float operatingRate) throws ExoPlaybackException {
rendererOperatingRate = operatingRate; rendererOperatingRate = operatingRate;
if (codec != null && codecDrainAction != DRAIN_ACTION_REINITIALIZE) { if (codec != null
&& codecDrainAction != DRAIN_ACTION_REINITIALIZE
&& getState() != STATE_DISABLED) {
updateCodecOperatingRate(); updateCodecOperatingRate();
} }
} }
......
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