Java Code Examples for com.google.android.exoplayer2.trackselection.TrackSelection#getSelectedFormat()

The following examples show how to use com.google.android.exoplayer2.trackselection.TrackSelection#getSelectedFormat() . 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: ClippingMediaPeriod.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private static boolean shouldKeepInitialDiscontinuity(
    long startUs, @NullableType TrackSelection[] selections) {
  // If the clipping start position is non-zero, the clipping sample streams will adjust
  // timestamps on buffers they read from the unclipped sample streams. These adjusted buffer
  // timestamps can be negative, because sample streams provide buffers starting at a key-frame,
  // which may be before the clipping start point. When the renderer reads a buffer with a
  // negative timestamp, its offset timestamp can jump backwards compared to the last timestamp
  // read in the previous period. Renderer implementations may not allow this, so we signal a
  // discontinuity which resets the renderers before they read the clipping sample stream.
  // However, for audio-only track selections we assume to have random access seek behaviour and
  // do not need an initial discontinuity to reset the renderer.
  if (startUs != 0) {
    for (TrackSelection trackSelection : selections) {
      if (trackSelection != null) {
        Format selectedFormat = trackSelection.getSelectedFormat();
        if (!MimeTypes.isAudio(selectedFormat.sampleMimeType)) {
          return true;
        }
      }
    }
  }
  return false;
}
 
Example 2
Source File: ClippingMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static boolean shouldKeepInitialDiscontinuity(long startUs, TrackSelection[] selections) {
  // If the clipping start position is non-zero, the clipping sample streams will adjust
  // timestamps on buffers they read from the unclipped sample streams. These adjusted buffer
  // timestamps can be negative, because sample streams provide buffers starting at a key-frame,
  // which may be before the clipping start point. When the renderer reads a buffer with a
  // negative timestamp, its offset timestamp can jump backwards compared to the last timestamp
  // read in the previous period. Renderer implementations may not allow this, so we signal a
  // discontinuity which resets the renderers before they read the clipping sample stream.
  // However, for audio-only track selections we assume to have random access seek behaviour and
  // do not need an initial discontinuity to reset the renderer.
  if (startUs != 0) {
    for (TrackSelection trackSelection : selections) {
      if (trackSelection != null) {
        Format selectedFormat = trackSelection.getSelectedFormat();
        if (!MimeTypes.isAudio(selectedFormat.sampleMimeType)) {
          return true;
        }
      }
    }
  }
  return false;
}
 
Example 3
Source File: ClippingMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static boolean shouldKeepInitialDiscontinuity(long startUs, TrackSelection[] selections) {
  // If the clipping start position is non-zero, the clipping sample streams will adjust
  // timestamps on buffers they read from the unclipped sample streams. These adjusted buffer
  // timestamps can be negative, because sample streams provide buffers starting at a key-frame,
  // which may be before the clipping start point. When the renderer reads a buffer with a
  // negative timestamp, its offset timestamp can jump backwards compared to the last timestamp
  // read in the previous period. Renderer implementations may not allow this, so we signal a
  // discontinuity which resets the renderers before they read the clipping sample stream.
  // However, for audio-only track selections we assume to have random access seek behaviour and
  // do not need an initial discontinuity to reset the renderer.
  if (startUs != 0) {
    for (TrackSelection trackSelection : selections) {
      if (trackSelection != null) {
        Format selectedFormat = trackSelection.getSelectedFormat();
        if (!MimeTypes.isAudio(selectedFormat.sampleMimeType)) {
          return true;
        }
      }
    }
  }
  return false;
}
 
Example 4
Source File: ClippingMediaPeriod.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private static boolean shouldKeepInitialDiscontinuity(long startUs, TrackSelection[] selections) {
  // If the clipping start position is non-zero, the clipping sample streams will adjust
  // timestamps on buffers they read from the unclipped sample streams. These adjusted buffer
  // timestamps can be negative, because sample streams provide buffers starting at a key-frame,
  // which may be before the clipping start point. When the renderer reads a buffer with a
  // negative timestamp, its offset timestamp can jump backwards compared to the last timestamp
  // read in the previous period. Renderer implementations may not allow this, so we signal a
  // discontinuity which resets the renderers before they read the clipping sample stream.
  // However, for audio-only track selections we assume to have random access seek behaviour and
  // do not need an initial discontinuity to reset the renderer.
  if (startUs != 0) {
    for (TrackSelection trackSelection : selections) {
      if (trackSelection != null) {
        Format selectedFormat = trackSelection.getSelectedFormat();
        if (!MimeTypes.isAudio(selectedFormat.sampleMimeType)) {
          return true;
        }
      }
    }
  }
  return false;
}
 
Example 5
Source File: ClippingMediaPeriod.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private static boolean shouldKeepInitialDiscontinuity(long startUs, TrackSelection[] selections) {
  // If the clipping start position is non-zero, the clipping sample streams will adjust
  // timestamps on buffers they read from the unclipped sample streams. These adjusted buffer
  // timestamps can be negative, because sample streams provide buffers starting at a key-frame,
  // which may be before the clipping start point. When the renderer reads a buffer with a
  // negative timestamp, its offset timestamp can jump backwards compared to the last timestamp
  // read in the previous period. Renderer implementations may not allow this, so we signal a
  // discontinuity which resets the renderers before they read the clipping sample stream.
  // However, for audio-only track selections we assume to have random access seek behaviour and
  // do not need an initial discontinuity to reset the renderer.
  if (startUs != 0) {
    for (TrackSelection trackSelection : selections) {
      if (trackSelection != null) {
        Format selectedFormat = trackSelection.getSelectedFormat();
        if (!MimeTypes.isAudio(selectedFormat.sampleMimeType)) {
          return true;
        }
      }
    }
  }
  return false;
}