use of com.google.android.exoplayer2.extractor.amr.AmrExtractor in project ExoPlayer by google.
the class AmrExtractorNonParameterizedTest method read_amrWb_returnParserException_forInvalidFrameHeader.
@Test
public void read_amrWb_returnParserException_forInvalidFrameHeader() throws IOException {
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
byte[] invalidHeaderFrame = newWideBandAmrFrameWithType(6);
// The padding bits are at bit-1 positions in the following pattern: 1000 0011
// Padding bits must be 0.
invalidHeaderFrame[0] = (byte) (invalidHeaderFrame[0] | 0b01111110);
byte[] data = joinData(amrSignatureWb(), invalidHeaderFrame);
FakeExtractorInput input = fakeExtractorInputWithData(data);
try {
amrExtractor.read(input, new PositionHolder());
fail();
} catch (ParserException e) {
// expected
}
}
use of com.google.android.exoplayer2.extractor.amr.AmrExtractor in project ExoPlayer by google.
the class AmrExtractorSeekTest method amrExtractorReads_returnSeekableSeekMap_forNarrowBandAmr.
@Test
public void amrExtractorReads_returnSeekableSeekMap_forNarrowBandAmr() throws IOException {
String fileName = NARROW_BAND_AMR_FILE;
Uri fileUri = TestUtil.buildAssetUri(fileName);
expectedTrackOutput = TestUtil.extractAllSamplesFromFile(createAmrExtractor(), ApplicationProvider.getApplicationContext(), fileName).trackOutputs.get(0);
AmrExtractor extractor = createAmrExtractor();
SeekMap seekMap = TestUtil.extractSeekMap(extractor, new FakeExtractorOutput(), dataSource, fileUri);
assertThat(seekMap).isNotNull();
assertThat(seekMap.getDurationUs()).isEqualTo(NARROW_BAND_FILE_DURATION_US);
assertThat(seekMap.isSeekable()).isTrue();
}
Aggregations