Commit 329b8910 by Rohit Krishnan

Remove unnecessary check. sampleRateIndex is masked with 0x03 so it is…

Remove unnecessary check. sampleRateIndex is masked with 0x03 so it is constrained to be between 0 and 3.
parent 59c44af4
...@@ -30,8 +30,6 @@ import java.util.Collections; ...@@ -30,8 +30,6 @@ import java.util.Collections;
*/ */
/* package */ final class AudioTagPayloadReader extends TagPayloadReader { /* package */ final class AudioTagPayloadReader extends TagPayloadReader {
private static final String TAG = "AudioTagPayloadReader";
private static final int AUDIO_FORMAT_MP3 = 2; private static final int AUDIO_FORMAT_MP3 = 2;
private static final int AUDIO_FORMAT_ALAW = 7; private static final int AUDIO_FORMAT_ALAW = 7;
private static final int AUDIO_FORMAT_ULAW = 8; private static final int AUDIO_FORMAT_ULAW = 8;
...@@ -66,11 +64,6 @@ import java.util.Collections; ...@@ -66,11 +64,6 @@ import java.util.Collections;
audioFormat = (header >> 4) & 0x0F; audioFormat = (header >> 4) & 0x0F;
if (audioFormat == AUDIO_FORMAT_MP3) { if (audioFormat == AUDIO_FORMAT_MP3) {
int sampleRateIndex = (header >> 2) & 0x03; int sampleRateIndex = (header >> 2) & 0x03;
if (sampleRateIndex < 0 || sampleRateIndex >= AUDIO_SAMPLING_RATE_TABLE.length) {
Log.d(TAG, "Invalid sample rate, attempting to read at 44.1k");
//rather than throw an exception, lets just attempt to play at 44.1k
sampleRateIndex = 3;
}
int sampleRate = AUDIO_SAMPLING_RATE_TABLE[sampleRateIndex]; int sampleRate = AUDIO_SAMPLING_RATE_TABLE[sampleRateIndex];
Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_MPEG, null, Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_MPEG, null,
Format.NO_VALUE, Format.NO_VALUE, 1, sampleRate, null, null, 0, null); Format.NO_VALUE, Format.NO_VALUE, 1, sampleRate, null, null, 0, null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment