mirror of
https://github.com/androidx/media.git
synced 2025-05-15 19:49:50 +08:00
Use static import for TimeUnit
PiperOrigin-RevId: 324941042
This commit is contained in:
parent
c0ee267a6c
commit
6e11d32092
@ -16,6 +16,7 @@
|
|||||||
package com.google.android.exoplayer2.ext.media2;
|
package com.google.android.exoplayer2.ext.media2;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@ -32,7 +33,6 @@ import com.google.android.exoplayer2.ext.media2.test.R;
|
|||||||
import com.google.android.exoplayer2.util.Assertions;
|
import com.google.android.exoplayer2.util.Assertions;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@ -89,11 +89,8 @@ public class MediaSessionUtilTest {
|
|||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
assertThat(
|
assertThat(prepareResult.get(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS).getResultCode())
|
||||||
prepareResult
|
|
||||||
.get(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS)
|
|
||||||
.getResultCode())
|
|
||||||
.isEqualTo(PlayerResult.RESULT_SUCCESS);
|
.isEqualTo(PlayerResult.RESULT_SUCCESS);
|
||||||
assertThat(latch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS)).isTrue();
|
assertThat(latch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ package com.google.android.exoplayer2.ext.media2;
|
|||||||
import static com.google.android.exoplayer2.ext.media2.TestUtils.assertPlayerResultSuccess;
|
import static com.google.android.exoplayer2.ext.media2.TestUtils.assertPlayerResultSuccess;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth.assertWithMessage;
|
import static com.google.common.truth.Truth.assertWithMessage;
|
||||||
|
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -52,7 +53,6 @@ import java.util.List;
|
|||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -156,7 +156,7 @@ public class SessionCallbackBuilderTest {
|
|||||||
latch.countDown();
|
latch.countDown();
|
||||||
};
|
};
|
||||||
try (MediaController controller = createConnectedController(session, listener, null)) {
|
try (MediaController controller = createConnectedController(session, listener, null)) {
|
||||||
assertThat(latch.await(CONTROLLER_COMMAND_WAIT_TIME_MS, TimeUnit.MILLISECONDS)).isTrue();
|
assertThat(latch.await(CONTROLLER_COMMAND_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
|
|
||||||
assertSessionResultFailure(controller.skipToNextPlaylistItem());
|
assertSessionResultFailure(controller.skipToNextPlaylistItem());
|
||||||
assertSessionResultFailure(controller.skipToPreviousPlaylistItem());
|
assertSessionResultFailure(controller.skipToPreviousPlaylistItem());
|
||||||
@ -223,9 +223,7 @@ public class SessionCallbackBuilderTest {
|
|||||||
createConnectedController(session, connectedListener, allowedCommandChangedListener)) {
|
createConnectedController(session, connectedListener, allowedCommandChangedListener)) {
|
||||||
assertPlayerResultSuccess(sessionPlayerConnector.skipToNextPlaylistItem());
|
assertPlayerResultSuccess(sessionPlayerConnector.skipToNextPlaylistItem());
|
||||||
|
|
||||||
assertThat(
|
assertThat(allowedCommandChangedLatch.await(CONTROLLER_COMMAND_WAIT_TIME_MS, MILLISECONDS))
|
||||||
allowedCommandChangedLatch.await(
|
|
||||||
CONTROLLER_COMMAND_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
|
|
||||||
// Also test whether the rewind fails as expected.
|
// Also test whether the rewind fails as expected.
|
||||||
@ -251,9 +249,7 @@ public class SessionCallbackBuilderTest {
|
|||||||
@Override
|
@Override
|
||||||
public int readAt(long position, byte[] buffer, int offset, int size) {
|
public int readAt(long position, byte[] buffer, int offset, int size) {
|
||||||
try {
|
try {
|
||||||
assertThat(
|
assertThat(readAllowedLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS))
|
||||||
readAllowedLatch.await(
|
|
||||||
PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
assertWithMessage("Unexpected exception %s", e).fail();
|
assertWithMessage("Unexpected exception %s", e).fail();
|
||||||
@ -297,7 +293,7 @@ public class SessionCallbackBuilderTest {
|
|||||||
readAllowedLatch.countDown();
|
readAllowedLatch.countDown();
|
||||||
assertThat(
|
assertThat(
|
||||||
seekToAllowedForSecondMediaItem.await(
|
seekToAllowedForSecondMediaItem.await(
|
||||||
CONTROLLER_COMMAND_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
CONTROLLER_COMMAND_WAIT_TIME_MS, MILLISECONDS))
|
||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,7 +322,7 @@ public class SessionCallbackBuilderTest {
|
|||||||
try (MediaController controller = createConnectedController(session)) {
|
try (MediaController controller = createConnectedController(session)) {
|
||||||
assertSessionResultSuccess(
|
assertSessionResultSuccess(
|
||||||
controller.setRating(testMediaId, testRating), CONTROLLER_COMMAND_WAIT_TIME_MS);
|
controller.setRating(testMediaId, testRating), CONTROLLER_COMMAND_WAIT_TIME_MS);
|
||||||
assertThat(latch.await(0, TimeUnit.MILLISECONDS)).isTrue();
|
assertThat(latch.await(0, MILLISECONDS)).isTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,7 +374,7 @@ public class SessionCallbackBuilderTest {
|
|||||||
try (MediaController controller = createConnectedController(session, null, listener)) {
|
try (MediaController controller = createConnectedController(session, null, listener)) {
|
||||||
assertSessionResultSuccess(
|
assertSessionResultSuccess(
|
||||||
controller.sendCustomCommand(testCommand, null), CONTROLLER_COMMAND_WAIT_TIME_MS);
|
controller.sendCustomCommand(testCommand, null), CONTROLLER_COMMAND_WAIT_TIME_MS);
|
||||||
assertThat(latch.await(0, TimeUnit.MILLISECONDS)).isTrue();
|
assertThat(latch.await(0, MILLISECONDS)).isTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -508,10 +504,9 @@ public class SessionCallbackBuilderTest {
|
|||||||
assertSessionResultSuccess(
|
assertSessionResultSuccess(
|
||||||
controller.setMediaItem(testMediaIdUri.toString()),
|
controller.setMediaItem(testMediaIdUri.toString()),
|
||||||
PLAYER_STATE_CHANGE_OVER_SESSION_WAIT_TIME_MS);
|
PLAYER_STATE_CHANGE_OVER_SESSION_WAIT_TIME_MS);
|
||||||
assertThat(providerLatch.await(0, TimeUnit.MILLISECONDS)).isTrue();
|
assertThat(providerLatch.await(0, MILLISECONDS)).isTrue();
|
||||||
assertThat(
|
assertThat(
|
||||||
currentMediaItemChangedLatch.await(
|
currentMediaItemChangedLatch.await(CONTROLLER_COMMAND_WAIT_TIME_MS, MILLISECONDS))
|
||||||
CONTROLLER_COMMAND_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -543,7 +538,7 @@ public class SessionCallbackBuilderTest {
|
|||||||
.build())) {
|
.build())) {
|
||||||
try (MediaController controller = createConnectedController(session)) {
|
try (MediaController controller = createConnectedController(session)) {
|
||||||
assertSessionResultSuccess(controller.skipBackward(), CONTROLLER_COMMAND_WAIT_TIME_MS);
|
assertSessionResultSuccess(controller.skipBackward(), CONTROLLER_COMMAND_WAIT_TIME_MS);
|
||||||
assertThat(skipBackwardCalledLatch.await(0, TimeUnit.MILLISECONDS)).isTrue();
|
assertThat(skipBackwardCalledLatch.await(0, MILLISECONDS)).isTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -574,7 +569,7 @@ public class SessionCallbackBuilderTest {
|
|||||||
.build())) {
|
.build())) {
|
||||||
try (MediaController controller = createConnectedController(session)) {
|
try (MediaController controller = createConnectedController(session)) {
|
||||||
assertSessionResultSuccess(controller.skipForward(), CONTROLLER_COMMAND_WAIT_TIME_MS);
|
assertSessionResultSuccess(controller.skipForward(), CONTROLLER_COMMAND_WAIT_TIME_MS);
|
||||||
assertThat(skipForwardCalledLatch.await(0, TimeUnit.MILLISECONDS)).isTrue();
|
assertThat(skipForwardCalledLatch.await(0, MILLISECONDS)).isTrue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -591,8 +586,7 @@ public class SessionCallbackBuilderTest {
|
|||||||
.setPostConnectCallback(postConnectCallback)
|
.setPostConnectCallback(postConnectCallback)
|
||||||
.build())) {
|
.build())) {
|
||||||
try (MediaController controller = createConnectedController(session)) {
|
try (MediaController controller = createConnectedController(session)) {
|
||||||
assertThat(postConnectLatch.await(CONTROLLER_COMMAND_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(postConnectLatch.await(CONTROLLER_COMMAND_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
.isTrue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -609,8 +603,7 @@ public class SessionCallbackBuilderTest {
|
|||||||
.setDisconnectedCallback(disconnectCallback)
|
.setDisconnectedCallback(disconnectCallback)
|
||||||
.build())) {
|
.build())) {
|
||||||
try (MediaController controller = createConnectedController(session)) {}
|
try (MediaController controller = createConnectedController(session)) {}
|
||||||
assertThat(disconnectedLatch.await(CONTROLLER_COMMAND_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(disconnectedLatch.await(CONTROLLER_COMMAND_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
.isTrue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -666,13 +659,12 @@ public class SessionCallbackBuilderTest {
|
|||||||
|
|
||||||
private static void assertSessionResultSuccess(Future<SessionResult> future, long timeoutMs)
|
private static void assertSessionResultSuccess(Future<SessionResult> future, long timeoutMs)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
SessionResult result = future.get(timeoutMs, TimeUnit.MILLISECONDS);
|
SessionResult result = future.get(timeoutMs, MILLISECONDS);
|
||||||
assertThat(result.getResultCode()).isEqualTo(SessionResult.RESULT_SUCCESS);
|
assertThat(result.getResultCode()).isEqualTo(SessionResult.RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertSessionResultFailure(Future<SessionResult> future) throws Exception {
|
private static void assertSessionResultFailure(Future<SessionResult> future) throws Exception {
|
||||||
SessionResult result =
|
SessionResult result = future.get(PLAYER_STATE_CHANGE_OVER_SESSION_WAIT_TIME_MS, MILLISECONDS);
|
||||||
future.get(PLAYER_STATE_CHANGE_OVER_SESSION_WAIT_TIME_MS, TimeUnit.MILLISECONDS);
|
|
||||||
assertThat(result.getResultCode()).isNotEqualTo(SessionResult.RESULT_SUCCESS);
|
assertThat(result.getResultCode()).isNotEqualTo(SessionResult.RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import static com.google.android.exoplayer2.ext.media2.TestUtils.assertPlayerRes
|
|||||||
import static com.google.android.exoplayer2.ext.media2.TestUtils.assertPlayerResultSuccess;
|
import static com.google.android.exoplayer2.ext.media2.TestUtils.assertPlayerResultSuccess;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth.assertWithMessage;
|
import static com.google.common.truth.Truth.assertWithMessage;
|
||||||
|
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
@ -61,7 +62,6 @@ import java.util.List;
|
|||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
@ -130,8 +130,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
|
|
||||||
sessionPlayerConnector.prepare();
|
sessionPlayerConnector.prepare();
|
||||||
sessionPlayerConnector.play();
|
sessionPlayerConnector.play();
|
||||||
assertThat(onPlayingLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onPlayingLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
.isTrue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -169,9 +168,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
sessionPlayerConnector.prepare();
|
sessionPlayerConnector.prepare();
|
||||||
sessionPlayerConnector.play();
|
sessionPlayerConnector.play();
|
||||||
});
|
});
|
||||||
assertThat(
|
assertThat(onPlayerStatePlayingLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS))
|
||||||
onPlayerStatePlayingLatch.await(
|
|
||||||
PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,8 +216,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
sessionPlayerConnector.play();
|
sessionPlayerConnector.play();
|
||||||
|
|
||||||
// waiting to complete
|
// waiting to complete
|
||||||
assertThat(
|
assertThat(onPlaybackCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, MILLISECONDS))
|
||||||
onPlaybackCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
assertThat(sessionPlayerConnector.getPlayerState())
|
assertThat(sessionPlayerConnector.getPlayerState())
|
||||||
.isEqualTo(SessionPlayer.PLAYER_STATE_PAUSED);
|
.isEqualTo(SessionPlayer.PLAYER_STATE_PAUSED);
|
||||||
@ -244,8 +240,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
sessionPlayerConnector.play();
|
sessionPlayerConnector.play();
|
||||||
|
|
||||||
// waiting to complete
|
// waiting to complete
|
||||||
assertThat(
|
assertThat(onPlaybackCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, MILLISECONDS))
|
||||||
onPlaybackCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
assertThat(sessionPlayerConnector.getPlayerState())
|
assertThat(sessionPlayerConnector.getPlayerState())
|
||||||
.isEqualTo(SessionPlayer.PLAYER_STATE_PAUSED);
|
.isEqualTo(SessionPlayer.PLAYER_STATE_PAUSED);
|
||||||
@ -380,8 +375,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
sessionPlayerConnector.setPlaybackSpeed(2.0f);
|
sessionPlayerConnector.setPlaybackSpeed(2.0f);
|
||||||
sessionPlayerConnector.play();
|
sessionPlayerConnector.play();
|
||||||
|
|
||||||
assertThat(
|
assertThat(onPlaybackCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, MILLISECONDS))
|
||||||
onPlaybackCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
assertThat(sessionPlayerConnector.getCurrentMediaItem()).isEqualTo(mediaItem2);
|
assertThat(sessionPlayerConnector.getCurrentMediaItem()).isEqualTo(mediaItem2);
|
||||||
assertThat(sessionPlayerConnector.getPlaybackSpeed()).isWithin(0.001f).of(2.0f);
|
assertThat(sessionPlayerConnector.getPlaybackSpeed()).isWithin(0.001f).of(2.0f);
|
||||||
@ -416,9 +410,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
@Override
|
@Override
|
||||||
public int readAt(long position, byte[] buffer, int offset, int size) throws IOException {
|
public int readAt(long position, byte[] buffer, int offset, int size) throws IOException {
|
||||||
try {
|
try {
|
||||||
assertThat(
|
assertThat(readAllowedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, MILLISECONDS))
|
||||||
readAllowedLatch.await(
|
|
||||||
PLAYBACK_COMPLETED_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
assertWithMessage("Unexpected exception %s", e).fail();
|
assertWithMessage("Unexpected exception %s", e).fail();
|
||||||
@ -467,8 +459,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
assertThat(seekFuture1.get().getResultCode()).isEqualTo(RESULT_INFO_SKIPPED);
|
assertThat(seekFuture1.get().getResultCode()).isEqualTo(RESULT_INFO_SKIPPED);
|
||||||
assertThat(seekFuture2.get().getResultCode()).isEqualTo(RESULT_INFO_SKIPPED);
|
assertThat(seekFuture2.get().getResultCode()).isEqualTo(RESULT_INFO_SKIPPED);
|
||||||
assertThat(seekFuture3.get().getResultCode()).isEqualTo(RESULT_SUCCESS);
|
assertThat(seekFuture3.get().getResultCode()).isEqualTo(RESULT_SUCCESS);
|
||||||
assertThat(onSeekCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onSeekCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
.isTrue();
|
|
||||||
assertThat(seekPosition.get()).isEqualTo(testFinalSeekToPosition);
|
assertThat(seekPosition.get()).isEqualTo(testFinalSeekToPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,8 +510,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
|
|
||||||
InstrumentationRegistry.getInstrumentation()
|
InstrumentationRegistry.getInstrumentation()
|
||||||
.runOnMainSync(() -> simpleExoPlayer.seekTo(testSeekPosition));
|
.runOnMainSync(() -> simpleExoPlayer.seekTo(testSeekPosition));
|
||||||
assertThat(onSeekCompletedLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onSeekCompletedLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
.isTrue();
|
|
||||||
assertThat(seekPosition.get()).isEqualTo(testSeekPosition);
|
assertThat(seekPosition.get()).isEqualTo(testSeekPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,8 +582,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
sessionPlayerConnector.registerPlayerCallback(executor, callback);
|
sessionPlayerConnector.registerPlayerCallback(executor, callback);
|
||||||
|
|
||||||
assertPlayerResultSuccess(sessionPlayerConnector.prepare());
|
assertPlayerResultSuccess(sessionPlayerConnector.prepare());
|
||||||
assertThat(onPlayerStatePaused.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onPlayerStatePaused.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
.isTrue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -624,9 +613,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
assertWithMessage(
|
assertWithMessage(
|
||||||
"Expected BUFFERING_STATE_COMPLETE only once. Full changes are %s",
|
"Expected BUFFERING_STATE_COMPLETE only once. Full changes are %s",
|
||||||
bufferingStateChanges)
|
bufferingStateChanges)
|
||||||
.that(
|
.that(onBufferingCompletedLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS))
|
||||||
onBufferingCompletedLatch.await(
|
|
||||||
PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isFalse();
|
.isFalse();
|
||||||
assertThat(bufferingStateChanges).isNotEmpty();
|
assertThat(bufferingStateChanges).isNotEmpty();
|
||||||
int lastIndex = bufferingStateChanges.size() - 1;
|
int lastIndex = bufferingStateChanges.size() - 1;
|
||||||
@ -660,8 +647,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
|
|
||||||
sessionPlayerConnector.seekTo(mp4DurationMs >> 1);
|
sessionPlayerConnector.seekTo(mp4DurationMs >> 1);
|
||||||
|
|
||||||
assertThat(onSeekCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onSeekCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
.isTrue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -688,9 +674,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
|
|
||||||
sessionPlayerConnector.setPlaybackSpeed(0.5f);
|
sessionPlayerConnector.setPlaybackSpeed(0.5f);
|
||||||
|
|
||||||
assertThat(
|
assertThat(onPlaybackSpeedChangedLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS))
|
||||||
onPlaybackSpeedChangedLatch.await(
|
|
||||||
PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,9 +737,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
public int readAt(long position, byte[] buffer, int offset, int size) throws IOException {
|
public int readAt(long position, byte[] buffer, int offset, int size) throws IOException {
|
||||||
readRequestedLatch.countDown();
|
readRequestedLatch.countDown();
|
||||||
try {
|
try {
|
||||||
assertThat(
|
assertThat(readAllowedLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS))
|
||||||
readAllowedLatch.await(
|
|
||||||
PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
assertWithMessage("Unexpected exception %s", e).fail();
|
assertWithMessage("Unexpected exception %s", e).fail();
|
||||||
@ -780,8 +762,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
ListenableFuture<PlayerResult> prepareFuture = sessionPlayerConnector.prepare();
|
ListenableFuture<PlayerResult> prepareFuture = sessionPlayerConnector.prepare();
|
||||||
ListenableFuture<PlayerResult> seekFuture = sessionPlayerConnector.seekTo(1000);
|
ListenableFuture<PlayerResult> seekFuture = sessionPlayerConnector.seekTo(1000);
|
||||||
|
|
||||||
assertThat(readRequestedLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(readRequestedLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
.isTrue();
|
|
||||||
|
|
||||||
// Cancel the pending commands while preparation is on hold.
|
// Cancel the pending commands while preparation is on hold.
|
||||||
seekFuture.cancel(false);
|
seekFuture.cancel(false);
|
||||||
@ -834,9 +815,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
executor, new PlayerCallbackForPlaylist(playlist, onCurrentMediaItemChangedLatch));
|
executor, new PlayerCallbackForPlaylist(playlist, onCurrentMediaItemChangedLatch));
|
||||||
|
|
||||||
assertPlayerResultSuccess(sessionPlayerConnector.setPlaylist(playlist, null));
|
assertPlayerResultSuccess(sessionPlayerConnector.setPlaylist(playlist, null));
|
||||||
assertThat(
|
assertThat(onCurrentMediaItemChangedLatch.await(PLAYLIST_CHANGE_WAIT_TIME_MS, MILLISECONDS))
|
||||||
onCurrentMediaItemChangedLatch.await(
|
|
||||||
PLAYLIST_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
|
|
||||||
assertThat(sessionPlayerConnector.getPlaylist()).isEqualTo(playlist);
|
assertThat(sessionPlayerConnector.getPlaylist()).isEqualTo(playlist);
|
||||||
@ -864,8 +843,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
|
|
||||||
sessionPlayerConnector.setPlaylist(playlist, /* metadata= */ null);
|
sessionPlayerConnector.setPlaylist(playlist, /* metadata= */ null);
|
||||||
sessionPlayerConnector.prepare();
|
sessionPlayerConnector.prepare();
|
||||||
assertThat(onPlaylistChangedLatch.await(PLAYLIST_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onPlaylistChangedLatch.await(PLAYLIST_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isFalse();
|
||||||
.isFalse();
|
|
||||||
assertThat(onPlaylistChangedLatch.getCount()).isEqualTo(1);
|
assertThat(onPlaylistChangedLatch.getCount()).isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -894,8 +872,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
sessionPlayerConnector.addPlaylistItem(addIndex, newMediaItem);
|
sessionPlayerConnector.addPlaylistItem(addIndex, newMediaItem);
|
||||||
assertThat(onPlaylistChangedLatch.await(PLAYLIST_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onPlaylistChangedLatch.await(PLAYLIST_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isFalse();
|
||||||
.isFalse();
|
|
||||||
assertThat(onPlaylistChangedLatch.getCount()).isEqualTo(1);
|
assertThat(onPlaylistChangedLatch.getCount()).isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -923,8 +900,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
sessionPlayerConnector.removePlaylistItem(removeIndex);
|
sessionPlayerConnector.removePlaylistItem(removeIndex);
|
||||||
assertThat(onPlaylistChangedLatch.await(PLAYLIST_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onPlaylistChangedLatch.await(PLAYLIST_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isFalse();
|
||||||
.isFalse();
|
|
||||||
assertThat(onPlaylistChangedLatch.getCount()).isEqualTo(1);
|
assertThat(onPlaylistChangedLatch.getCount()).isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -953,8 +929,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
sessionPlayerConnector.replacePlaylistItem(replaceIndex, newMediaItem);
|
sessionPlayerConnector.replacePlaylistItem(replaceIndex, newMediaItem);
|
||||||
assertThat(onPlaylistChangedLatch.await(PLAYLIST_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onPlaylistChangedLatch.await(PLAYLIST_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isFalse();
|
||||||
.isFalse();
|
|
||||||
assertThat(onPlaylistChangedLatch.getCount()).isEqualTo(1);
|
assertThat(onPlaylistChangedLatch.getCount()).isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,9 +946,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
|
|
||||||
assertPlayerResultSuccess(sessionPlayerConnector.setPlaylist(playlist, null));
|
assertPlayerResultSuccess(sessionPlayerConnector.setPlaylist(playlist, null));
|
||||||
assertThat(sessionPlayerConnector.getCurrentMediaItemIndex()).isEqualTo(0);
|
assertThat(sessionPlayerConnector.getCurrentMediaItemIndex()).isEqualTo(0);
|
||||||
assertThat(
|
assertThat(onCurrentMediaItemChangedLatch.await(PLAYLIST_CHANGE_WAIT_TIME_MS, MILLISECONDS))
|
||||||
onCurrentMediaItemChangedLatch.await(
|
|
||||||
PLAYLIST_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1024,8 +997,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
assertThat(sessionPlayerConnector.prepare()).isNotNull();
|
assertThat(sessionPlayerConnector.prepare()).isNotNull();
|
||||||
assertThat(sessionPlayerConnector.play()).isNotNull();
|
assertThat(sessionPlayerConnector.play()).isNotNull();
|
||||||
|
|
||||||
assertThat(
|
assertThat(onPlaybackCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, MILLISECONDS))
|
||||||
onPlaybackCompletedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1052,8 +1024,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
InstrumentationRegistry.getInstrumentation()
|
InstrumentationRegistry.getInstrumentation()
|
||||||
.runOnMainSync(() -> simpleExoPlayer.setPlayWhenReady(true));
|
.runOnMainSync(() -> simpleExoPlayer.setPlayWhenReady(true));
|
||||||
|
|
||||||
assertThat(onPlayingLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onPlayingLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
.isTrue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -1091,8 +1062,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
InstrumentationRegistry.getInstrumentation()
|
InstrumentationRegistry.getInstrumentation()
|
||||||
.runOnMainSync(() -> simpleExoPlayer.setPlayWhenReady(false));
|
.runOnMainSync(() -> simpleExoPlayer.setPlayWhenReady(false));
|
||||||
|
|
||||||
assertThat(onPausedLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onPausedLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
.isTrue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -1129,8 +1099,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
assertPlayerResultSuccess(sessionPlayerConnector.play());
|
assertPlayerResultSuccess(sessionPlayerConnector.play());
|
||||||
assertThat(
|
assertThat(playerStateChangesLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS))
|
||||||
playerStateChangesLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
assertThat(playerStateChanges)
|
assertThat(playerStateChanges)
|
||||||
.containsExactly(
|
.containsExactly(
|
||||||
@ -1172,8 +1141,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
};
|
};
|
||||||
sessionPlayerConnector.registerPlayerCallback(executor, skipToNextTestCallback);
|
sessionPlayerConnector.registerPlayerCallback(executor, skipToNextTestCallback);
|
||||||
assertPlayerResultSuccess(sessionPlayerConnector.skipToNextPlaylistItem());
|
assertPlayerResultSuccess(sessionPlayerConnector.skipToNextPlaylistItem());
|
||||||
assertThat(onNextMediaItemLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
assertThat(onNextMediaItemLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS)).isTrue();
|
||||||
.isTrue();
|
|
||||||
sessionPlayerConnector.unregisterPlayerCallback(skipToNextTestCallback);
|
sessionPlayerConnector.unregisterPlayerCallback(skipToNextTestCallback);
|
||||||
|
|
||||||
// STEP 3: skipToPreviousPlaylistItem()
|
// STEP 3: skipToPreviousPlaylistItem()
|
||||||
@ -1193,8 +1161,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
};
|
};
|
||||||
sessionPlayerConnector.registerPlayerCallback(executor, skipToPreviousTestCallback);
|
sessionPlayerConnector.registerPlayerCallback(executor, skipToPreviousTestCallback);
|
||||||
assertPlayerResultSuccess(sessionPlayerConnector.skipToPreviousPlaylistItem());
|
assertPlayerResultSuccess(sessionPlayerConnector.skipToPreviousPlaylistItem());
|
||||||
assertThat(
|
assertThat(onPreviousMediaItemLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS))
|
||||||
onPreviousMediaItemLatch.await(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
sessionPlayerConnector.unregisterPlayerCallback(skipToPreviousTestCallback);
|
sessionPlayerConnector.unregisterPlayerCallback(skipToPreviousTestCallback);
|
||||||
}
|
}
|
||||||
@ -1243,9 +1210,7 @@ public class SessionPlayerConnectorTest {
|
|||||||
assertWithMessage(
|
assertWithMessage(
|
||||||
"Current media item didn't change as expected. Actual changes were %s",
|
"Current media item didn't change as expected. Actual changes were %s",
|
||||||
currentMediaItemChanges)
|
currentMediaItemChanges)
|
||||||
.that(
|
.that(onCurrentMediaItemChangedLatch.await(PLAYBACK_COMPLETED_WAIT_TIME_MS, MILLISECONDS))
|
||||||
onCurrentMediaItemChangedLatch.await(
|
|
||||||
PLAYBACK_COMPLETED_WAIT_TIME_MS, TimeUnit.MILLISECONDS))
|
|
||||||
.isTrue();
|
.isTrue();
|
||||||
|
|
||||||
int expectedMediaItemIndex = 0;
|
int expectedMediaItemIndex = 0;
|
||||||
|
@ -18,6 +18,7 @@ package com.google.android.exoplayer2.ext.media2;
|
|||||||
|
|
||||||
import static androidx.media2.common.SessionPlayer.PlayerResult.RESULT_SUCCESS;
|
import static androidx.media2.common.SessionPlayer.PlayerResult.RESULT_SUCCESS;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -31,7 +32,6 @@ import androidx.media2.common.UriMediaItem;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/** Utilities for tests. */
|
/** Utilities for tests. */
|
||||||
public final class TestUtils {
|
public final class TestUtils {
|
||||||
@ -84,7 +84,7 @@ public final class TestUtils {
|
|||||||
Future<PlayerResult> future, /* @PlayerResult.ResultCode */ int playerResult)
|
Future<PlayerResult> future, /* @PlayerResult.ResultCode */ int playerResult)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
assertThat(future).isNotNull();
|
assertThat(future).isNotNull();
|
||||||
PlayerResult result = future.get(PLAYER_STATE_CHANGE_WAIT_TIME_MS, TimeUnit.MILLISECONDS);
|
PlayerResult result = future.get(PLAYER_STATE_CHANGE_WAIT_TIME_MS, MILLISECONDS);
|
||||||
assertThat(result).isNotNull();
|
assertThat(result).isNotNull();
|
||||||
assertThat(result.getResultCode()).isEqualTo(playerResult);
|
assertThat(result.getResultCode()).isEqualTo(playerResult);
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.exoplayer2.ext.media2;
|
package com.google.android.exoplayer2.ext.media2;
|
||||||
|
|
||||||
|
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||||
|
|
||||||
import androidx.annotation.GuardedBy;
|
import androidx.annotation.GuardedBy;
|
||||||
import androidx.annotation.IntDef;
|
import androidx.annotation.IntDef;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@ -33,7 +35,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/** Manages the queue of player actions and handles running them one by one. */
|
/** Manages the queue of player actions and handles running them one by one. */
|
||||||
/* package */ class PlayerCommandQueue implements AutoCloseable {
|
/* package */ class PlayerCommandQueue implements AutoCloseable {
|
||||||
@ -399,7 +400,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
.append(result.hashCode());
|
.append(result.hashCode());
|
||||||
if (result.isDone()) {
|
if (result.isDone()) {
|
||||||
try {
|
try {
|
||||||
int resultCode = result.get(/* timeout= */ 0, TimeUnit.MILLISECONDS).getResultCode();
|
int resultCode = result.get(/* timeout= */ 0, MILLISECONDS).getResultCode();
|
||||||
stringBuilder.append(", resultCode=").append(resultCode);
|
stringBuilder.append(", resultCode=").append(resultCode);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// pass-through.
|
// pass-through.
|
||||||
@ -437,7 +438,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
.append(result.hashCode());
|
.append(result.hashCode());
|
||||||
if (result.isDone()) {
|
if (result.isDone()) {
|
||||||
try {
|
try {
|
||||||
int resultCode = result.get(/* timeout= */ 0, TimeUnit.MILLISECONDS).getResultCode();
|
int resultCode = result.get(/* timeout= */ 0, MILLISECONDS).getResultCode();
|
||||||
stringBuilder.append(", resultCode=").append(resultCode);
|
stringBuilder.append(", resultCode=").append(resultCode);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// pass-through.
|
// pass-through.
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.google.android.exoplayer2.ext.media2;
|
package com.google.android.exoplayer2.ext.media2;
|
||||||
|
|
||||||
|
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@ -43,7 +45,6 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
/* package */ class SessionCallback extends MediaSession.SessionCallback {
|
/* package */ class SessionCallback extends MediaSession.SessionCallback {
|
||||||
@ -205,7 +206,7 @@ import java.util.concurrent.TimeoutException;
|
|||||||
if (seekTimeoutMs <= 0) {
|
if (seekTimeoutMs <= 0) {
|
||||||
return result.get().getResultCode();
|
return result.get().getResultCode();
|
||||||
}
|
}
|
||||||
return result.get(seekTimeoutMs, TimeUnit.MILLISECONDS).getResultCode();
|
return result.get(seekTimeoutMs, MILLISECONDS).getResultCode();
|
||||||
} catch (ExecutionException | InterruptedException | TimeoutException e) {
|
} catch (ExecutionException | InterruptedException | TimeoutException e) {
|
||||||
Log.w(TAG, "Failed to get the seeking result", e);
|
Log.w(TAG, "Failed to get the seeking result", e);
|
||||||
return SessionResult.RESULT_ERROR_UNKNOWN;
|
return SessionResult.RESULT_ERROR_UNKNOWN;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user