Java Code Examples for com.google.android.exoplayer.TrackRenderer#UNKNOWN_TIME_US

The following examples show how to use com.google.android.exoplayer.TrackRenderer#UNKNOWN_TIME_US . 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: VLCSampleExtractor.java    From Exoplayer_VLC with Apache License 2.0 5 votes vote down vote up
@Override
public long getBufferedPositionUs() {
	Assertions.checkState(prepared);
	long l = lib.getLength();
	if (l <= 0)
		return TrackRenderer.UNKNOWN_TIME_US;
	return l * ExoVlcUtil.MS_2_MICRO;

}
 
Example 2
Source File: FrameworkSampleExtractor.java    From Exoplayer_VLC with Apache License 2.0 5 votes vote down vote up
@Override
public long getBufferedPositionUs() {
  long bufferedDurationUs = mediaExtractor.getCachedDuration();
    System.out.println(">>>>>>>>>> getBufferedPositionUs " + mediaExtractor.getSampleTime());
  if (bufferedDurationUs == -1) {
    return TrackRenderer.UNKNOWN_TIME_US;
  } else {
    long sampleTime = mediaExtractor.getSampleTime();
    return sampleTime == -1 ? TrackRenderer.END_OF_TRACK_US : sampleTime + bufferedDurationUs;
  }

}
 
Example 3
Source File: DashChunkSource.java    From Exoplayer_VLC with Apache License 2.0 5 votes vote down vote up
private DashChunkSource(ManifestFetcher<MediaPresentationDescription> manifestFetcher,
    MediaPresentationDescription initialManifest, int adaptationSetIndex,
    int[] representationIndices, DataSource dataSource, FormatEvaluator formatEvaluator,
    long liveEdgeLatencyUs) {
  this.manifestFetcher = manifestFetcher;
  this.currentManifest = initialManifest;
  this.adaptationSetIndex = adaptationSetIndex;
  this.representationIndices = representationIndices;
  this.dataSource = dataSource;
  this.evaluator = formatEvaluator;
  this.liveEdgeLatencyUs = liveEdgeLatencyUs;
  this.evaluation = new Evaluation();
  this.headerBuilder = new StringBuilder();

  psshInfo = getPsshInfo(currentManifest, adaptationSetIndex);
  Representation[] representations = getFilteredRepresentations(currentManifest,
      adaptationSetIndex, representationIndices);
  long periodDurationUs = (representations[0].periodDurationMs == TrackRenderer.UNKNOWN_TIME_US)
      ? TrackRenderer.UNKNOWN_TIME_US : representations[0].periodDurationMs * 1000;
  this.trackInfo = new TrackInfo(representations[0].format.mimeType, periodDurationUs);

  this.formats = new Format[representations.length];
  this.representationHolders = new HashMap<String, RepresentationHolder>();
  int maxWidth = 0;
  int maxHeight = 0;
  for (int i = 0; i < representations.length; i++) {
    formats[i] = representations[i].format;
    maxWidth = Math.max(formats[i].width, maxWidth);
    maxHeight = Math.max(formats[i].height, maxHeight);
    Extractor extractor = mimeTypeIsWebm(formats[i].mimeType) ? new WebmExtractor()
        : new FragmentedMp4Extractor();
    representationHolders.put(formats[i].id,
        new RepresentationHolder(representations[i], extractor));
  }
  this.maxWidth = maxWidth;
  this.maxHeight = maxHeight;
  Arrays.sort(formats, new DecreasingBandwidthComparator());
}
 
Example 4
Source File: VLCSampleExtractor.java    From Exoplayer_VLC with Apache License 2.0 5 votes vote down vote up
@Override
public long getBufferedPositionUs() {
	Assertions.checkState(prepared);
	long l = lib.getLength();
	if (l <= 0)
		return TrackRenderer.UNKNOWN_TIME_US;
	return l * ExoVlcUtil.MS_2_MICRO;

}