Java Code Examples for com.google.android.exoplayer2.PlaybackParameters#DEFAULT

The following examples show how to use com.google.android.exoplayer2.PlaybackParameters#DEFAULT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultAudioSink.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public PlaybackParameters setPlaybackParameters(PlaybackParameters playbackParameters) {
  if (configuration != null && !configuration.canApplyPlaybackParameters) {
    this.playbackParameters = PlaybackParameters.DEFAULT;
    return this.playbackParameters;
  }
  PlaybackParameters lastSetPlaybackParameters =
      afterDrainPlaybackParameters != null
          ? afterDrainPlaybackParameters
          : !playbackParametersCheckpoints.isEmpty()
              ? playbackParametersCheckpoints.getLast().playbackParameters
              : this.playbackParameters;
  if (!playbackParameters.equals(lastSetPlaybackParameters)) {
    if (isInitialized()) {
      // Drain the audio processors so we can determine the frame position at which the new
      // parameters apply.
      afterDrainPlaybackParameters = playbackParameters;
    } else {
      // Update the playback parameters now. They will be applied to the audio processors during
      // initialization.
      this.playbackParameters = playbackParameters;
    }
  }
  return this.playbackParameters;
}
 
Example 2
Source File: DefaultAudioSink.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@Override
public void setPlaybackParameters(PlaybackParameters playbackParameters) {
  if (configuration != null && !configuration.canApplyPlaybackParameters) {
    this.playbackParameters = PlaybackParameters.DEFAULT;
    return;
  }
  PlaybackParameters lastSetPlaybackParameters = getPlaybackParameters();
  if (!playbackParameters.equals(lastSetPlaybackParameters)) {
    if (isInitialized()) {
      // Drain the audio processors so we can determine the frame position at which the new
      // parameters apply.
      afterDrainPlaybackParameters = playbackParameters;
    } else {
      // Update the playback parameters now. They will be applied to the audio processors during
      // initialization.
      this.playbackParameters = playbackParameters;
    }
  }
}
 
Example 3
Source File: DefaultAudioSink.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public PlaybackParameters setPlaybackParameters(PlaybackParameters playbackParameters) {
  if (configuration != null && !configuration.canApplyPlaybackParameters) {
    this.playbackParameters = PlaybackParameters.DEFAULT;
    return this.playbackParameters;
  }
  PlaybackParameters lastSetPlaybackParameters =
      afterDrainPlaybackParameters != null
          ? afterDrainPlaybackParameters
          : !playbackParametersCheckpoints.isEmpty()
              ? playbackParametersCheckpoints.getLast().playbackParameters
              : this.playbackParameters;
  if (!playbackParameters.equals(lastSetPlaybackParameters)) {
    if (isInitialized()) {
      // Drain the audio processors so we can determine the frame position at which the new
      // parameters apply.
      afterDrainPlaybackParameters = playbackParameters;
    } else {
      // Update the playback parameters now. They will be applied to the audio processors during
      // initialization.
      this.playbackParameters = playbackParameters;
    }
  }
  return this.playbackParameters;
}
 
Example 4
Source File: DefaultAudioSink.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public PlaybackParameters setPlaybackParameters(PlaybackParameters playbackParameters) {
  if (isInitialized() && !canApplyPlaybackParameters) {
    this.playbackParameters = PlaybackParameters.DEFAULT;
    return this.playbackParameters;
  }
  PlaybackParameters lastSetPlaybackParameters =
      afterDrainPlaybackParameters != null
          ? afterDrainPlaybackParameters
          : !playbackParametersCheckpoints.isEmpty()
              ? playbackParametersCheckpoints.getLast().playbackParameters
              : this.playbackParameters;
  if (!playbackParameters.equals(lastSetPlaybackParameters)) {
    if (isInitialized()) {
      // Drain the audio processors so we can determine the frame position at which the new
      // parameters apply.
      afterDrainPlaybackParameters = playbackParameters;
    } else {
      // Update the playback parameters now.
      this.playbackParameters = audioProcessorChain.applyPlaybackParameters(playbackParameters);
    }
  }
  return this.playbackParameters;
}
 
