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
This commit is contained in:
andrewlewis 2019-02-25 10:20:47 +00:00 committed by Oliver Woodman
parent caeaa9574e
commit f394697d4a

View file

@ -559,7 +559,9 @@ public abstract class MediaCodecRenderer extends BaseRenderer {
@Override
public final void setOperatingRate(float operatingRate) throws ExoPlaybackException {
rendererOperatingRate = operatingRate;
if (codec != null && codecDrainAction != DRAIN_ACTION_REINITIALIZE) {
if (codec != null
&& codecDrainAction != DRAIN_ACTION_REINITIALIZE
&& getState() != STATE_DISABLED) {
updateCodecOperatingRate();
}
}