com.google.android.exoplayer2.decoder.DecoderCounters Java Examples

The following examples show how to use com.google.android.exoplayer2.decoder.DecoderCounters. 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: AnalyticsListenerForwarder.java    From no-player with Apache License 2.0 5 votes vote down vote up
@Override
public void onDecoderDisabled(EventTime eventTime, int trackType, DecoderCounters decoderCounters) {
    HashMap<String, String> callingMethodParameters = new HashMap<>();

    callingMethodParameters.put(Parameters.EVENT_TIME, eventTime.toString());
    callingMethodParameters.put(Parameters.TRACK_TYPE, String.valueOf(trackType));
    callingMethodParameters.put(Parameters.DECODER_COUNTERS, decoderCounters.toString());

    infoListeners.onNewInfo(Methods.ON_DECODER_DISABLED, callingMethodParameters);
}
 
Example #2
Source File: SimpleExoPlayer.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public void onAudioEnabled(DecoderCounters counters) {
  audioDecoderCounters = counters;
  for (AudioRendererEventListener audioDebugListener : audioDebugListeners) {
    audioDebugListener.onAudioEnabled(counters);
  }
}
 
Example #3
Source File: AnalyticsCollector.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public final void onVideoEnabled(DecoderCounters counters) {
  // The renderers are only enabled after we changed the playing media period.
  EventTime eventTime = generatePlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onDecoderEnabled(eventTime, C.TRACK_TYPE_VIDEO, counters);
  }
}
 
Example #4
Source File: AnalyticsCollector.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public final void onAudioDisabled(DecoderCounters counters) {
  // The renderers are disabled after we changed the playing media period on the playback thread
  // but before this change is reported to the app thread.
  EventTime eventTime = generateLastReportedPlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onDecoderDisabled(eventTime, C.TRACK_TYPE_AUDIO, counters);
  }
}
 
Example #5
Source File: AnalyticsCollector.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public final void onVideoDisabled(DecoderCounters counters) {
  // The renderers are disabled after we changed the playing media period on the playback thread
  // but before this change is reported to the app thread.
  EventTime eventTime = generateLastReportedPlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onDecoderDisabled(eventTime, C.TRACK_TYPE_VIDEO, counters);
  }
}
 
Example #6
Source File: DecoderCountersUtil.java    From ExoPlayer-Offline with Apache License 2.0 5 votes vote down vote up
public static void assertConsecutiveDroppedOutputBufferLimit(String name,
    DecoderCounters counters, int limit) {
  counters.ensureUpdated();
  int actual = counters.maxConsecutiveDroppedOutputBufferCount;
  TestCase.assertTrue("Codec(" + name + ") was late decoding: " + actual
      + " buffers consecutively. " + "Limit: " + limit + ".", actual <= limit);
}
 
Example #7
Source File: AnalyticsListenerForwarder.java    From no-player with Apache License 2.0 5 votes vote down vote up
@Override
public void onDecoderEnabled(EventTime eventTime, int trackType, DecoderCounters decoderCounters) {
    HashMap<String, String> callingMethodParameters = new HashMap<>();

    callingMethodParameters.put(Parameters.EVENT_TIME, eventTime.toString());
    callingMethodParameters.put(Parameters.TRACK_TYPE, String.valueOf(trackType));
    callingMethodParameters.put(Parameters.DECODER_COUNTERS, decoderCounters.toString());

    infoListeners.onNewInfo(Methods.ON_DECODER_ENABLED, callingMethodParameters);
}
 