Example 5
Source File: DefaultAudioSink.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public PlaybackParameters setPlaybackParameters(PlaybackParameters playbackParameters) {
  if (isInitialized() && !canApplyPlaybackParameters) {
    this.playbackParameters = PlaybackParameters.DEFAULT;
    return this.playbackParameters;
  }
  PlaybackParameters lastSetPlaybackParameters =
      afterDrainPlaybackParameters != null
          ? afterDrainPlaybackParameters
          : !playbackParametersCheckpoints.isEmpty()
              ? playbackParametersCheckpoints.getLast().playbackParameters
              : this.playbackParameters;
  if (!playbackParameters.equals(lastSetPlaybackParameters)) {
    if (isInitialized()) {
      // Drain the audio processors so we can determine the frame position at which the new
      // parameters apply.
      afterDrainPlaybackParameters = playbackParameters;
    } else {
      // Update the playback parameters now.
      this.playbackParameters = audioProcessorChain.applyPlaybackParameters(playbackParameters);
    }
  }
  return this.playbackParameters;
}
 
Example 6
Source File: DefaultAudioSink.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void initialize() throws InitializationException {
  // If we're asynchronously releasing a previous audio track then we block until it has been
  // released. This guarantees that we cannot end up in a state where we have multiple audio
  // track instances. Without this guarantee it would be possible, in extreme cases, to exhaust
  // the shared memory that's available for audio track buffers. This would in turn cause the
  // initialization of the audio track to fail.
  releasingConditionVariable.block();

  audioTrack = initializeAudioTrack();
  int audioSessionId = audioTrack.getAudioSessionId();
  if (enablePreV21AudioSessionWorkaround) {
    if (Util.SDK_INT < 21) {
      // The workaround creates an audio track with a two byte buffer on the same session, and
      // does not release it until this object is released, which keeps the session active.
      if (keepSessionIdAudioTrack != null
          && audioSessionId != keepSessionIdAudioTrack.getAudioSessionId()) {
        releaseKeepSessionIdAudioTrack();
      }
      if (keepSessionIdAudioTrack == null) {
        keepSessionIdAudioTrack = initializeKeepSessionIdAudioTrack(audioSessionId);
      }
    }
  }
  if (this.audioSessionId != audioSessionId) {
    this.audioSessionId = audioSessionId;
    if (listener != null) {
      listener.onAudioSessionId(audioSessionId);
    }
  }

  playbackParameters =
      canApplyPlaybackParameters
          ? audioProcessorChain.applyPlaybackParameters(playbackParameters)
          : PlaybackParameters.DEFAULT;
  setupAudioProcessors();

  audioTrackPositionTracker.setAudioTrack(
      audioTrack, outputEncoding, outputPcmFrameSize, bufferSize);
  setVolumeInternal();
}
 
Example 7
Source File: DefaultAudioSink.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void applyPlaybackParameters(
    PlaybackParameters playbackParameters, long presentationTimeUs) {
  PlaybackParameters newPlaybackParameters =
      configuration.canApplyPlaybackParameters
          ? audioProcessorChain.applyPlaybackParameters(playbackParameters)
          : PlaybackParameters.DEFAULT;
  // Store the position and corresponding media time from which the parameters will apply.
  playbackParametersCheckpoints.add(
      new PlaybackParametersCheckpoint(
          newPlaybackParameters,
          /* mediaTimeUs= */ Math.max(0, presentationTimeUs),
          /* positionUs= */ configuration.framesToDurationUs(getWrittenFrames())));
  setupAudioProcessors();
}
 
