Skip to content

Commit

Permalink
Automated Code Change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 662793513
  • Loading branch information
kluever authored and colinkho committed Aug 15, 2024
1 parent fe171be commit 7cc06b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import androidx.media3.common.util.UnstableApi;
import androidx.media3.decoder.DecoderInputBuffer;
import androidx.media3.exoplayer.RendererCapabilities;
import com.google.common.base.Charsets;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
Expand Down Expand Up @@ -153,7 +153,10 @@ public void queueInputBuffer(DecoderInputBuffer inputBuffer) {
Uri imageUri =
Uri.parse(
new String(
inputData.array(), inputData.arrayOffset(), inputData.remaining(), Charsets.UTF_8));
inputData.array(),
inputData.arrayOffset(),
inputData.remaining(),
StandardCharsets.UTF_8));
pendingDecode = bitmapResolver.resolve(new ExternalImageRequest(imageUri));
pendingDecodeTimeUs = inputBuffer.timeUs;
inputBuffer.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import androidx.media3.decoder.DecoderInputBuffer;
import androidx.media3.exoplayer.RendererCapabilities;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.common.base.Charsets;
import com.google.common.util.concurrent.SettableFuture;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.CancellationException;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down Expand Up @@ -85,8 +85,8 @@ public void factorySupportsFormat_unsupportedImageMimeType_returnsUnsupportedSub
public void decoding_withMultipleBuffersAndEndOfStream_producesExpectedOutput() throws Exception {
Uri uri1 = Uri.parse("https://image1_longer_name_than_image2.test");
Uri uri2 = Uri.parse("https://image2.test");
byte[] uri1Bytes = uri1.toString().getBytes(Charsets.UTF_8);
byte[] uri2Bytes = uri2.toString().getBytes(Charsets.UTF_8);
byte[] uri1Bytes = uri1.toString().getBytes(StandardCharsets.UTF_8);
byte[] uri2Bytes = uri2.toString().getBytes(StandardCharsets.UTF_8);
Bitmap bitmap1 = Bitmap.createBitmap(/* width= */ 5, /* height= */ 5, Bitmap.Config.ARGB_8888);
Bitmap bitmap2 = Bitmap.createBitmap(/* width= */ 7, /* height= */ 7, Bitmap.Config.ARGB_8888);
ExternallyLoadedImageDecoder decoder =
Expand Down Expand Up @@ -131,7 +131,7 @@ public void decoding_withMultipleBuffersAndEndOfStream_producesExpectedOutput()
@Test
public void dequeueOutputBuffer_withDelayedBitmap_onlyReturnsOutputWhenReady() throws Exception {
Uri uri = Uri.parse("https://image.test");
byte[] uriBytes = uri.toString().getBytes(Charsets.UTF_8);
byte[] uriBytes = uri.toString().getBytes(StandardCharsets.UTF_8);
Bitmap bitmap = Bitmap.createBitmap(/* width= */ 5, /* height= */ 5, Bitmap.Config.ARGB_8888);
SettableFuture<Bitmap> settableFuture = SettableFuture.create();
ExternallyLoadedImageDecoder decoder =
Expand All @@ -152,7 +152,7 @@ public void dequeueOutputBuffer_withDelayedBitmap_onlyReturnsOutputWhenReady() t
public void dequeueOutputBuffer_withFailedFuture_throwsExceptionWithOriginalCause()
throws Exception {
Uri uri = Uri.parse("https://image.test");
byte[] uriBytes = uri.toString().getBytes(Charsets.UTF_8);
byte[] uriBytes = uri.toString().getBytes(StandardCharsets.UTF_8);
Throwable testThrowable = new Throwable();
SettableFuture<Bitmap> settableFuture = SettableFuture.create();
ExternallyLoadedImageDecoder decoder =
Expand All @@ -176,7 +176,7 @@ public void dequeueOutputBuffer_withFailedFuture_throwsExceptionWithOriginalCaus
dequeueOutputBuffer_withCancelledFuture_throwsExceptionWithCancellationExceptionCause()
throws Exception {
Uri uri = Uri.parse("https://image.test");
byte[] uriBytes = uri.toString().getBytes(Charsets.UTF_8);
byte[] uriBytes = uri.toString().getBytes(StandardCharsets.UTF_8);
SettableFuture<Bitmap> settableFuture = SettableFuture.create();
ExternallyLoadedImageDecoder decoder =
new ExternallyLoadedImageDecoder.Factory(request -> settableFuture).createImageDecoder();
Expand All @@ -197,7 +197,7 @@ public void dequeueOutputBuffer_withFailedFuture_throwsExceptionWithOriginalCaus
@Test
public void flush_beforeFirstBuffer_allowsToQueueNextBuffer() throws Exception {
Uri uri = Uri.parse("https://image.test");
byte[] uriBytes = uri.toString().getBytes(Charsets.UTF_8);
byte[] uriBytes = uri.toString().getBytes(StandardCharsets.UTF_8);
Bitmap bitmap = Bitmap.createBitmap(/* width= */ 5, /* height= */ 5, Bitmap.Config.ARGB_8888);
ExternallyLoadedImageDecoder decoder =
new ExternallyLoadedImageDecoder.Factory(request -> immediateFuture(bitmap))
Expand All @@ -222,8 +222,8 @@ public void flush_duringDecoding_cancelsPendingDecodeAndAllowsToQueueNextBuffer(
throws Exception {
Uri uri1 = Uri.parse("https://image1.test");
Uri uri2 = Uri.parse("https://image2.test");
byte[] uri1Bytes = uri1.toString().getBytes(Charsets.UTF_8);
byte[] uri2Bytes = uri2.toString().getBytes(Charsets.UTF_8);
byte[] uri1Bytes = uri1.toString().getBytes(StandardCharsets.UTF_8);
byte[] uri2Bytes = uri2.toString().getBytes(StandardCharsets.UTF_8);
Bitmap bitmap2 = Bitmap.createBitmap(/* width= */ 7, /* height= */ 7, Bitmap.Config.ARGB_8888);
SettableFuture<Bitmap> settableFuture = SettableFuture.create();
ExternallyLoadedImageDecoder decoder =
Expand Down Expand Up @@ -256,8 +256,8 @@ public void flush_duringDecoding_cancelsPendingDecodeAndAllowsToQueueNextBuffer(
public void flush_afterDecoding_allowsToQueueNextBuffer() throws Exception {
Uri uri1 = Uri.parse("https://image1.test");
Uri uri2 = Uri.parse("https://image2.test");
byte[] uri1Bytes = uri1.toString().getBytes(Charsets.UTF_8);
byte[] uri2Bytes = uri2.toString().getBytes(Charsets.UTF_8);
byte[] uri1Bytes = uri1.toString().getBytes(StandardCharsets.UTF_8);
byte[] uri2Bytes = uri2.toString().getBytes(StandardCharsets.UTF_8);
Bitmap bitmap1 = Bitmap.createBitmap(/* width= */ 5, /* height= */ 5, Bitmap.Config.ARGB_8888);
Bitmap bitmap2 = Bitmap.createBitmap(/* width= */ 7, /* height= */ 7, Bitmap.Config.ARGB_8888);
ExternallyLoadedImageDecoder decoder =
Expand Down Expand Up @@ -290,7 +290,7 @@ public void flush_afterDecoding_allowsToQueueNextBuffer() throws Exception {
@Test
public void flush_duringEndOfStreamSample_allowsToQueueNextBuffer() throws Exception {
Uri uri = Uri.parse("https://image1.test");
byte[] uriBytes = uri.toString().getBytes(Charsets.UTF_8);
byte[] uriBytes = uri.toString().getBytes(StandardCharsets.UTF_8);
Bitmap bitmap = Bitmap.createBitmap(/* width= */ 5, /* height= */ 5, Bitmap.Config.ARGB_8888);
ExternallyLoadedImageDecoder decoder =
new ExternallyLoadedImageDecoder.Factory(request -> immediateFuture(bitmap))
Expand All @@ -316,7 +316,7 @@ public void flush_duringEndOfStreamSample_allowsToQueueNextBuffer() throws Excep
@Test
public void flush_afterEndOfStreamSample_allowsToQueueNextBuffer() throws Exception {
Uri uri = Uri.parse("https://image1.test");
byte[] uriBytes = uri.toString().getBytes(Charsets.UTF_8);
byte[] uriBytes = uri.toString().getBytes(StandardCharsets.UTF_8);
Bitmap bitmap = Bitmap.createBitmap(/* width= */ 5, /* height= */ 5, Bitmap.Config.ARGB_8888);
ExternallyLoadedImageDecoder decoder =
new ExternallyLoadedImageDecoder.Factory(request -> immediateFuture(bitmap))
Expand Down

0 comments on commit 7cc06b0

Please sign in to comment.