use of com.google.android.exoplayer2.extractor.amr.AmrExtractor in project ExoPlayer by google.
the class AmrExtractorNonParameterizedTest method read_amrNb_returnEndOfInput_ifInputEncountersEoF.
@Test
public void read_amrNb_returnEndOfInput_ifInputEncountersEoF() throws IOException {
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
byte[] amrFrame = newNarrowBandAmrFrameWithType(3);
byte[] data = joinData(amrSignatureNb(), amrFrame);
FakeExtractorInput input = fakeExtractorInputWithData(data);
// Read 1st frame, which will put the input at EoF.
amrExtractor.read(input, new PositionHolder());
int result = amrExtractor.read(input, new PositionHolder());
assertThat(result).isEqualTo(Extractor.RESULT_END_OF_INPUT);
}
use of com.google.android.exoplayer2.extractor.amr.AmrExtractor in project ExoPlayer by google.
the class AmrExtractorNonParameterizedTest method read_amrNb_returnParserException_forInvalidFrameType.
@Test
public void read_amrNb_returnParserException_forInvalidFrameType() throws IOException {
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
// Frame type 12-14 for narrow band is reserved for future usage.
byte[] amrFrame = newNarrowBandAmrFrameWithType(12);
byte[] data = joinData(amrSignatureNb(), amrFrame);
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 AmrExtractorNonParameterizedTest method read_amrWb_returnEndOfInput_ifInputEncountersEoF.
@Test
public void read_amrWb_returnEndOfInput_ifInputEncountersEoF() throws IOException {
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
byte[] amrFrame = newWideBandAmrFrameWithType(5);
byte[] data = joinData(amrSignatureWb(), amrFrame);
FakeExtractorInput input = fakeExtractorInputWithData(data);
// Read 1st frame, which will put the input at EoF.
amrExtractor.read(input, new PositionHolder());
int result = amrExtractor.read(input, new PositionHolder());
assertThat(result).isEqualTo(Extractor.RESULT_END_OF_INPUT);
}
use of com.google.android.exoplayer2.extractor.amr.AmrExtractor in project ExoPlayer by google.
the class AmrExtractorNonParameterizedTest method read_amrWb_returnParserException_forInvalidFrameType.
@Test
public void read_amrWb_returnParserException_forInvalidFrameType() throws IOException {
AmrExtractor amrExtractor = setupAmrExtractorWithOutput();
// Frame type 10-13 for wide band is reserved for future usage.
byte[] amrFrame = newWideBandAmrFrameWithType(13);
byte[] data = joinData(amrSignatureWb(), amrFrame);
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 AmrExtractorNonParameterizedTest method setupAmrExtractorWithOutput.
private static AmrExtractor setupAmrExtractorWithOutput() {
AmrExtractor amrExtractor = new AmrExtractor();
FakeExtractorOutput output = new FakeExtractorOutput();
amrExtractor.init(output);
return amrExtractor;
}
Aggregations