Example 8
Source File: DefaultAudioSink.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void applyPlaybackParameters(
    PlaybackParameters playbackParameters, long presentationTimeUs) {
  PlaybackParameters newPlaybackParameters =
      configuration.canApplyPlaybackParameters
          ? audioProcessorChain.applyPlaybackParameters(playbackParameters)
          : PlaybackParameters.DEFAULT;
  // Store the position and corresponding media time from which the parameters will apply.
  playbackParametersCheckpoints.add(
      new PlaybackParametersCheckpoint(
          newPlaybackParameters,
          /* mediaTimeUs= */ Math.max(0, presentationTimeUs),
          /* positionUs= */ configuration.framesToDurationUs(getWrittenFrames())));
  setupAudioProcessors();
}
 
Example 9
Source File: DefaultAudioSink.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new default audio sink, optionally using float output for high resolution PCM and
 * with the specified {@code audioProcessorChain}.
 *
 * @param audioCapabilities The audio capabilities for playback on this device. May be null if the
 *     default capabilities (no encoded audio passthrough support) should be assumed.
 * @param audioProcessorChain An {@link AudioProcessorChain} which is used to apply playback
 *     parameters adjustments. The instance passed in must not be reused in other sinks.
 * @param enableConvertHighResIntPcmToFloat Whether to enable conversion of high resolution
 *     integer PCM to 32-bit float for output, if possible. Functionality that uses 16-bit integer
 *     audio processing (for example, speed and pitch adjustment) will not be available when float
 *     output is in use.
 */
public DefaultAudioSink(
    @Nullable AudioCapabilities audioCapabilities,
    AudioProcessorChain audioProcessorChain,
    boolean enableConvertHighResIntPcmToFloat) {
  this.audioCapabilities = audioCapabilities;
  this.audioProcessorChain = Assertions.checkNotNull(audioProcessorChain);
  this.enableConvertHighResIntPcmToFloat = enableConvertHighResIntPcmToFloat;
  releasingConditionVariable = new ConditionVariable(true);
  audioTrackPositionTracker = new AudioTrackPositionTracker(new PositionTrackerListener());
  channelMappingAudioProcessor = new ChannelMappingAudioProcessor();
  trimmingAudioProcessor = new TrimmingAudioProcessor();
  ArrayList<AudioProcessor> toIntPcmAudioProcessors = new ArrayList<>();
  Collections.addAll(
      toIntPcmAudioProcessors,
      new ResamplingAudioProcessor(),
      channelMappingAudioProcessor,
      trimmingAudioProcessor);
  Collections.addAll(toIntPcmAudioProcessors, audioProcessorChain.getAudioProcessors());
  toIntPcmAvailableAudioProcessors = toIntPcmAudioProcessors.toArray(new AudioProcessor[0]);
  toFloatPcmAvailableAudioProcessors = new AudioProcessor[] {new FloatResamplingAudioProcessor()};
  volume = 1.0f;
  startMediaTimeState = START_NOT_SET;
  audioAttributes = AudioAttributes.DEFAULT;
  audioSessionId = C.AUDIO_SESSION_ID_UNSET;
  auxEffectInfo = new AuxEffectInfo(AuxEffectInfo.NO_AUX_EFFECT_ID, 0f);
  playbackParameters = PlaybackParameters.DEFAULT;
  drainingAudioProcessorIndex = C.INDEX_UNSET;
  activeAudioProcessors = new AudioProcessor[0];
  outputBuffers = new ByteBuffer[0];
  playbackParametersCheckpoints = new ArrayDeque<>();
}
 
Example 10
Source File: DefaultAudioSink.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new default audio sink, optionally using float output for high resolution PCM and
 * with the specified {@code audioProcessorChain}.
 *
 * @param audioCapabilities The audio capabilities for playback on this device. May be null if the
 *     default capabilities (no encoded audio passthrough support) should be assumed.
 * @param audioProcessorChain An {@link AudioProcessorChain} which is used to apply playback
 *     parameters adjustments. The instance passed in must not be reused in other sinks.
 * @param enableConvertHighResIntPcmToFloat Whether to enable conversion of high resolution
 *     integer PCM to 32-bit float for output, if possible. Functionality that uses 16-bit integer
 *     audio processing (for example, speed and pitch adjustment) will not be available when float
 *     output is in use.
 */
