Fix brown-paper-bag bug in audio init error checking

This commit is contained in:
Cameron Gutman 2017-08-22 00:16:35 -07:00
parent 0792157e9d
commit 0a0be19b69

View File

@ -149,6 +149,7 @@ public class AndroidAudioRenderer implements AudioRenderer {
break; break;
} catch (Exception e) { } catch (Exception e) {
// Try to release the AudioTrack if we got far enough // Try to release the AudioTrack if we got far enough
e.printStackTrace();
try { try {
if (track != null) { if (track != null) {
track.release(); track.release();
@ -158,6 +159,11 @@ public class AndroidAudioRenderer implements AudioRenderer {
} }
} }
if (track == null) {
// Couldn't create any audio track for playback
return -2;
}
return 0; return 0;
} }