Catch crash when device does not support LoudnessEnhancer properly (#7390)
This commit is contained in:
parent
f32d5ccb30
commit
5ea92f68b1
|
@ -399,11 +399,15 @@ public class ExoPlayerWrapper {
|
||||||
LoudnessEnhancer newEnhancer = new LoudnessEnhancer(audioStreamId);
|
LoudnessEnhancer newEnhancer = new LoudnessEnhancer(audioStreamId);
|
||||||
LoudnessEnhancer oldEnhancer = this.loudnessEnhancer;
|
LoudnessEnhancer oldEnhancer = this.loudnessEnhancer;
|
||||||
if (oldEnhancer != null) {
|
if (oldEnhancer != null) {
|
||||||
newEnhancer.setEnabled(oldEnhancer.getEnabled());
|
try {
|
||||||
if (oldEnhancer.getEnabled()) {
|
newEnhancer.setEnabled(oldEnhancer.getEnabled());
|
||||||
newEnhancer.setTargetGain((int) oldEnhancer.getTargetGain());
|
if (oldEnhancer.getEnabled()) {
|
||||||
|
newEnhancer.setTargetGain((int) oldEnhancer.getTargetGain());
|
||||||
|
}
|
||||||
|
oldEnhancer.release();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.d(TAG, e.toString());
|
||||||
}
|
}
|
||||||
oldEnhancer.release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loudnessEnhancer = newEnhancer;
|
this.loudnessEnhancer = newEnhancer;
|
||||||
|
|
Loading…
Reference in New Issue