mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Refactor OpusDecoderTest
to use OpusLibrary.isAvailable()
Replaced the custom `LibraryLoader` instance with `OpusLibrary.isAvailable()` to verify the library loading. This simplifies the code by leveraging the existing library loading mechanism. #cherrypick PiperOrigin-RevId: 691457871
This commit is contained in:
parent
2a9963424b
commit
2b27e33784
@ -20,7 +20,6 @@ import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.util.LibraryLoader;
|
||||
import androidx.media3.decoder.DecoderInputBuffer;
|
||||
import androidx.media3.decoder.SimpleDecoderOutputBuffer;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
@ -34,14 +33,6 @@ import org.junit.runner.RunWith;
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public final class OpusDecoderTest {
|
||||
|
||||
private static final LibraryLoader LOADER =
|
||||
new LibraryLoader("opusV2JNI") {
|
||||
@Override
|
||||
protected void loadLibrary(String name) {
|
||||
System.loadLibrary(name);
|
||||
}
|
||||
};
|
||||
|
||||
private static final byte[] HEADER =
|
||||
new byte[] {79, 112, 117, 115, 72, 101, 97, 100, 0, 2, 1, 56, 0, 0, -69, -128, 0, 0, 0};
|
||||
|
||||
@ -115,7 +106,7 @@ public final class OpusDecoderTest {
|
||||
|
||||
@Test
|
||||
public void decode_removesPreSkipFromOutput() throws OpusDecoderException {
|
||||
assumeTrue(LOADER.isAvailable());
|
||||
assumeTrue(OpusLibrary.isAvailable());
|
||||
OpusDecoder decoder =
|
||||
new OpusDecoder(
|
||||
/* numInputBuffers= */ 0,
|
||||
@ -135,7 +126,7 @@ public final class OpusDecoderTest {
|
||||
@Test
|
||||
public void decode_whenDiscardPaddingDisabled_returnsDiscardPadding()
|
||||
throws OpusDecoderException {
|
||||
assumeTrue(LOADER.isAvailable());
|
||||
assumeTrue(OpusLibrary.isAvailable());
|
||||
OpusDecoder decoder =
|
||||
new OpusDecoder(
|
||||
/* numInputBuffers= */ 0,
|
||||
@ -156,7 +147,7 @@ public final class OpusDecoderTest {
|
||||
|
||||
@Test
|
||||
public void decode_whenDiscardPaddingEnabled_removesDiscardPadding() throws OpusDecoderException {
|
||||
assumeTrue(LOADER.isAvailable());
|
||||
assumeTrue(OpusLibrary.isAvailable());
|
||||
OpusDecoder decoder =
|
||||
new OpusDecoder(
|
||||
/* numInputBuffers= */ 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user