Example #8
Source File: AudioRendererEventListener.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invokes {@link AudioRendererEventListener#onAudioEnabled(DecoderCounters)}.
 */
public void enabled(final DecoderCounters decoderCounters) {
  if (listener != null) {
    handler.post(new Runnable() {
      @Override
      public void run() {
        listener.onAudioEnabled(decoderCounters);
      }
    });
  }
}
 
Example #9
Source File: SimpleExoPlayer.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onVideoEnabled(DecoderCounters counters) {
  videoDecoderCounters = counters;
  for (VideoRendererEventListener videoDebugListener : videoDebugListeners) {
    videoDebugListener.onVideoEnabled(counters);
  }
}
 
Example #10
Source File: SimpleExoPlayer.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@Override
public void onAudioDisabled(DecoderCounters counters) {
  for (AudioRendererEventListener audioDebugListener : audioDebugListeners) {
    audioDebugListener.onAudioDisabled(counters);
  }
  audioFormat = null;
  audioDecoderCounters = null;
  audioSessionId = C.AUDIO_SESSION_ID_UNSET;
}
 
Example #11
Source File: VideoRendererEventListener.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invokes {@link VideoRendererEventListener#onVideoEnabled(DecoderCounters)}.
 */
public void enabled(final DecoderCounters decoderCounters) {
  if (listener != null) {
    handler.post(new Runnable() {
      @Override
      public void run() {
        listener.onVideoEnabled(decoderCounters);
      }
    });
  }
}
 
Example #12
Source File: VideoRendererEventListener.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/** Invokes {@link VideoRendererEventListener#onVideoDisabled(DecoderCounters)}. */
public void disabled(DecoderCounters counters) {
  counters.ensureUpdated();
  if (listener != null) {
    handler.post(
        () -> {
          counters.ensureUpdated();
          listener.onVideoDisabled(counters);
        });
  }
}
 
Example #13
Source File: AnalyticsCollector.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void onAudioDisabled(DecoderCounters counters) {
  // The renderers are disabled after we changed the playing media period on the playback thread
  // but before this change is reported to the app thread.
  EventTime eventTime = generateLastReportedPlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onDecoderDisabled(eventTime, C.TRACK_TYPE_AUDIO, counters);
  }
}
 
Example #14
Source File: AnalyticsCollector.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void onVideoEnabled(DecoderCounters counters) {
  // The renderers are only enabled after we changed the playing media period.
  EventTime eventTime = generatePlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onDecoderEnabled(eventTime, C.TRACK_TYPE_VIDEO, counters);
  }
}
 
Example #15
Source File: AnalyticsCollector.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void onVideoDisabled(DecoderCounters counters) {
  // The renderers are disabled after we changed the playing media period on the playback thread
  // but before this change is reported to the app thread.
  EventTime eventTime = generateLastReportedPlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onDecoderDisabled(eventTime, C.TRACK_TYPE_VIDEO, counters);
  }
}
 
Example #16
Source File: VideoRendererEventListener.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/** Invokes {@link VideoRendererEventListener#onVideoDisabled(DecoderCounters)}. */
public void disabled(DecoderCounters counters) {
  counters.ensureUpdated();
  if (handler != null) {
    handler.post(
        () -> {
          counters.ensureUpdated();
          castNonNull(listener).onVideoDisabled(counters);
        });
  }
}
 
Example #17
Source File: SimpleExoPlayer.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onAudioEnabled(DecoderCounters counters) {
  audioDecoderCounters = counters;
  for (AudioRendererEventListener audioDebugListener : audioDebugListeners) {
    audioDebugListener.onAudioEnabled(counters);
  }
}
 
Example #18
Source File: AnalyticsCollector.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void onVideoDisabled(DecoderCounters counters) {
  // The renderers are disabled after we changed the playing media period on the playback thread
  // but before this change is reported to the app thread.
  EventTime eventTime = generateLastReportedPlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onDecoderDisabled(eventTime, C.TRACK_TYPE_VIDEO, counters);
  }
}
 
Example #19
Source File: SimpleExoPlayer.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public void onAudioEnabled(DecoderCounters counters) {
  audioDecoderCounters = counters;
  if (audioDebugListener != null) {
    audioDebugListener.onAudioEnabled(counters);
  }
}
 
