Java Code Examples for com.google.android.exoplayer2.C#BUFFER_FLAG_ENCRYPTED

The following examples show how to use com.google.android.exoplayer2.C#BUFFER_FLAG_ENCRYPTED . 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: SampleMetadataQueue.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Returns whether it's possible to read the next sample.
 *
 * @param relativeReadIndex The relative read index of the next sample.
 * @return Whether it's possible to read the next sample.
 */
private boolean mayReadSample(int relativeReadIndex) {
  if (drmSessionManager == DrmSessionManager.DUMMY) {
    // TODO: Remove once renderers are migrated [Internal ref: b/122519809].
    // For protected content it's likely that the DrmSessionManager is still being injected into
    // the renderers. We assume that the renderers will be able to acquire a DrmSession if needed.
    return true;
  }
  return currentDrmSession == null
      || currentDrmSession.getState() == DrmSession.STATE_OPENED_WITH_KEYS
      || ((flags[relativeReadIndex] & C.BUFFER_FLAG_ENCRYPTED) == 0
          && currentDrmSession.playClearSamplesWithoutKeys());
}