/* 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; }
@Override public boolean handleMessage(Message message) { if (released) { return true; } switch (message.what) { case (EMSG_MANIFEST_EXPIRED): ManifestExpiryEventInfo messageObj = (ManifestExpiryEventInfo) message.obj; handleManifestExpiredMessage( messageObj.eventTimeUs, messageObj.manifestPublishTimeMsInEmsg); return true; default: // Do nothing. } return false; }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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; }
this.allocator = allocator; this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory; playerEmsgHandler = new PlayerEmsgHandler(manifest, playerEmsgCallback, allocator); sampleStreams = newSampleStreamArray(0); eventSampleStreams = new EventSampleStream[0];
? playerEmsgHandler.newPlayerTrackEmsgHandler() : null; DashChunkSource chunkSource =
private void parseAndDiscardSamples() { while (sampleQueue.hasNextSample()) { MetadataInputBuffer inputBuffer = dequeueSample(); if (inputBuffer == null) { continue; } long eventTimeUs = inputBuffer.timeUs; Metadata metadata = decoder.decode(inputBuffer); EventMessage eventMessage = (EventMessage) metadata.get(0); if (isPlayerEmsgEvent(eventMessage.schemeIdUri, eventMessage.value)) { parsePlayerEmsgEvent(eventTimeUs, eventMessage); } } sampleQueue.discardToRead(); }