Java 类com.google.android.exoplayer2.extractor.DefaultExtractorInput 实例源码

项目:Exoplayer2Radio    文件:HlsMediaChunk.java   
private void maybeLoadInitData() throws IOException, InterruptedException {
  if (previousExtractor == extractor || initLoadCompleted || initDataSpec == null) {
    // According to spec, for packed audio, initDataSpec is expected to be null.
    return;
  }
  DataSpec initSegmentDataSpec = Util.getRemainderDataSpec(initDataSpec, initSegmentBytesLoaded);
  try {
    ExtractorInput input = new DefaultExtractorInput(initDataSource,
        initSegmentDataSpec.absoluteStreamPosition, initDataSource.open(initSegmentDataSpec));
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
    } finally {
      initSegmentBytesLoaded = (int) (input.getPosition() - initDataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
  initLoadCompleted = true;
}
项目:Exoplayer2Radio    文件:InitializationChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (bytesLoaded == 0) {
      extractorWrapper.init(null);
    }
    // Load and decode the initialization data.
    try {
      Extractor extractor = extractorWrapper.extractor;
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
      Assertions.checkState(result != Extractor.RESULT_SEEK);
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
}
项目:K-Sonic    文件:HlsMediaChunk.java   
private void maybeLoadInitData() throws IOException, InterruptedException {
  if (previousExtractor == extractor || initLoadCompleted || initDataSpec == null) {
    // According to spec, for packed audio, initDataSpec is expected to be null.
    return;
  }
  DataSpec initSegmentDataSpec = Util.getRemainderDataSpec(initDataSpec, initSegmentBytesLoaded);
  try {
    ExtractorInput input = new DefaultExtractorInput(initDataSource,
        initSegmentDataSpec.absoluteStreamPosition, initDataSource.open(initSegmentDataSpec));
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
    } finally {
      initSegmentBytesLoaded = (int) (input.getPosition() - initDataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
  initLoadCompleted = true;
}
项目:K-Sonic    文件:InitializationChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (bytesLoaded == 0) {
      extractorWrapper.init(null);
    }
    // Load and decode the initialization data.
    try {
      Extractor extractor = extractorWrapper.extractor;
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
      Assertions.checkState(result != Extractor.RESULT_SEEK);
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
}
项目:videoPickPlayer    文件:HlsInitializationChunk.java   
@Override
public void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    dataSource.close();
  }
}
项目:videoPickPlayer    文件:InitializationChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (bytesLoaded == 0) {
      // Set the target to ourselves.
      extractorWrapper.init(this, this);
    }
    // Load and decode the initialization data.
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractorWrapper.read(input);
      }
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    dataSource.close();
  }
}
项目:videoPickPlayer    文件:SingleSampleMediaChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    long length = dataSource.open(loadDataSpec);
    if (length != C.LENGTH_UNSET) {
      length += bytesLoaded;
    }
    ExtractorInput extractorInput = new DefaultExtractorInput(dataSource, bytesLoaded, length);
    DefaultTrackOutput trackOutput = getTrackOutput();
    trackOutput.formatWithOffset(sampleFormat, 0);
    // Load the sample data.
    int result = 0;
    while (result != C.RESULT_END_OF_INPUT) {
      bytesLoaded += result;
      result = trackOutput.sampleData(extractorInput, Integer.MAX_VALUE, true);
    }
    int sampleSize = bytesLoaded;
    trackOutput.sampleMetadata(startTimeUs, C.BUFFER_FLAG_KEY_FRAME, sampleSize, 0, null);
  } finally {
    dataSource.close();
  }
  loadCompleted = true;
}
项目:transistor    文件:HlsMediaChunk.java   
private void maybeLoadInitData() throws IOException, InterruptedException {
  if (initLoadCompleted || initDataSpec == null) {
    // Note: The HLS spec forbids initialization segments for packed audio.
    return;
  }
  DataSpec initSegmentDataSpec = initDataSpec.subrange(initSegmentBytesLoaded);
  try {
    ExtractorInput input = new DefaultExtractorInput(initDataSource,
        initSegmentDataSpec.absoluteStreamPosition, initDataSource.open(initSegmentDataSpec));
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
    } finally {
      initSegmentBytesLoaded = (int) (input.getPosition() - initDataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
  initLoadCompleted = true;
}
项目:transistor    文件:InitializationChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = dataSpec.subrange(bytesLoaded);
  try {
    // Create and open the input.
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (bytesLoaded == 0) {
      extractorWrapper.init(null);
    }
    // Load and decode the initialization data.
    try {
      Extractor extractor = extractorWrapper.extractor;
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
      Assertions.checkState(result != Extractor.RESULT_SEEK);
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
}
项目:Exoplayer2Radio    文件:SingleSampleMediaChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    long length = dataSource.open(loadDataSpec);
    if (length != C.LENGTH_UNSET) {
      length += bytesLoaded;
    }
    ExtractorInput extractorInput = new DefaultExtractorInput(dataSource, bytesLoaded, length);
    BaseMediaChunkOutput output = getOutput();
    output.setSampleOffsetUs(0);
    TrackOutput trackOutput = output.track(0, trackType);
    trackOutput.format(sampleFormat);
    // Load the sample data.
    int result = 0;
    while (result != C.RESULT_END_OF_INPUT) {
      bytesLoaded += result;
      result = trackOutput.sampleData(extractorInput, Integer.MAX_VALUE, true);
    }
    int sampleSize = bytesLoaded;
    trackOutput.sampleMetadata(startTimeUs, C.BUFFER_FLAG_KEY_FRAME, sampleSize, 0, null);
  } finally {
    Util.closeQuietly(dataSource);
  }
  loadCompleted = true;
}
项目:Exoplayer2Radio    文件:ContainerMediaChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public final void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (bytesLoaded == 0) {
      // Configure the output and set it as the target for the extractor wrapper.
      BaseMediaChunkOutput output = getOutput();
      output.setSampleOffsetUs(sampleOffsetUs);
      extractorWrapper.init(output);
    }
    // Load and decode the sample data.
    try {
      Extractor extractor = extractorWrapper.extractor;
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
      Assertions.checkState(result != Extractor.RESULT_SEEK);
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
  loadCompleted = true;
}
项目:K-Sonic    文件:SingleSampleMediaChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    long length = dataSource.open(loadDataSpec);
    if (length != C.LENGTH_UNSET) {
      length += bytesLoaded;
    }
    ExtractorInput extractorInput = new DefaultExtractorInput(dataSource, bytesLoaded, length);
    BaseMediaChunkOutput output = getOutput();
    output.setSampleOffsetUs(0);
    TrackOutput trackOutput = output.track(0, trackType);
    trackOutput.format(sampleFormat);
    // Load the sample data.
    int result = 0;
    while (result != C.RESULT_END_OF_INPUT) {
      bytesLoaded += result;
      result = trackOutput.sampleData(extractorInput, Integer.MAX_VALUE, true);
    }
    int sampleSize = bytesLoaded;
    trackOutput.sampleMetadata(startTimeUs, C.BUFFER_FLAG_KEY_FRAME, sampleSize, 0, null);
  } finally {
    Util.closeQuietly(dataSource);
  }
  loadCompleted = true;
}
项目:K-Sonic    文件:ContainerMediaChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public final void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (bytesLoaded == 0) {
      // Configure the output and set it as the target for the extractor wrapper.
      BaseMediaChunkOutput output = getOutput();
      output.setSampleOffsetUs(sampleOffsetUs);
      extractorWrapper.init(output);
    }
    // Load and decode the sample data.
    try {
      Extractor extractor = extractorWrapper.extractor;
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
      Assertions.checkState(result != Extractor.RESULT_SEEK);
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
  loadCompleted = true;
}
项目:videoPickPlayer    文件:ContainerMediaChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public final void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
  try {
    // Create and open the input.
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (bytesLoaded == 0) {
      // Set the target to ourselves.
      DefaultTrackOutput trackOutput = getTrackOutput();
      trackOutput.formatWithOffset(sampleFormat, sampleOffsetUs);
      extractorWrapper.init(this, trackOutput);
    }
    // Load and decode the sample data.
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractorWrapper.read(input);
      }
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    dataSource.close();
  }
  loadCompleted = true;
}
项目:transistor    文件:SingleSampleMediaChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = dataSpec.subrange(bytesLoaded);
  try {
    // Create and open the input.
    long length = dataSource.open(loadDataSpec);
    if (length != C.LENGTH_UNSET) {
      length += bytesLoaded;
    }
    ExtractorInput extractorInput = new DefaultExtractorInput(dataSource, bytesLoaded, length);
    BaseMediaChunkOutput output = getOutput();
    output.setSampleOffsetUs(0);
    TrackOutput trackOutput = output.track(0, trackType);
    trackOutput.format(sampleFormat);
    // Load the sample data.
    int result = 0;
    while (result != C.RESULT_END_OF_INPUT) {
      bytesLoaded += result;
      result = trackOutput.sampleData(extractorInput, Integer.MAX_VALUE, true);
    }
    int sampleSize = bytesLoaded;
    trackOutput.sampleMetadata(startTimeUs, C.BUFFER_FLAG_KEY_FRAME, sampleSize, 0, null);
  } finally {
    Util.closeQuietly(dataSource);
  }
  loadCompleted = true;
}
项目:transistor    文件:ContainerMediaChunk.java   
@SuppressWarnings("NonAtomicVolatileUpdate")
@Override
public final void load() throws IOException, InterruptedException {
  DataSpec loadDataSpec = dataSpec.subrange(bytesLoaded);
  try {
    // Create and open the input.
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (bytesLoaded == 0) {
      // Configure the output and set it as the target for the extractor wrapper.
      BaseMediaChunkOutput output = getOutput();
      output.setSampleOffsetUs(sampleOffsetUs);
      extractorWrapper.init(output);
    }
    // Load and decode the sample data.
    try {
      Extractor extractor = extractorWrapper.extractor;
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
      Assertions.checkState(result != Extractor.RESULT_SEEK);
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
  loadCompleted = true;
}
项目:Exoplayer2Radio    文件:HlsMediaChunk.java   
private void loadMedia() throws IOException, InterruptedException {
  // If we previously fed part of this chunk to the extractor, we need to skip it this time. For
  // encrypted content we need to skip the data by reading it through the source, so as to ensure
  // correct decryption of the remainder of the chunk. For clear content, we can request the
  // remainder of the chunk directly.
  DataSpec loadDataSpec;
  boolean skipLoadedBytes;
  if (isEncrypted) {
    loadDataSpec = dataSpec;
    skipLoadedBytes = bytesLoaded != 0;
  } else {
    loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
    skipLoadedBytes = false;
  }
  if (!isMasterTimestampSource) {
    timestampAdjuster.waitUntilInitialized();
  } else if (timestampAdjuster.getFirstSampleTimestampUs() == TimestampAdjuster.DO_NOT_OFFSET) {
    // We're the master and we haven't set the desired first sample timestamp yet.
    timestampAdjuster.setFirstSampleTimestampUs(startTimeUs);
  }
  try {
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (extractor == null) {
      // Media segment format is packed audio.
      long id3Timestamp = peekId3PrivTimestamp(input);
      extractor = buildPackedAudioExtractor(id3Timestamp != C.TIME_UNSET
          ? timestampAdjuster.adjustTsTimestamp(id3Timestamp) : startTimeUs);
    }
    if (skipLoadedBytes) {
      input.skipFully(bytesLoaded);
    }
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
  loadCompleted = true;
}
项目:K-Sonic    文件:HlsMediaChunk.java   
private void loadMedia() throws IOException, InterruptedException {
  // If we previously fed part of this chunk to the extractor, we need to skip it this time. For
  // encrypted content we need to skip the data by reading it through the source, so as to ensure
  // correct decryption of the remainder of the chunk. For clear content, we can request the
  // remainder of the chunk directly.
  DataSpec loadDataSpec;
  boolean skipLoadedBytes;
  if (isEncrypted) {
    loadDataSpec = dataSpec;
    skipLoadedBytes = bytesLoaded != 0;
  } else {
    loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
    skipLoadedBytes = false;
  }
  if (!isMasterTimestampSource) {
    timestampAdjuster.waitUntilInitialized();
  } else if (timestampAdjuster.getFirstSampleTimestampUs() == TimestampAdjuster.DO_NOT_OFFSET) {
    // We're the master and we haven't set the desired first sample timestamp yet.
    timestampAdjuster.setFirstSampleTimestampUs(startTimeUs);
  }
  try {
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (extractor == null) {
      // Media segment format is packed audio.
      long id3Timestamp = peekId3PrivTimestamp(input);
      extractor = buildPackedAudioExtractor(id3Timestamp != C.TIME_UNSET
          ? timestampAdjuster.adjustTsTimestamp(id3Timestamp) : startTimeUs);
    }
    if (skipLoadedBytes) {
      input.skipFully(bytesLoaded);
    }
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
  loadCompleted = true;
}
项目:videoPickPlayer    文件:HlsMediaChunk.java   
@Override
public void load() throws IOException, InterruptedException {
  // If we previously fed part of this chunk to the extractor, we need to skip it this time. For
  // encrypted content we need to skip the data by reading it through the source, so as to ensure
  // correct decryption of the remainder of the chunk. For clear content, we can request the
  // remainder of the chunk directly.
  DataSpec loadDataSpec;
  boolean skipLoadedBytes;
  if (isEncrypted) {
    loadDataSpec = dataSpec;
    skipLoadedBytes = bytesLoaded != 0;
  } else {
    loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
    skipLoadedBytes = false;
  }
  try {
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (skipLoadedBytes) {
      input.skipFully(bytesLoaded);
    }
    try {
      int result = Extractor.RESULT_CONTINUE;
      if (!isMasterTimestampSource && timestampAdjuster != null) {
        timestampAdjuster.waitUntilInitialized();
      }
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
      long adjustedEndTimeUs = extractorOutput.getLargestQueuedTimestampUs();
      if (adjustedEndTimeUs != Long.MIN_VALUE) {
        this.adjustedEndTimeUs = adjustedEndTimeUs;
      }
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    dataSource.close();
  }
  loadCompleted = true;
}
项目:transistor    文件:HlsMediaChunk.java   
private void loadMedia() throws IOException, InterruptedException {
  // If we previously fed part of this chunk to the extractor, we need to skip it this time. For
  // encrypted content we need to skip the data by reading it through the source, so as to ensure
  // correct decryption of the remainder of the chunk. For clear content, we can request the
  // remainder of the chunk directly.
  DataSpec loadDataSpec;
  boolean skipLoadedBytes;
  if (isEncrypted) {
    loadDataSpec = dataSpec;
    skipLoadedBytes = bytesLoaded != 0;
  } else {
    loadDataSpec = dataSpec.subrange(bytesLoaded);
    skipLoadedBytes = false;
  }
  if (!isMasterTimestampSource) {
    timestampAdjuster.waitUntilInitialized();
  } else if (timestampAdjuster.getFirstSampleTimestampUs() == TimestampAdjuster.DO_NOT_OFFSET) {
    // We're the master and we haven't set the desired first sample timestamp yet.
    timestampAdjuster.setFirstSampleTimestampUs(startTimeUs);
  }
  try {
    ExtractorInput input = new DefaultExtractorInput(dataSource,
        loadDataSpec.absoluteStreamPosition, dataSource.open(loadDataSpec));
    if (isPackedAudioExtractor && !id3TimestampPeeked) {
      long id3Timestamp = peekId3PrivTimestamp(input);
      id3TimestampPeeked = true;
      output.setSampleOffsetUs(id3Timestamp != C.TIME_UNSET
          ? timestampAdjuster.adjustTsTimestamp(id3Timestamp) : startTimeUs);
    }
    if (skipLoadedBytes) {
      input.skipFully(bytesLoaded);
    }
    try {
      int result = Extractor.RESULT_CONTINUE;
      while (result == Extractor.RESULT_CONTINUE && !loadCanceled) {
        result = extractor.read(input, null);
      }
    } finally {
      bytesLoaded = (int) (input.getPosition() - dataSpec.absoluteStreamPosition);
    }
  } finally {
    Util.closeQuietly(dataSource);
  }
  loadCompleted = true;
}