public DefaultAudioSink(
    @Nullable AudioCapabilities audioCapabilities,
    AudioProcessorChain audioProcessorChain,
    boolean enableConvertHighResIntPcmToFloat) {
  this.audioCapabilities = audioCapabilities;
  this.audioProcessorChain = Assertions.checkNotNull(audioProcessorChain);
  this.enableConvertHighResIntPcmToFloat = enableConvertHighResIntPcmToFloat;
  releasingConditionVariable = new ConditionVariable(true);
  audioTrackPositionTracker = new AudioTrackPositionTracker(new PositionTrackerListener());
  channelMappingAudioProcessor = new ChannelMappingAudioProcessor();
  trimmingAudioProcessor = new TrimmingAudioProcessor();
  ArrayList<AudioProcessor> toIntPcmAudioProcessors = new ArrayList<>();
  Collections.addAll(
      toIntPcmAudioProcessors,
      new ResamplingAudioProcessor(),
      channelMappingAudioProcessor,
      trimmingAudioProcessor);
  Collections.addAll(toIntPcmAudioProcessors, audioProcessorChain.getAudioProcessors());
  toIntPcmAvailableAudioProcessors =
      toIntPcmAudioProcessors.toArray(new AudioProcessor[toIntPcmAudioProcessors.size()]);
  toFloatPcmAvailableAudioProcessors = new AudioProcessor[] {new FloatResamplingAudioProcessor()};
  volume = 1.0f;
  startMediaTimeState = START_NOT_SET;
  audioAttributes = AudioAttributes.DEFAULT;
  audioSessionId = C.AUDIO_SESSION_ID_UNSET;
  playbackParameters = PlaybackParameters.DEFAULT;
  drainingAudioProcessorIndex = C.INDEX_UNSET;
  activeAudioProcessors = new AudioProcessor[0];
  outputBuffers = new ByteBuffer[0];
  playbackParametersCheckpoints = new ArrayDeque<>();
}
 
Example 11
Source File: DefaultAudioSink.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void initialize() throws InitializationException {
  // If we're asynchronously releasing a previous audio track then we block until it has been
  // released. This guarantees that we cannot end up in a state where we have multiple audio
  // track instances. Without this guarantee it would be possible, in extreme cases, to exhaust
  // the shared memory that's available for audio track buffers. This would in turn cause the
  // initialization of the audio track to fail.
  releasingConditionVariable.block();

  audioTrack = initializeAudioTrack();
  int audioSessionId = audioTrack.getAudioSessionId();
  if (enablePreV21AudioSessionWorkaround) {
    if (Util.SDK_INT < 21) {
      // The workaround creates an audio track with a two byte buffer on the same session, and
      // does not release it until this object is released, which keeps the session active.
      if (keepSessionIdAudioTrack != null
          && audioSessionId != keepSessionIdAudioTrack.getAudioSessionId()) {
        releaseKeepSessionIdAudioTrack();
      }
      if (keepSessionIdAudioTrack == null) {
        keepSessionIdAudioTrack = initializeKeepSessionIdAudioTrack(audioSessionId);
      }
    }
  }
  if (this.audioSessionId != audioSessionId) {
    this.audioSessionId = audioSessionId;
    if (listener != null) {
      listener.onAudioSessionId(audioSessionId);
    }
  }

  playbackParameters =
      canApplyPlaybackParameters
          ? audioProcessorChain.applyPlaybackParameters(playbackParameters)
          : PlaybackParameters.DEFAULT;
  setupAudioProcessors();

  audioTrackPositionTracker.setAudioTrack(
      audioTrack, outputEncoding, outputPcmFrameSize, bufferSize);
  setVolumeInternal();
}
 
