Skip to content

Commit e412a4e

Browse files
committed
Check for absent KEY_BIT_RATE on Android.
1 parent ef713ec commit e412a4e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

android/src/main/java/com/ryanheise/just_waveform/WaveformExtractor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ void processAudio() {
138138
// XXX: Do we need to set this or is there a default?
139139
outFormat.setInteger(MediaFormat.KEY_SAMPLE_RATE, sampleRate);
140140
outFormat.setInteger(MediaFormat.KEY_CHANNEL_COUNT, channelCount);
141-
outFormat.setInteger(MediaFormat.KEY_BIT_RATE, inFormat.getInteger(MediaFormat.KEY_BIT_RATE));
141+
if (inFormat.containsKey(MediaFormat.KEY_BIT_RATE)) {
142+
outFormat.setInteger(MediaFormat.KEY_BIT_RATE, inFormat.getInteger(MediaFormat.KEY_BIT_RATE));
143+
}
142144
MediaFormat changedOutFormat = null;
143145
while (!sawInputEOS && decoderIdleCount < 100) {
144146
decoderIdleCount++;

0 commit comments

Comments
 (0)