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 oldEnhancer = this.loudnessEnhancer;
|
||||
if (oldEnhancer != null) {
|
||||
newEnhancer.setEnabled(oldEnhancer.getEnabled());
|
||||
if (oldEnhancer.getEnabled()) {
|
||||
newEnhancer.setTargetGain((int) oldEnhancer.getTargetGain());
|
||||
try {
|
||||
newEnhancer.setEnabled(oldEnhancer.getEnabled());
|
||||
if (oldEnhancer.getEnabled()) {
|
||||
newEnhancer.setTargetGain((int) oldEnhancer.getTargetGain());
|
||||
}
|
||||
oldEnhancer.release();
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, e.toString());
|
||||
}
|
||||
oldEnhancer.release();
|
||||
}
|
||||
|
||||
this.loudnessEnhancer = newEnhancer;
|
||||
|
|
Loading…
Reference in New Issue