public void onRenderers(
      String[][] trackNames,
      MultiTrackChunkSource[] multiTrackSources,
      TrackRenderer[] renderers,
      @Nullable BandwidthMeter bandwidthMeter) {
    builderCallback = null;

    // Normalize the results.
    if (trackNames == null) {
      trackNames = new String[RENDER_COUNT][];
    }

    if (multiTrackSources == null) {
      multiTrackSources = new MultiTrackChunkSource[RENDER_COUNT];
    }

    for (int i = 0; i < RENDER_COUNT; i++) {
      if (renderers[i] == null) {
        // Convert a null renderer to a dummy renderer.
        renderers[i] = new DummyTrackRenderer();
      } else if (trackNames[i] == null) {
        // We have a renderer so we must have at least one track, but the names are unknown.
        // Initialize the correct number of null track names.
        int trackCount = multiTrackSources[i] == null ? 1 : multiTrackSources[i].getTrackCount();
        trackNames[i] = new String[trackCount];
      }
    }

    // Complete preparation.
    this.trackNames = trackNames;
    this.videoRenderer = renderers[RENDER_VIDEO_INDEX];
    this.audioRenderer = renderers[RENDER_AUDIO_INDEX];
    this.multiTrackSources = multiTrackSources;

    pushSurface(false);
    pushTrackSelection(RENDER_VIDEO_INDEX, true);
    pushTrackSelection(RENDER_AUDIO_INDEX, true);
    pushTrackSelection(RENDER_CLOSED_CAPTION_INDEX, true);
    player.prepare(renderers);
    rendererBuildingState = RenderBuildingState.BUILT;
  }
 public void blockingClearSurface() {
   surface = null;
   pushSurface(true);
 }
 public void setSurface(Surface surface) {
   this.surface = surface;
   pushSurface(false);
 }