Java Code Examples for com.google.android.exoplayer2.source.SampleQueue#rewind()

The following examples show how to use com.google.android.exoplayer2.source.SampleQueue#rewind() . 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: HlsSampleStreamWrapper.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Attempts to seek to the specified position within the sample queues.
 *
 * @param positionUs The seek position in microseconds.
 * @return Whether the in-buffer seek was successful.
 */
private boolean seekInsideBufferUs(long positionUs) {
  int sampleQueueCount = sampleQueues.length;
  for (int i = 0; i < sampleQueueCount; i++) {
    SampleQueue sampleQueue = sampleQueues[i];
    sampleQueue.rewind();
    boolean seekInsideQueue = sampleQueue.advanceTo(positionUs, true, false)
        != SampleQueue.ADVANCE_FAILED;
    // If we have AV tracks then an in-queue seek is successful if the seek into every AV queue
    // is successful. We ignore whether seeks within non-AV queues are successful in this case, as
    // they may be sparse or poorly interleaved. If we only have non-AV tracks then a seek is
    // successful only if the seek into every queue succeeds.
    if (!seekInsideQueue && (sampleQueueIsAudioVideoFlags[i] || !haveAudioVideoSampleQueues)) {
      return false;
    }
  }
  return true;
}
 
Example 2
Source File: HlsSampleStreamWrapper.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Attempts to seek to the specified position within the sample queues.
 *
 * @param positionUs The seek position in microseconds.
 * @return Whether the in-buffer seek was successful.
 */
private boolean seekInsideBufferUs(long positionUs) {
  int sampleQueueCount = sampleQueues.length;
  for (int i = 0; i < sampleQueueCount; i++) {
    SampleQueue sampleQueue = sampleQueues[i];
    sampleQueue.rewind();
    boolean seekInsideQueue = sampleQueue.advanceTo(positionUs, true, false)
        != SampleQueue.ADVANCE_FAILED;
    // If we have AV tracks then an in-queue seek is successful if the seek into every AV queue
    // is successful. We ignore whether seeks within non-AV queues are successful in this case, as
    // they may be sparse or poorly interleaved. If we only have non-AV tracks then a seek is
    // successful only if the seek into every queue succeeds.
    if (!seekInsideQueue && (sampleQueueIsAudioVideoFlags[i] || !haveAudioVideoSampleQueues)) {
      return false;
    }
  }
  return true;
}
 
Example 3
Source File: HlsSampleStreamWrapper.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Attempts to seek to the specified position within the sample queues.
 *
 * @param positionUs The seek position in microseconds.
 * @return Whether the in-buffer seek was successful.
 */
private boolean seekInsideBufferUs(long positionUs) {
  int sampleQueueCount = sampleQueues.length;
  for (int i = 0; i < sampleQueueCount; i++) {
    SampleQueue sampleQueue = sampleQueues[i];
    sampleQueue.rewind();
    boolean seekInsideQueue = sampleQueue.advanceTo(positionUs, true, false)
        != SampleQueue.ADVANCE_FAILED;
    // If we have AV tracks then an in-queue seek is successful if the seek into every AV queue
    // is successful. We ignore whether seeks within non-AV queues are successful in this case, as
    // they may be sparse or poorly interleaved. If we only have non-AV tracks then a seek is
    // successful only if the seek into every queue succeeds.
    if (!seekInsideQueue && (sampleQueueIsAudioVideoFlags[i] || !haveAudioVideoSampleQueues)) {
      return false;
    }
  }
  return true;
}
 
Example 4
Source File: HlsSampleStreamWrapper.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Attempts to seek to the specified position within the sample queues.
 *
 * @param positionUs The seek position in microseconds.
 * @return Whether the in-buffer seek was successful.
 */
private boolean seekInsideBufferUs(long positionUs) {
  int sampleQueueCount = sampleQueues.length;
  for (int i = 0; i < sampleQueueCount; i++) {
    SampleQueue sampleQueue = sampleQueues[i];
    sampleQueue.rewind();
    boolean seekInsideQueue = sampleQueue.advanceTo(positionUs, true, false)
        != SampleQueue.ADVANCE_FAILED;
    // If we have AV tracks then an in-queue seek is successful if the seek into every AV queue
    // is successful. We ignore whether seeks within non-AV queues are successful in this case, as
    // they may be sparse or poorly interleaved. If we only have non-AV tracks then a seek is
    // successful only if the seek into every queue succeeds.
    if (!seekInsideQueue && (sampleQueueIsAudioVideoFlags[i] || !haveAudioVideoSampleQueues)) {
      return false;
    }
  }
  return true;
}
 
Example 5
Source File: HlsSampleStreamWrapper.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Attempts to seek to the specified position within the sample queues.
 *
 * @param positionUs The seek position in microseconds.
 * @return Whether the in-buffer seek was successful.
 */
private boolean seekInsideBufferUs(long positionUs) {
  int sampleQueueCount = sampleQueues.length;
  for (int i = 0; i < sampleQueueCount; i++) {
    SampleQueue sampleQueue = sampleQueues[i];
    sampleQueue.rewind();
    boolean seekInsideQueue = sampleQueue.advanceTo(positionUs, true, false)
        != SampleQueue.ADVANCE_FAILED;
    // If we have AV tracks then an in-queue seek is successful if the seek into every AV queue
    // is successful. We ignore whether seeks within non-AV queues are successful in this case, as
    // they may be sparse or poorly interleaved. If we only have non-AV tracks then a seek is
    // successful only if the seek into every queue succeeds.
    if (!seekInsideQueue && (sampleQueueIsAudioVideoFlags[i] || !haveAudioVideoSampleQueues)) {
      return false;
    }
  }
  return true;
}