Example 12
Source File: DefaultAudioSink.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new default audio sink, optionally using float output for high resolution PCM and
 * with the specified {@code audioProcessorChain}.
 *
 * @param audioCapabilities The audio capabilities for playback on this device. May be null if the
 *     default capabilities (no encoded audio passthrough support) should be assumed.
 * @param audioProcessorChain An {@link AudioProcessorChain} which is used to apply playback
 *     parameters adjustments. The instance passed in must not be reused in other sinks.
 * @param enableConvertHighResIntPcmToFloat Whether to enable conversion of high resolution
 *     integer PCM to 32-bit float for output, if possible. Functionality that uses 16-bit integer
 *     audio processing (for example, speed and pitch adjustment) will not be available when float
 *     output is in use.
 */
public DefaultAudioSink(
    @Nullable AudioCapabilities audioCapabilities,
    AudioProcessorChain audioProcessorChain,
    boolean enableConvertHighResIntPcmToFloat) {
  this.audioCapabilities = audioCapabilities;
  this.audioProcessorChain = Assertions.checkNotNull(audioProcessorChain);
  this.enableConvertHighResIntPcmToFloat = enableConvertHighResIntPcmToFloat;
  releasingConditionVariable = new ConditionVariable(true);
  audioTrackPositionTracker = new AudioTrackPositionTracker(new PositionTrackerListener());
  channelMappingAudioProcessor = new ChannelMappingAudioProcessor();
  trimmingAudioProcessor = new TrimmingAudioProcessor();
  ArrayList<AudioProcessor> toIntPcmAudioProcessors = new ArrayList<>();
  Collections.addAll(
      toIntPcmAudioProcessors,
      new ResamplingAudioProcessor(),
      channelMappingAudioProcessor,
      trimmingAudioProcessor);
  Collections.addAll(toIntPcmAudioProcessors, audioProcessorChain.getAudioProcessors());
  toIntPcmAvailableAudioProcessors =
      toIntPcmAudioProcessors.toArray(new AudioProcessor[toIntPcmAudioProcessors.size()]);
  toFloatPcmAvailableAudioProcessors = new AudioProcessor[] {new FloatResamplingAudioProcessor()};
  volume = 1.0f;
  startMediaTimeState = START_NOT_SET;
  audioAttributes = AudioAttributes.DEFAULT;
  audioSessionId = C.AUDIO_SESSION_ID_UNSET;
  playbackParameters = PlaybackParameters.DEFAULT;
  drainingAudioProcessorIndex = C.INDEX_UNSET;
  activeAudioProcessors = new AudioProcessor[0];
  outputBuffers = new ByteBuffer[0];
  playbackParametersCheckpoints = new ArrayDeque<>();
}
 
Example 13
Source File: DefaultAudioSink.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private void applyPlaybackParameters(
    PlaybackParameters playbackParameters, long presentationTimeUs) {
  PlaybackParameters newPlaybackParameters =
      configuration.canApplyPlaybackParameters
          ? audioProcessorChain.applyPlaybackParameters(playbackParameters)
          : PlaybackParameters.DEFAULT;
  // Store the position and corresponding media time from which the parameters will apply.
  playbackParametersCheckpoints.add(
      new PlaybackParametersCheckpoint(
          newPlaybackParameters,
          /* mediaTimeUs= */ Math.max(0, presentationTimeUs),
          /* positionUs= */ configuration.framesToDurationUs(getWrittenFrames())));
  setupAudioProcessors();
}
 
Example 14
Source File: DefaultAudioSink.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new default audio sink, optionally using float output for high resolution PCM and
 * with the specified {@code audioProcessorChain}.
 *
 * @param audioCapabilities The audio capabilities for playback on this device. May be null if the
 *     default capabilities (no encoded audio passthrough support) should be assumed.
 * @param audioProcessorChain An {@link AudioProcessorChain} which is used to apply playback
 *     parameters adjustments. The instance passed in must not be reused in other sinks.
 * @param enableConvertHighResIntPcmToFloat Whether to enable conversion of high resolution
 *     integer PCM to 32-bit float for output, if possible. Functionality that uses 16-bit integer
 *     audio processing (for example, speed and pitch adjustment) will not be available when float
 *     output is in use.
 */
public DefaultAudioSink(
    @Nullable AudioCapabilities audioCapabilities,
    AudioProcessorChain audioProcessorChain,
    boolean enableConvertHighResIntPcmToFloat) {
  this.audioCapabilities = audioCapabilities;
  this.audioProcessorChain = Assertions.checkNotNull(audioProcessorChain);
  this.enableConvertHighResIntPcmToFloat = enableConvertHighResIntPcmToFloat;
  releasingConditionVariable = new ConditionVariable(true);
  audioTrackPositionTracker = new AudioTrackPositionTracker(new PositionTrackerListener());
  channelMappingAudioProcessor = new ChannelMappingAudioProcessor();
  trimmingAudioProcessor = new TrimmingAudioProcessor();
  ArrayList<AudioProcessor> toIntPcmAudioProcessors = new ArrayList<>();
  Collections.addAll(
      toIntPcmAudioProcessors,
      new ResamplingAudioProcessor(),
      channelMappingAudioProcessor,
      trimmingAudioProcessor);
  Collections.addAll(toIntPcmAudioProcessors, audioProcessorChain.getAudioProcessors());
  toIntPcmAvailableAudioProcessors = toIntPcmAudioProcessors.toArray(new AudioProcessor[0]);
  toFloatPcmAvailableAudioProcessors = new AudioProcessor[] {new FloatResamplingAudioProcessor()};
  volume = 1.0f;
  startMediaTimeState = START_NOT_SET;
  audioAttributes = AudioAttributes.DEFAULT;
  audioSessionId = C.AUDIO_SESSION_ID_UNSET;
  auxEffectInfo = new AuxEffectInfo(AuxEffectInfo.NO_AUX_EFFECT_ID, 0f);
  playbackParameters = PlaybackParameters.DEFAULT;
  drainingAudioProcessorIndex = C.INDEX_UNSET;
  activeAudioProcessors = new AudioProcessor[0];
  outputBuffers = new ByteBuffer[0];
  playbackParametersCheckpoints = new ArrayDeque<>();
}
 
Example 15
Source File: PlaybackSpeedController.java    From SkyTube with GNU General Public License v3.0 4 votes vote down vote up
public PlaybackParameters getPlaybackParameters() {
    if (player == null) return PlaybackParameters.DEFAULT;
    final PlaybackParameters parameters = player.getPlaybackParameters();
    return parameters == null ? PlaybackParameters.DEFAULT : parameters;
}
 
Example 16
Source File: StandaloneMediaClock.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new standalone media clock using the given {@link Clock} implementation.
 *
 * @param clock A {@link Clock}.
 */
public StandaloneMediaClock(Clock clock) {
  this.clock = clock;
  this.playbackParameters = PlaybackParameters.DEFAULT;
}
 
Example 17
Source File: StandaloneMediaClock.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new standalone media clock using the given {@link Clock} implementation.
 *
 * @param clock A {@link Clock}.
 */
public StandaloneMediaClock(Clock clock) {
  this.clock = clock;
  this.playbackParameters = PlaybackParameters.DEFAULT;
}
 
Example 18
Source File: StandaloneMediaClock.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new standalone media clock using the given {@link Clock} implementation.
 *
 * @param clock A {@link Clock}.
 */
public StandaloneMediaClock(Clock clock) {
  this.clock = clock;
  this.playbackParameters = PlaybackParameters.DEFAULT;
}
 
Example 19
Source File: StandaloneMediaClock.java    From TelePlus-Android with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new standalone media clock using the given {@link Clock} implementation.
 *
 * @param clock A {@link Clock}.
 */
public StandaloneMediaClock(Clock clock) {
  this.clock = clock;
  this.playbackParameters = PlaybackParameters.DEFAULT;
}
 
Example 20
Source File: StandaloneMediaClock.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new standalone media clock using the given {@link Clock} implementation.
 *
 * @param clock A {@link Clock}.
 */
public StandaloneMediaClock(Clock clock) {
  this.clock = clock;
  this.playbackParameters = PlaybackParameters.DEFAULT;
}