Example #20
Source File: SimpleExoPlayer.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onVideoEnabled(DecoderCounters counters) {
  videoDecoderCounters = counters;
  for (VideoRendererEventListener videoDebugListener : videoDebugListeners) {
    videoDebugListener.onVideoEnabled(counters);
  }
}
 
Example #21
Source File: SimpleExoPlayer.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onVideoDisabled(DecoderCounters counters) {
  for (VideoRendererEventListener videoDebugListener : videoDebugListeners) {
    videoDebugListener.onVideoDisabled(counters);
  }
  videoFormat = null;
  videoDecoderCounters = null;
}
 
Example #22
Source File: SimpleExoPlayer.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onAudioEnabled(DecoderCounters counters) {
  audioDecoderCounters = counters;
  for (AudioRendererEventListener audioDebugListener : audioDebugListeners) {
    audioDebugListener.onAudioEnabled(counters);
  }
}
 
Example #23
Source File: SimpleExoPlayer.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onAudioDisabled(DecoderCounters counters) {
  for (AudioRendererEventListener audioDebugListener : audioDebugListeners) {
    audioDebugListener.onAudioDisabled(counters);
  }
  audioFormat = null;
  audioDecoderCounters = null;
  audioSessionId = C.AUDIO_SESSION_ID_UNSET;
}
 
Example #24
Source File: SimpleExoPlayer.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public void onVideoDisabled(DecoderCounters counters) {
  if (videoDebugListener != null) {
    videoDebugListener.onVideoDisabled(counters);
  }
  videoFormat = null;
  videoDecoderCounters = null;
}
 
Example #25
Source File: AnalyticsCollector.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void onAudioDisabled(DecoderCounters counters) {
  // The renderers are disabled after we changed the playing media period on the playback thread
  // but before this change is reported to the app thread.
  EventTime eventTime = generateLastReportedPlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onDecoderDisabled(eventTime, C.TRACK_TYPE_AUDIO, counters);
  }
}
 
Example #26
Source File: DecoderCountersUtil.java    From ExoPlayer-Offline with Apache License 2.0 5 votes vote down vote up
public static void assertDroppedOutputBufferLimit(String name, DecoderCounters counters,
    int limit) {
  counters.ensureUpdated();
  int actual = counters.droppedOutputBufferCount;
  TestCase.assertTrue("Codec(" + name + ") was late decoding: " + actual + " buffers. "
      + "Limit: " + limit + ".", actual <= limit);
}
 
Example #27
Source File: AudioRendererEventListener.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invokes {@link AudioRendererEventListener#onAudioEnabled(DecoderCounters)}.
 */
public void enabled(final DecoderCounters decoderCounters) {
  if (listener != null) {
    handler.post(new Runnable() {
      @Override
      public void run() {
        listener.onAudioEnabled(decoderCounters);
      }
    });
  }
}
 
Example #28
Source File: AnalyticsCollector.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public final void onAudioDisabled(DecoderCounters counters) {
  // The renderers are disabled after we changed the playing media period on the playback thread
  // but before this change is reported to the app thread.
  EventTime eventTime = generateLastReportedPlayingMediaPeriodEventTime();
  for (AnalyticsListener listener : listeners) {
    listener.onDecoderDisabled(eventTime, C.TRACK_TYPE_AUDIO, counters);
  }
}
 
Example #29
Source File: VideoRendererEventListener.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invokes {@link VideoRendererEventListener#onVideoEnabled(DecoderCounters)}.
 */
public void enabled(final DecoderCounters decoderCounters) {
  if (listener != null) {
    handler.post(new Runnable() {
      @Override
      public void run() {
        listener.onVideoEnabled(decoderCounters);
      }
    });
  }
}
 
Example #30
Source File: VideoRendererEventListener.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invokes {@link VideoRendererEventListener#onVideoDisabled(DecoderCounters)}.
 */
public void disabled(final DecoderCounters counters) {
  if (listener != null) {
    handler.post(new Runnable() {
      @Override
      public void run() {
        counters.ensureUpdated();
        listener.onVideoDisabled(counters);
      }
    });
  }
}