Java 类com.google.android.exoplayer2.audio.AudioTrack 实例源码

项目:videoPickPlayer    文件:SimpleExoPlayer.java   
@Override
public void onAudioDisabled(DecoderCounters counters) {
  if (audioDebugListener != null) {
    audioDebugListener.onAudioDisabled(counters);
  }
  audioFormat = null;
  audioDecoderCounters = null;
  audioSessionId = AudioTrack.SESSION_ID_NOT_SET;
}
项目:videoPickPlayer    文件:SimpleExoPlayer.java   
SimpleExoPlayer(Context context, TrackSelector<?> trackSelector,
    LoadControl loadControl, DrmSessionManager<FrameworkMediaCrypto> drmSessionManager,
    boolean preferExtensionDecoders, long allowedVideoJoiningTimeMs) {
  mainHandler = new Handler();
  componentListener = new ComponentListener();
  trackSelector.addListener(componentListener);

  // Build the renderers.
  ArrayList<Renderer> renderersList = new ArrayList<>();
  if (preferExtensionDecoders) {
    buildExtensionRenderers(renderersList, allowedVideoJoiningTimeMs);
    buildRenderers(context, drmSessionManager, renderersList, allowedVideoJoiningTimeMs);
  } else {
    buildRenderers(context, drmSessionManager, renderersList, allowedVideoJoiningTimeMs);
    buildExtensionRenderers(renderersList, allowedVideoJoiningTimeMs);
  }
  renderers = renderersList.toArray(new Renderer[renderersList.size()]);

  // Obtain counts of video and audio renderers.
  int videoRendererCount = 0;
  int audioRendererCount = 0;
  for (Renderer renderer : renderers) {
    switch (renderer.getTrackType()) {
      case C.TRACK_TYPE_VIDEO:
        videoRendererCount++;
        break;
      case C.TRACK_TYPE_AUDIO:
        audioRendererCount++;
        break;
    }
  }
  this.videoRendererCount = videoRendererCount;
  this.audioRendererCount = audioRendererCount;

  // Set initial values.
  audioSessionId = AudioTrack.SESSION_ID_NOT_SET;
  volume = 1;

  // Build the player and associated objects.
  player = new ExoPlayerImpl(renderers, trackSelector, loadControl);
}
项目:PainlessMusicPlayer    文件:App.java   
private void initAudioTrack() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        AudioTrack.enablePreV21AudioSessionWorkaround = true;
    }
}