Commit a300a509 by sheenachhabra Committed by Tofunmi Adigun-Hameed

Add default constructor for InAppMuxer.Factory

PiperOrigin-RevId: 532838813
(cherry picked from commit bd95fcd98d87c3ba6ada053a6f2ca1468accf4a4)
parent d9a3f9c0
...@@ -53,10 +53,7 @@ public class TransformerWithInAppMuxerEndToEndTest { ...@@ -53,10 +53,7 @@ public class TransformerWithInAppMuxerEndToEndTest {
public void videoEditing_completesSuccessfully() throws Exception { public void videoEditing_completesSuccessfully() throws Exception {
String testId = "videoEditing_completesSuccessfully"; String testId = "videoEditing_completesSuccessfully";
Transformer transformer = Transformer transformer =
new Transformer.Builder(context) new Transformer.Builder(context).setMuxerFactory(new InAppMuxer.Factory()).build();
.setMuxerFactory(
new InAppMuxer.Factory(DefaultMuxer.Factory.DEFAULT_MAX_DELAY_BETWEEN_SAMPLES_MS))
.build();
ImmutableList<Effect> videoEffects = ImmutableList.of(RgbFilter.createGrayscaleFilter()); ImmutableList<Effect> videoEffects = ImmutableList.of(RgbFilter.createGrayscaleFilter());
MediaItem mediaItem = MediaItem.fromUri(Uri.parse(MP4_FILE_ASSET_DIRECTORY + inputFile)); MediaItem mediaItem = MediaItem.fromUri(Uri.parse(MP4_FILE_ASSET_DIRECTORY + inputFile));
EditedMediaItem editedMediaItem = EditedMediaItem editedMediaItem =
...@@ -76,10 +73,7 @@ public class TransformerWithInAppMuxerEndToEndTest { ...@@ -76,10 +73,7 @@ public class TransformerWithInAppMuxerEndToEndTest {
public void audioEditing_completesSuccessfully() throws Exception { public void audioEditing_completesSuccessfully() throws Exception {
String testId = "audioEditing_completesSuccessfully"; String testId = "audioEditing_completesSuccessfully";
Transformer transformer = Transformer transformer =
new Transformer.Builder(context) new Transformer.Builder(context).setMuxerFactory(new InAppMuxer.Factory()).build();
.setMuxerFactory(
new InAppMuxer.Factory(DefaultMuxer.Factory.DEFAULT_MAX_DELAY_BETWEEN_SAMPLES_MS))
.build();
ChannelMixingAudioProcessor channelMixingAudioProcessor = new ChannelMixingAudioProcessor(); ChannelMixingAudioProcessor channelMixingAudioProcessor = new ChannelMixingAudioProcessor();
channelMixingAudioProcessor.putChannelMixingMatrix( channelMixingAudioProcessor.putChannelMixingMatrix(
ChannelMixingMatrix.create(/* inputChannelCount= */ 1, /* outputChannelCount= */ 2)); ChannelMixingMatrix.create(/* inputChannelCount= */ 1, /* outputChannelCount= */ 2));
......
...@@ -26,7 +26,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4; ...@@ -26,7 +26,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.google.android.exoplayer2.MediaItem; import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.effect.RgbFilter; import com.google.android.exoplayer2.effect.RgbFilter;
import com.google.android.exoplayer2.transformer.AndroidTestUtil; import com.google.android.exoplayer2.transformer.AndroidTestUtil;
import com.google.android.exoplayer2.transformer.DefaultMuxer;
import com.google.android.exoplayer2.transformer.EditedMediaItem; import com.google.android.exoplayer2.transformer.EditedMediaItem;
import com.google.android.exoplayer2.transformer.Effects; import com.google.android.exoplayer2.transformer.Effects;
import com.google.android.exoplayer2.transformer.ExportTestResult; import com.google.android.exoplayer2.transformer.ExportTestResult;
...@@ -50,10 +49,7 @@ public class TransformerWithInAppMuxerEndToEndTest { ...@@ -50,10 +49,7 @@ public class TransformerWithInAppMuxerEndToEndTest {
return; return;
} }
Transformer transformer = Transformer transformer =
new Transformer.Builder(context) new Transformer.Builder(context).setMuxerFactory(new InAppMuxer.Factory()).build();
.setMuxerFactory(
new InAppMuxer.Factory(DefaultMuxer.Factory.DEFAULT_MAX_DELAY_BETWEEN_SAMPLES_MS))
.build();
ImmutableList<Effect> videoEffects = ImmutableList.of(RgbFilter.createGrayscaleFilter()); ImmutableList<Effect> videoEffects = ImmutableList.of(RgbFilter.createGrayscaleFilter());
MediaItem mediaItem = MediaItem.fromUri(Uri.parse(MP4_ASSET_AV1_VIDEO_URI_STRING)); MediaItem mediaItem = MediaItem.fromUri(Uri.parse(MP4_ASSET_AV1_VIDEO_URI_STRING));
EditedMediaItem editedMediaItem = EditedMediaItem editedMediaItem =
......
...@@ -40,6 +40,16 @@ public final class InAppMuxer implements Muxer { ...@@ -40,6 +40,16 @@ public final class InAppMuxer implements Muxer {
public static final class Factory implements Muxer.Factory { public static final class Factory implements Muxer.Factory {
private final long maxDelayBetweenSamplesMs; private final long maxDelayBetweenSamplesMs;
/**
* Creates an instance with {@link Muxer#getMaxDelayBetweenSamplesMs() maxDelayBetweenSamplesMs}
* set to {@link DefaultMuxer.Factory#DEFAULT_MAX_DELAY_BETWEEN_SAMPLES_MS}.
*/
public Factory() {
this(
/* maxDelayBetweenSamplesMs= */ DefaultMuxer.Factory
.DEFAULT_MAX_DELAY_BETWEEN_SAMPLES_MS);
}
/** {@link Muxer.Factory} for {@link InAppMuxer}. */ /** {@link Muxer.Factory} for {@link InAppMuxer}. */
public Factory(long maxDelayBetweenSamplesMs) { public Factory(long maxDelayBetweenSamplesMs) {
this.maxDelayBetweenSamplesMs = maxDelayBetweenSamplesMs; this.maxDelayBetweenSamplesMs = maxDelayBetweenSamplesMs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment