当前位置: 首页>>代码示例>>Java>>正文


Java AudioTrack.SESSION_ID_NOT_SET属性代码示例

本文整理汇总了Java中com.google.android.exoplayer.audio.AudioTrack.SESSION_ID_NOT_SET属性的典型用法代码示例。如果您正苦于以下问题:Java AudioTrack.SESSION_ID_NOT_SET属性的具体用法?Java AudioTrack.SESSION_ID_NOT_SET怎么用?Java AudioTrack.SESSION_ID_NOT_SET使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.google.android.exoplayer.audio.AudioTrack的用法示例。


在下文中一共展示了AudioTrack.SESSION_ID_NOT_SET属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDisabled

@Override
protected void onDisabled() throws ExoPlaybackException {
  inputBuffer = null;
  outputBuffer = null;
  format = null;
  audioSessionId = AudioTrack.SESSION_ID_NOT_SET;
  try {
    if (decoder != null) {
      decoder.release();
      decoder = null;
      codecCounters.codecReleaseCount++;
    }
    audioTrack.release();
  } finally {
    super.onDisabled();
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:17,代码来源:LibopusAudioTrackRenderer.java

示例2: initialize

public void initialize() throws AudioTrack.InitializationException {
    if (!mIsEnabled) {
        return;
    }
    if (mAudioSessionID != AudioTrack.SESSION_ID_NOT_SET) {
        mAudioTrack.initialize(mAudioSessionID);
    } else {
        mAudioSessionID = mAudioTrack.initialize();
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:10,代码来源:AudioTrackWrapper.java

示例3: onDisabled

@Override
protected void onDisabled() {
  audioSessionId = AudioTrack.SESSION_ID_NOT_SET;
  try {
    audioTrack.release();
  } finally {
    super.onDisabled();
  }
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:9,代码来源:MediaCodecAudioTrackRenderer.java

示例4: LibopusAudioTrackRenderer

/**
 * @param source The upstream source from which the renderer obtains samples.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public LibopusAudioTrackRenderer(SampleSource source, Handler eventHandler,
    EventListener eventListener) {
  super(source);
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  this.audioSessionId = AudioTrack.SESSION_ID_NOT_SET;
  audioTrack = new AudioTrack();
  formatHolder = new MediaFormatHolder();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:15,代码来源:LibopusAudioTrackRenderer.java

示例5: LibflacAudioTrackRenderer

/**
 * @param source The upstream source from which the renderer obtains samples.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public LibflacAudioTrackRenderer(SampleSource source, Handler eventHandler,
    EventListener eventListener) {
  super(source);
  this.eventHandler = eventHandler;
  this.eventListener = eventListener;
  this.audioSessionId = AudioTrack.SESSION_ID_NOT_SET;
  this.audioTrack = new AudioTrack();
  formatHolder = new MediaFormatHolder();
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:15,代码来源:LibflacAudioTrackRenderer.java

示例6: onDisabled

@Override
protected void onDisabled() throws ExoPlaybackException {
  audioSessionId = AudioTrack.SESSION_ID_NOT_SET;
  try {
    audioTrack.release();
  } finally {
    super.onDisabled();
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:9,代码来源:MediaCodecAudioTrackRenderer.java

示例7: resetSessionId

public void resetSessionId() {
    mAudioSessionID = AudioTrack.SESSION_ID_NOT_SET;
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:3,代码来源:AudioTrackWrapper.java

示例8: release

public void release()  {
    if (mAudioSessionID != AudioTrack.SESSION_ID_NOT_SET) {
        mAudioTrack.release();
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:5,代码来源:AudioTrackWrapper.java

示例9: renderBuffer

private void renderBuffer() throws OpusDecoderException, AudioTrack.InitializationException,
    AudioTrack.WriteException {
  if (outputStreamEnded) {
    return;
  }

  if (outputBuffer == null) {
    outputBuffer = decoder.dequeueOutputBuffer();
    if (outputBuffer == null) {
      return;
    }
  }

  if (outputBuffer.getFlag(Buffer.FLAG_END_OF_STREAM)) {
    outputStreamEnded = true;
    audioTrack.handleEndOfStream();
    outputBuffer.release();
    outputBuffer = null;
    return;
  }

  if (!audioTrack.isInitialized()) {
    if (audioSessionId != AudioTrack.SESSION_ID_NOT_SET) {
      audioTrack.initialize(audioSessionId);
    } else {
      audioSessionId = audioTrack.initialize();
    }
    if (getState() == TrackRenderer.STATE_STARTED) {
      audioTrack.play();
    }
  }

  int handleBufferResult;
  handleBufferResult = audioTrack.handleBuffer(outputBuffer.data, outputBuffer.data.position(),
      outputBuffer.data.remaining(), outputBuffer.timestampUs);

  // If we are out of sync, allow currentPositionUs to jump backwards.
  if ((handleBufferResult & AudioTrack.RESULT_POSITION_DISCONTINUITY) != 0) {
    allowPositionDiscontinuity = true;
  }

  // Release the buffer if it was consumed.
  if ((handleBufferResult & AudioTrack.RESULT_BUFFER_CONSUMED) != 0) {
    codecCounters.renderedOutputBufferCount++;
    outputBuffer.release();
    outputBuffer = null;
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:48,代码来源:LibopusAudioTrackRenderer.java

示例10: renderBuffer

private void renderBuffer() throws FlacDecoderException, AudioTrack.InitializationException,
    AudioTrack.WriteException {
  if (outputStreamEnded) {
    return;
  }

  if (outputBuffer == null) {
    outputBuffer = decoder.dequeueOutputBuffer();
    if (outputBuffer == null) {
      return;
    }
  }

  if (outputBuffer.getFlag(Buffer.FLAG_END_OF_STREAM)) {
    outputStreamEnded = true;
    audioTrack.handleEndOfStream();
    outputBuffer.release();
    outputBuffer = null;
    return;
  }

  if (!audioTrack.isInitialized()) {
    if (audioSessionId != AudioTrack.SESSION_ID_NOT_SET) {
      audioTrack.initialize(audioSessionId);
    } else {
      audioSessionId = audioTrack.initialize();
    }
    if (getState() == TrackRenderer.STATE_STARTED) {
      audioTrack.play();
    }
  }

  int handleBufferResult;
  handleBufferResult = audioTrack.handleBuffer(outputBuffer.data, outputBuffer.data.position(),
      outputBuffer.data.remaining(), outputBuffer.timestampUs);

  // If we are out of sync, allow currentPositionUs to jump backwards.
  if ((handleBufferResult & AudioTrack.RESULT_POSITION_DISCONTINUITY) != 0) {
    allowPositionDiscontinuity = true;
  }

  // Release the buffer if it was consumed.
  if ((handleBufferResult & AudioTrack.RESULT_BUFFER_CONSUMED) != 0) {
    codecCounters.renderedOutputBufferCount++;
    outputBuffer.release();
    outputBuffer = null;
  }
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:48,代码来源:LibflacAudioTrackRenderer.java

示例11: MediaCodecAudioTrackRenderer

/**
 * @param source The upstream source from which the renderer obtains samples.
 * @param drmSessionManager For use with encrypted content. May be null if support for encrypted
 *          content is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *          For example a media file may start with a short clear region so as to allow playback
 *          to
 *          begin in parallel with key acquisision. This parameter specifies whether the renderer
 *          is
 *          permitted to play clear regions of encrypted media files before
 *          {@code drmSessionManager}
 *          has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *          null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 */
public MediaCodecAudioTrackRenderer(SampleSource source, DrmSessionManager drmSessionManager,
    boolean playClearSamplesWithoutKeys, Handler eventHandler, EventListener eventListener) {
  super(source, drmSessionManager, playClearSamplesWithoutKeys, eventHandler, eventListener);
  this.eventListener = eventListener;
  this.audioSessionId = AudioTrack.SESSION_ID_NOT_SET;
  this.audioTrack = new AudioTrack();
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:23,代码来源:MediaCodecAudioTrackRenderer.java

示例12: MediaCodecAudioTrackRenderer

/**
 * @param sources The upstream sources from which the renderer obtains samples.
 * @param mediaCodecSelector A decoder selector.
 * @param drmSessionManager For use with encrypted content. May be null if support for encrypted
 *     content is not required.
 * @param playClearSamplesWithoutKeys Encrypted media may contain clear (un-encrypted) regions.
 *     For example a media file may start with a short clear region so as to allow playback to
 *     begin in parallel with key acquisition. This parameter specifies whether the renderer is
 *     permitted to play clear regions of encrypted media files before {@code drmSessionManager}
 *     has obtained the keys necessary to decrypt encrypted regions of the media.
 * @param eventHandler A handler to use when delivering events to {@code eventListener}. May be
 *     null if delivery of events is not required.
 * @param eventListener A listener of events. May be null if delivery of events is not required.
 * @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 streamType The type of audio stream for the {@link AudioTrack}.
 */
public MediaCodecAudioTrackRenderer(SampleSource[] sources, MediaCodecSelector mediaCodecSelector,
    DrmSessionManager drmSessionManager, boolean playClearSamplesWithoutKeys,
    Handler eventHandler, EventListener eventListener, AudioCapabilities audioCapabilities,
    int streamType) {
  super(sources, mediaCodecSelector, drmSessionManager, playClearSamplesWithoutKeys, eventHandler,
      eventListener);
  this.eventListener = eventListener;
  this.audioSessionId = AudioTrack.SESSION_ID_NOT_SET;
  this.audioTrack = new AudioTrack(audioCapabilities, streamType);
}
 
开发者ID:asifkhan11,项目名称:ExoPlayer-Demo,代码行数:27,代码来源:MediaCodecAudioTrackRenderer.java


注:本文中的com.google.android.exoplayer.audio.AudioTrack.SESSION_ID_NOT_SET属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。