/** * 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. */ /* package */ boolean maybeRefreshManifestOnLoadingError(Chunk chunk) { if (!manifest.dynamic) { return false; } if (isWaitingForManifestRefresh) { return true; } boolean isAfterForwardSeek = lastLoadedChunkEndTimeUs != C.TIME_UNSET && lastLoadedChunkEndTimeUs < chunk.startTimeUs; if (isAfterForwardSeek) { // if we are after a forward seek, and the playback is dynamic with embedded emsg stream, // there's a chance that we have seek over the emsg messages, in which case we should ask // media source for a refresh. maybeNotifyDashManifestRefreshNeeded(); return true; } return false; }
/* package*/ boolean maybeRefreshManifestBeforeLoadingNextChunk(long presentationPositionUs) { if (!manifest.dynamic) { return false; } if (isWaitingForManifestRefresh) { return true; } boolean manifestRefreshNeeded = false; // Find the smallest publishTime (greater than or equal to the current manifest's publish time) // that has a corresponding expiry time. Map.Entry<Long, Long> expiredEntry = ceilingExpiryEntryForPublishTime(manifest.publishTimeMs); if (expiredEntry != null) { long expiredPointUs = expiredEntry.getValue(); if (expiredPointUs < presentationPositionUs) { expiredManifestPublishTimeUs = expiredEntry.getKey(); notifyManifestPublishTimeExpired(); manifestRefreshNeeded = true; } } if (manifestRefreshNeeded) { maybeNotifyDashManifestRefreshNeeded(); } return manifestRefreshNeeded; }