mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Remove limit of 2 sequences in CompositionPlayer
The player supports more than 2 audio sequences PiperOrigin-RevId: 675493637
This commit is contained in:
parent
6632e64007
commit
0ea229d795
@ -280,7 +280,6 @@ public final class CompositionPlayer extends SimpleBasePlayer
|
|||||||
EVENT_MEDIA_ITEM_TRANSITION,
|
EVENT_MEDIA_ITEM_TRANSITION,
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final int MAX_SUPPORTED_SEQUENCES = 2;
|
|
||||||
private static final String TAG = "CompositionPlayer";
|
private static final String TAG = "CompositionPlayer";
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
@ -337,9 +336,7 @@ public final class CompositionPlayer extends SimpleBasePlayer
|
|||||||
*/
|
*/
|
||||||
public void setComposition(Composition composition) {
|
public void setComposition(Composition composition) {
|
||||||
verifyApplicationThread();
|
verifyApplicationThread();
|
||||||
checkArgument(
|
checkArgument(!composition.sequences.isEmpty());
|
||||||
!composition.sequences.isEmpty()
|
|
||||||
&& composition.sequences.size() <= MAX_SUPPORTED_SEQUENCES);
|
|
||||||
checkState(this.composition == null);
|
checkState(this.composition == null);
|
||||||
composition = deactivateSpeedAdjustingVideoEffects(composition);
|
composition = deactivateSpeedAdjustingVideoEffects(composition);
|
||||||
|
|
||||||
|
@ -262,25 +262,6 @@ public class CompositionPlayerTest {
|
|||||||
player.release();
|
player.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void setComposition_threeSequences_throws() {
|
|
||||||
CompositionPlayer player = buildCompositionPlayer();
|
|
||||||
|
|
||||||
EditedMediaItem editedMediaItem =
|
|
||||||
new EditedMediaItem.Builder(MediaItem.EMPTY).setDurationUs(1_000).build();
|
|
||||||
Composition composition =
|
|
||||||
new Composition.Builder(
|
|
||||||
ImmutableList.of(
|
|
||||||
new EditedMediaItemSequence(editedMediaItem),
|
|
||||||
new EditedMediaItemSequence(editedMediaItem),
|
|
||||||
new EditedMediaItemSequence(editedMediaItem)))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
assertThrows(IllegalArgumentException.class, () -> player.setComposition(composition));
|
|
||||||
|
|
||||||
player.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void prepare_withoutCompositionSet_throws() {
|
public void prepare_withoutCompositionSet_throws() {
|
||||||
CompositionPlayer player = buildCompositionPlayer();
|
CompositionPlayer player = buildCompositionPlayer();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user