@Override public long getChunkEndTimeUs() { checkInBounds(); return representationHolder.getSegmentEndTimeUs(getCurrentIndex()); } }
@Override public long getChunkStartTimeUs() { checkInBounds(); return representationHolder.getSegmentStartTimeUs(getCurrentIndex()); }
public long getSegmentEndTimeUs(long segmentNum) { return getSegmentStartTimeUs(segmentNum) + segmentIndex.getDurationUs(segmentNum - segmentNumShift, periodDurationUs); }
/** * Creates a new factory for {@link DashMediaSource}s. * * @param dataSourceFactory A factory for {@link DataSource} instances that will be used to load * manifest and media data. */ public Factory(DataSource.Factory dataSourceFactory) { this(new DefaultDashChunkSource.Factory(dataSourceFactory), dataSourceFactory); }
@Override public void onLoadCanceled(ParsingLoadable<DashManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released) { DashMediaSource.this.onLoadCanceled(loadable, elapsedRealtimeMs, loadDurationMs); }
public static TrackGroupInfo embeddedCea608Track(int[] adaptationSetIndices, int primaryTrackGroupIndex) { return new TrackGroupInfo( C.TRACK_TYPE_TEXT, CATEGORY_EMBEDDED, adaptationSetIndices, primaryTrackGroupIndex, C.INDEX_UNSET, C.INDEX_UNSET, -1); }
@Override public int getIndexOfPeriod(Object uid) { if (!(uid instanceof Integer)) { return C.INDEX_UNSET; } int periodId = (int) uid; int periodIndex = periodId - firstPeriodId; return periodIndex < 0 || periodIndex >= getPeriodCount() ? C.INDEX_UNSET : periodIndex; }
@Override public LoadErrorAction onLoadError( ParsingLoadable<Long> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { return onUtcTimestampLoadError(loadable, elapsedRealtimeMs, loadDurationMs, error); }
/** * Updates the {@link DashManifest} that this handler works on. * * @param newManifest The updated manifest. */ public void updateManifest(DashManifest newManifest) { isWaitingForManifestRefresh = false; expiredManifestPublishTimeUs = C.TIME_UNSET; this.manifest = newManifest; removePreviouslyExpiredManifestPublishTimeValues(); }
/** Requests DASH media manifest to be refreshed if necessary. */ private void maybeNotifyDashManifestRefreshNeeded() { if (lastLoadedChunkEndTimeBeforeRefreshUs != C.TIME_UNSET && lastLoadedChunkEndTimeBeforeRefreshUs == lastLoadedChunkEndTimeUs) { // Already requested manifest refresh. return; } isWaitingForManifestRefresh = true; lastLoadedChunkEndTimeBeforeRefreshUs = lastLoadedChunkEndTimeUs; playerEmsgCallback.onDashManifestRefreshRequested(); }
/** * Called when the a new chunk in the current media stream has been loaded. * * @param chunk The chunk whose load has been completed. */ public void onChunkLoadCompleted(Chunk chunk) { PlayerEmsgHandler.this.onChunkLoadCompleted(chunk); }
@Override public void onLoadCompleted(ParsingLoadable<Long> loadable, long elapsedRealtimeMs, long loadDurationMs) { onUtcTimestampLoadCompleted(loadable, elapsedRealtimeMs, loadDurationMs); }
/** * For live streaming, check if the DASH manifest is expired before the next segment start time. * If it is, the DASH media source will be notified to refresh the manifest. * * @param presentationPositionUs The next load position in presentation time. * @return True if manifest refresh has been requested, false otherwise. */ public boolean maybeRefreshManifestBeforeLoadingNextChunk(long presentationPositionUs) { return PlayerEmsgHandler.this.maybeRefreshManifestBeforeLoadingNextChunk( presentationPositionUs); }
/** * For live streaming with emsg event stream, forward seeking can seek pass the emsg messages * that signals end-of-stream or Manifest expiry, which results in load error. In this case, we * should notify the Dash media source to refresh its manifest. * * @param chunk The chunk whose load encountered the error. * @return True if manifest refresh has been requested, false otherwise. */ public boolean maybeRefreshManifestOnLoadingError(Chunk chunk) { return PlayerEmsgHandler.this.maybeRefreshManifestOnLoadingError(chunk); }
private void updateLiveEdgeTimeUs( RepresentationHolder representationHolder, long lastAvailableSegmentNum) { liveEdgeTimeUs = manifest.dynamic ? representationHolder.getSegmentEndTimeUs(lastAvailableSegmentNum) : C.TIME_UNSET; }
@Override public void onDashManifestPublishTimeExpired(long expiredManifestPublishTimeUs) { DashMediaSource.this.onDashManifestPublishTimeExpired(expiredManifestPublishTimeUs); } }
@Override public void onLoadCompleted(ParsingLoadable<DashManifest> loadable, long elapsedRealtimeMs, long loadDurationMs) { onManifestLoadCompleted(loadable, elapsedRealtimeMs, loadDurationMs); }
@Override public LoadErrorAction onLoadError( ParsingLoadable<DashManifest> loadable, long elapsedRealtimeMs, long loadDurationMs, IOException error, int errorCount) { return onManifestLoadError(loadable, elapsedRealtimeMs, loadDurationMs, error); }
@Override public void onLoadCanceled(ParsingLoadable<Long> loadable, long elapsedRealtimeMs, long loadDurationMs, boolean released) { DashMediaSource.this.onLoadCanceled(loadable, elapsedRealtimeMs, loadDurationMs); }
public static TrackGroupInfo embeddedEmsgTrack(int[] adaptationSetIndices, int primaryTrackGroupIndex) { return new TrackGroupInfo( C.TRACK_TYPE_METADATA, CATEGORY_EMBEDDED, adaptationSetIndices, primaryTrackGroupIndex, C.INDEX_UNSET, C.INDEX_UNSET, -1); }