mirror of
https://github.com/samsonjs/media.git
synced 2026-06-29 05:39:31 +00:00
Remove unnecessary check. sampleRateIndex is masked with 0x03 so it is constrained to be between 0 and 3.
This commit is contained in:
parent
59c44af4cb
commit
329b8910ca
1 changed files with 0 additions and 7 deletions
|
|
@ -30,8 +30,6 @@ import java.util.Collections;
|
|||
*/
|
||||
/* 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_ALAW = 7;
|
||||
private static final int AUDIO_FORMAT_ULAW = 8;
|
||||
|
|
@ -66,11 +64,6 @@ import java.util.Collections;
|
|||
audioFormat = (header >> 4) & 0x0F;
|
||||
if (audioFormat == AUDIO_FORMAT_MP3) {
|
||||
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];
|
||||
Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_MPEG, null,
|
||||
Format.NO_VALUE, Format.NO_VALUE, 1, sampleRate, null, null, 0, null);
|
||||
|
|
|
|||
Loading…
Reference in a new issue