com.google.android.exoplayer2.source.MediaPeriod Java Examples

The following examples show how to use com.google.android.exoplayer2.source.MediaPeriod. 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: ExoPlayerImplInternal.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void maybeUpdateLoadingPeriod() throws IOException {
  queue.reevaluateBuffer(rendererPositionUs);
  if (queue.shouldLoadNextMediaPeriod()) {
    MediaPeriodInfo info = queue.getNextMediaPeriodInfo(rendererPositionUs, playbackInfo);
    if (info == null) {
      mediaSource.maybeThrowSourceInfoRefreshError();
    } else {
      Object uid = playbackInfo.timeline.getUidOfPeriod(info.id.periodIndex);
      MediaPeriod mediaPeriod =
          queue.enqueueNextMediaPeriod(
              rendererCapabilities,
              trackSelector,
              loadControl.getAllocator(),
              mediaSource,
              uid,
              info);
      mediaPeriod.prepare(this, info.startPositionUs);
      setIsLoading(true);
      updateLoadingMediaPeriodId();
    }
  }
}
 
Example #2
Source File: HlsMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
@Override
public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator, long startPositionUs) {
  EventDispatcher eventDispatcher = createEventDispatcher(id);
  return new HlsMediaPeriod(
      extractorFactory,
      playlistTracker,
      dataSourceFactory,
      mediaTransferListener,
      drmSessionManager,
      loadErrorHandlingPolicy,
      eventDispatcher,
      allocator,
      compositeSequenceableLoaderFactory,
      allowChunklessPreparation,
      metadataType,
      useSessionKeys);
}
 
Example #3
Source File: ExoPlayerImplInternal.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void maybeUpdateLoadingPeriod() throws IOException {
  queue.reevaluateBuffer(rendererPositionUs);
  if (queue.shouldLoadNextMediaPeriod()) {
    MediaPeriodInfo info = queue.getNextMediaPeriodInfo(rendererPositionUs, playbackInfo);
    if (info == null) {
      maybeThrowSourceInfoRefreshError();
    } else {
      MediaPeriod mediaPeriod =
          queue.enqueueNextMediaPeriod(
              rendererCapabilities,
              trackSelector,
              loadControl.getAllocator(),
              mediaSource,
              info);
      mediaPeriod.prepare(this, info.startPositionUs);
      setIsLoading(true);
      handleLoadingMediaPeriodChanged(/* loadingTrackSelectionChanged= */ false);
    }
  }
}
 
Example #4
Source File: HlsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator) {
  Assertions.checkArgument(id.periodIndex == 0);
  EventDispatcher eventDispatcher = createEventDispatcher(id);
  return new HlsMediaPeriod(
      extractorFactory,
      playlistTracker,
      dataSourceFactory,
      mediaTransferListener,
      chunkLoadErrorHandlingPolicy,
      minLoadableRetryCount,
      eventDispatcher,
      allocator,
      compositeSequenceableLoaderFactory,
      allowChunklessPreparation);
}
 
Example #5
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MediaPeriod createPeriod(MediaPeriodId periodId, Allocator allocator) {
  int periodIndex = periodId.periodIndex;
  EventDispatcher periodEventDispatcher =
      createEventDispatcher(periodId, manifest.getPeriod(periodIndex).startMs);
  DashMediaPeriod mediaPeriod =
      new DashMediaPeriod(
          firstPeriodId + periodIndex,
          manifest,
          periodIndex,
          chunkSourceFactory,
          mediaTransferListener,
          minLoadableRetryCount,
          periodEventDispatcher,
          elapsedRealtimeOffsetMs,
          manifestLoadErrorThrower,
          allocator,
          compositeSequenceableLoaderFactory,
          playerEmsgCallback);
  periodsById.put(mediaPeriod.id, mediaPeriod);
  return mediaPeriod;
}
 
Example #6
Source File: ExoPlayerImplInternal.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private void handlePeriodPrepared(MediaPeriod mediaPeriod) throws ExoPlaybackException {
  if (!queue.isLoading(mediaPeriod)) {
    // Stale event.
    return;
  }
  MediaPeriodHolder loadingPeriodHolder = queue.getLoadingPeriod();
  loadingPeriodHolder.handlePrepared(
      mediaClock.getPlaybackParameters().speed, playbackInfo.timeline);
  updateLoadControlTrackSelection(
      loadingPeriodHolder.getTrackGroups(), loadingPeriodHolder.getTrackSelectorResult());
  if (loadingPeriodHolder == queue.getPlayingPeriod()) {
    // This is the first prepared period, so update the position and the renderers.
    resetRendererPosition(loadingPeriodHolder.info.startPositionUs);
    updatePlayingPeriodRenderers(/* oldPlayingPeriodHolder= */ null);
  }
  maybeContinueLoading();
}
 
Example #7
Source File: HlsMediaSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator, long startPositionUs) {
  EventDispatcher eventDispatcher = createEventDispatcher(id);
  return new HlsMediaPeriod(
      extractorFactory,
      playlistTracker,
      dataSourceFactory,
      mediaTransferListener,
      loadErrorHandlingPolicy,
      eventDispatcher,
      allocator,
      compositeSequenceableLoaderFactory,
      allowChunklessPreparation,
      metadataType,
      useSessionKeys);
}
 
Example #8
Source File: ExoPlayerImplInternal.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void handlePeriodPrepared(MediaPeriod mediaPeriod) throws ExoPlaybackException {
  if (!queue.isLoading(mediaPeriod)) {
    // Stale event.
    return;
  }
  MediaPeriodHolder loadingPeriodHolder = queue.getLoadingPeriod();
  loadingPeriodHolder.handlePrepared(mediaClock.getPlaybackParameters().speed);
  updateLoadControlTrackSelection(
      loadingPeriodHolder.trackGroups, loadingPeriodHolder.trackSelectorResult);
  if (!queue.hasPlayingPeriod()) {
    // This is the first prepared period, so start playing it.
    MediaPeriodHolder playingPeriodHolder = queue.advancePlayingPeriod();
    resetRendererPosition(playingPeriodHolder.info.startPositionUs);
    updatePlayingPeriodRenderers(/* oldPlayingPeriodHolder= */ null);
  }
  maybeContinueLoading();
}
 
Example #9
Source File: DashMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MediaPeriod createPeriod(
    MediaPeriodId periodId, Allocator allocator, long startPositionUs) {
  int periodIndex = (Integer) periodId.periodUid - firstPeriodId;
  EventDispatcher periodEventDispatcher =
      createEventDispatcher(periodId, manifest.getPeriod(periodIndex).startMs);
  DashMediaPeriod mediaPeriod =
      new DashMediaPeriod(
          firstPeriodId + periodIndex,
          manifest,
          periodIndex,
          chunkSourceFactory,
          mediaTransferListener,
          loadErrorHandlingPolicy,
          periodEventDispatcher,
          elapsedRealtimeOffsetMs,
          manifestLoadErrorThrower,
          allocator,
          compositeSequenceableLoaderFactory,
          playerEmsgCallback);
  periodsById.put(mediaPeriod.id, mediaPeriod);
  return mediaPeriod;
}
 
Example #10
Source File: ExoPlayerImplInternal.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void maybeUpdateLoadingPeriod() throws IOException {
  queue.reevaluateBuffer(rendererPositionUs);
  if (queue.shouldLoadNextMediaPeriod()) {
    MediaPeriodInfo info = queue.getNextMediaPeriodInfo(rendererPositionUs, playbackInfo);
    if (info == null) {
      maybeThrowSourceInfoRefreshError();
    } else {
      MediaPeriod mediaPeriod =
          queue.enqueueNextMediaPeriod(
              rendererCapabilities,
              trackSelector,
              loadControl.getAllocator(),
              mediaSource,
              info);
      mediaPeriod.prepare(this, info.startPositionUs);
      setIsLoading(true);
      handleLoadingMediaPeriodChanged(/* loadingTrackSelectionChanged= */ false);
    }
  }
}
 
Example #11
Source File: DashMediaSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MediaPeriod createPeriod(
    MediaPeriodId periodId, Allocator allocator, long startPositionUs) {
  int periodIndex = (Integer) periodId.periodUid - firstPeriodId;
  EventDispatcher periodEventDispatcher =
      createEventDispatcher(periodId, manifest.getPeriod(periodIndex).startMs);
  DashMediaPeriod mediaPeriod =
      new DashMediaPeriod(
          firstPeriodId + periodIndex,
          manifest,
          periodIndex,
          chunkSourceFactory,
          mediaTransferListener,
          loadErrorHandlingPolicy,
          periodEventDispatcher,
          elapsedRealtimeOffsetMs,
          manifestLoadErrorThrower,
          allocator,
          compositeSequenceableLoaderFactory,
          playerEmsgCallback);
  periodsById.put(mediaPeriod.id, mediaPeriod);
  return mediaPeriod;
}
 
Example #12
Source File: ExoPlayerImplInternal.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void maybeUpdateLoadingPeriod() throws IOException {
  queue.reevaluateBuffer(rendererPositionUs);
  if (queue.shouldLoadNextMediaPeriod()) {
    MediaPeriodInfo info = queue.getNextMediaPeriodInfo(rendererPositionUs, playbackInfo);
    if (info == null) {
      mediaSource.maybeThrowSourceInfoRefreshError();
    } else {
      Object uid = playbackInfo.timeline.getUidOfPeriod(info.id.periodIndex);
      MediaPeriod mediaPeriod =
          queue.enqueueNextMediaPeriod(
              rendererCapabilities,
              trackSelector,
              loadControl.getAllocator(),
              mediaSource,
              uid,
              info);
      mediaPeriod.prepare(this, info.startPositionUs);
      setIsLoading(true);
      updateLoadingMediaPeriodId();
    }
  }
}
 
Example #13
Source File: ExoPlayerImplInternal.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private void handlePeriodPrepared(MediaPeriod mediaPeriod) throws ExoPlaybackException {
  if (!queue.isLoading(mediaPeriod)) {
    // Stale event.
    return;
  }
  MediaPeriodHolder loadingPeriodHolder = queue.getLoadingPeriod();
  loadingPeriodHolder.handlePrepared(mediaClock.getPlaybackParameters().speed);
  updateLoadControlTrackSelection(
      loadingPeriodHolder.trackGroups, loadingPeriodHolder.trackSelectorResult);
  if (!queue.hasPlayingPeriod()) {
    // This is the first prepared period, so start playing it.
    MediaPeriodHolder playingPeriodHolder = queue.advancePlayingPeriod();
    resetRendererPosition(playingPeriodHolder.info.startPositionUs);
    updatePlayingPeriodRenderers(/* oldPlayingPeriodHolder= */ null);
  }
  maybeContinueLoading();
}
 
Example #14
Source File: ExoPlayerImplInternal.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void handlePeriodPrepared(MediaPeriod mediaPeriod) throws ExoPlaybackException {
  if (!queue.isLoading(mediaPeriod)) {
    // Stale event.
    return;
  }
  MediaPeriodHolder loadingPeriodHolder = queue.getLoadingPeriod();
  loadingPeriodHolder.handlePrepared(
      mediaClock.getPlaybackParameters().speed, playbackInfo.timeline);
  updateLoadControlTrackSelection(
      loadingPeriodHolder.getTrackGroups(), loadingPeriodHolder.getTrackSelectorResult());
  if (!queue.hasPlayingPeriod()) {
    // This is the first prepared period, so start playing it.
    MediaPeriodHolder playingPeriodHolder = queue.advancePlayingPeriod();
    resetRendererPosition(playingPeriodHolder.info.startPositionUs);
    updatePlayingPeriodRenderers(/* oldPlayingPeriodHolder= */ null);
  }
  maybeContinueLoading();
}
 
Example #15
Source File: HlsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator) {
  Assertions.checkArgument(id.periodIndex == 0);
  EventDispatcher eventDispatcher = createEventDispatcher(id);
  return new HlsMediaPeriod(
      extractorFactory,
      playlistTracker,
      dataSourceFactory,
      mediaTransferListener,
      chunkLoadErrorHandlingPolicy,
      minLoadableRetryCount,
      eventDispatcher,
      allocator,
      compositeSequenceableLoaderFactory,
      allowChunklessPreparation);
}
 
Example #16
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator) {
  Assertions.checkArgument(id.periodIndex == 0);
  EventDispatcher eventDispatcher = createEventDispatcher(id);
  SsMediaPeriod period =
      new SsMediaPeriod(
          manifest,
          chunkSourceFactory,
          mediaTransferListener,
          compositeSequenceableLoaderFactory,
          minLoadableRetryCount,
          eventDispatcher,
          manifestLoaderErrorThrower,
          allocator);
  mediaPeriods.add(period);
  return period;
}
 
Example #17
Source File: SsMediaSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator, long startPositionUs) {
  EventDispatcher eventDispatcher = createEventDispatcher(id);
  SsMediaPeriod period =
      new SsMediaPeriod(
          manifest,
          chunkSourceFactory,
          mediaTransferListener,
          compositeSequenceableLoaderFactory,
          loadErrorHandlingPolicy,
          eventDispatcher,
          manifestLoaderErrorThrower,
          allocator);
  mediaPeriods.add(period);
  return period;
}
 
Example #18
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MediaPeriod createPeriod(MediaPeriodId periodId, Allocator allocator) {
  int periodIndex = periodId.periodIndex;
  EventDispatcher periodEventDispatcher =
      createEventDispatcher(periodId, manifest.getPeriod(periodIndex).startMs);
  DashMediaPeriod mediaPeriod =
      new DashMediaPeriod(
          firstPeriodId + periodIndex,
          manifest,
          periodIndex,
          chunkSourceFactory,
          mediaTransferListener,
          minLoadableRetryCount,
          periodEventDispatcher,
          elapsedRealtimeOffsetMs,
          manifestLoadErrorThrower,
          allocator,
          compositeSequenceableLoaderFactory,
          playerEmsgCallback);
  periodsById.put(mediaPeriod.id, mediaPeriod);
  return mediaPeriod;
}
 
Example #19
Source File: HlsMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public MediaPeriod createPeriod(MediaPeriodId id, Allocator allocator, long startPositionUs) {
  EventDispatcher eventDispatcher = createEventDispatcher(id);
  return new HlsMediaPeriod(
      extractorFactory,
      playlistTracker,
      dataSourceFactory,
      mediaTransferListener,
      loadErrorHandlingPolicy,
      eventDispatcher,
      allocator,
      compositeSequenceableLoaderFactory,
      allowChunklessPreparation,
      metadataType,
      useSessionKeys);
}
 
Example #20
Source File: MediaPeriodQueue.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Enqueues a new media period based on the specified information as the new loading media period,
 * and returns it.
 *
 * @param rendererCapabilities The renderer capabilities.
 * @param trackSelector The track selector.
 * @param allocator The allocator.
 * @param mediaSource The media source that produced the media period.
 * @param uid The unique identifier for the containing timeline period.
 * @param info Information used to identify this media period in its timeline period.
 */
public MediaPeriod enqueueNextMediaPeriod(
    RendererCapabilities[] rendererCapabilities,
    TrackSelector trackSelector,
    Allocator allocator,
    MediaSource mediaSource,
    Object uid,
    MediaPeriodInfo info) {
  long rendererPositionOffsetUs =
      loading == null
          ? info.startPositionUs
          : (loading.getRendererOffset() + loading.info.durationUs);
  MediaPeriodHolder newPeriodHolder =
      new MediaPeriodHolder(
          rendererCapabilities,
          rendererPositionOffsetUs,
          trackSelector,
          allocator,
          mediaSource,
          uid,
          info);
  if (loading != null) {
    Assertions.checkState(hasPlayingPeriod());
    loading.next = newPeriodHolder;
  }
  oldFrontPeriodUid = null;
  loading = newPeriodHolder;
  length++;
  return newPeriodHolder.mediaPeriod;
}
 
Example #21
Source File: AdsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void releasePeriod(MediaPeriod mediaPeriod) {
  DeferredMediaPeriod deferredMediaPeriod = (DeferredMediaPeriod) mediaPeriod;
  List<DeferredMediaPeriod> mediaPeriods =
      deferredMediaPeriodByAdMediaSource.get(deferredMediaPeriod.mediaSource);
  if (mediaPeriods != null) {
    mediaPeriods.remove(deferredMediaPeriod);
  }
  deferredMediaPeriod.releasePeriod();
}
 
Example #22
Source File: SsMediaSource.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public MediaPeriod createPeriod(int index, Allocator allocator, long positionUs) {
  Assertions.checkArgument(index == 0);
  SsMediaPeriod period = new SsMediaPeriod(manifest, chunkSourceFactory, minLoadableRetryCount,
      eventDispatcher, manifestLoaderErrorThrower, allocator);
  mediaPeriods.add(period);
  return period;
}
 
Example #23
Source File: MediaPeriodHolder.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/** Releases the given {@code mediaPeriod}, logging and suppressing any errors. */
private static void releaseMediaPeriod(
    long endPositionUs, MediaSource mediaSource, MediaPeriod mediaPeriod) {
  try {
    if (endPositionUs != C.TIME_UNSET && endPositionUs != C.TIME_END_OF_SOURCE) {
      mediaSource.releasePeriod(((ClippingMediaPeriod) mediaPeriod).mediaPeriod);
    } else {
      mediaSource.releasePeriod(mediaPeriod);
    }
  } catch (RuntimeException e) {
    // There's nothing we can do.
    Log.e(TAG, "Period release failed.", e);
  }
}
 
Example #24
Source File: ExoPlayerImplInternal.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void handleContinueLoadingRequested(MediaPeriod mediaPeriod) {
  if (!queue.isLoading(mediaPeriod)) {
    // Stale event.
    return;
  }
  queue.reevaluateBuffer(rendererPositionUs);
  maybeContinueLoading();
}
 
Example #25
Source File: MediaPeriodHolder.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/** Releases the given {@code mediaPeriod}, logging and suppressing any errors. */
private static void releaseMediaPeriod(
    long endPositionUs, MediaSource mediaSource, MediaPeriod mediaPeriod) {
  try {
    if (endPositionUs != C.TIME_UNSET && endPositionUs != C.TIME_END_OF_SOURCE) {
      mediaSource.releasePeriod(((ClippingMediaPeriod) mediaPeriod).mediaPeriod);
    } else {
      mediaSource.releasePeriod(mediaPeriod);
    }
  } catch (RuntimeException e) {
    // There's nothing we can do.
    Log.e(TAG, "Period release failed.", e);
  }
}
 
Example #26
Source File: AdsMediaSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void releasePeriod(MediaPeriod mediaPeriod) {
  DeferredMediaPeriod deferredMediaPeriod = (DeferredMediaPeriod) mediaPeriod;
  List<DeferredMediaPeriod> mediaPeriods =
      deferredMediaPeriodByAdMediaSource.get(deferredMediaPeriod.mediaSource);
  if (mediaPeriods != null) {
    mediaPeriods.remove(deferredMediaPeriod);
  }
  deferredMediaPeriod.releasePeriod();
}
 
Example #27
Source File: ExoPlayerImplInternal.java    From K-Sonic with MIT License 5 votes vote down vote up
private void handlePeriodPrepared(MediaPeriod period) throws ExoPlaybackException {
  if (loadingPeriodHolder == null || loadingPeriodHolder.mediaPeriod != period) {
    // Stale event.
    return;
  }
  loadingPeriodHolder.handlePrepared();
  if (playingPeriodHolder == null) {
    // This is the first prepared period, so start playing it.
    readingPeriodHolder = loadingPeriodHolder;
    resetRendererPosition(readingPeriodHolder.startPositionUs);
    setPlayingPeriodHolder(readingPeriodHolder);
  }
  maybeContinueLoading();
}
 
Example #28
Source File: ExoPlayerImplInternal.java    From K-Sonic with MIT License 5 votes vote down vote up
private void handleContinueLoadingRequested(MediaPeriod period) {
  if (loadingPeriodHolder == null || loadingPeriodHolder.mediaPeriod != period) {
    // Stale event.
    return;
  }
  maybeContinueLoading();
}
 
Example #29
Source File: DashMediaSource.java    From K-Sonic with MIT License 5 votes vote down vote up
@Override
public MediaPeriod createPeriod(int periodIndex, Allocator allocator, long positionUs) {
  EventDispatcher periodEventDispatcher = eventDispatcher.copyWithMediaTimeOffsetMs(
      manifest.getPeriod(periodIndex).startMs);
  DashMediaPeriod mediaPeriod = new DashMediaPeriod(firstPeriodId + periodIndex, manifest,
      periodIndex, chunkSourceFactory, minLoadableRetryCount, periodEventDispatcher,
      elapsedRealtimeOffsetMs, loaderErrorThrower, allocator);
  periodsById.put(mediaPeriod.id, mediaPeriod);
  return mediaPeriod;
}
 
Example #30
Source File: MediaPeriodQueue.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Enqueues a new media period based on the specified information as the new loading media period,
 * and returns it.
 *
 * @param rendererCapabilities The renderer capabilities.
 * @param trackSelector The track selector.
 * @param allocator The allocator.
 * @param mediaSource The media source that produced the media period.
 * @param info Information used to identify this media period in its timeline period.
 */
public MediaPeriod enqueueNextMediaPeriod(
    RendererCapabilities[] rendererCapabilities,
    TrackSelector trackSelector,
    Allocator allocator,
    MediaSource mediaSource,
    MediaPeriodInfo info) {
  long rendererPositionOffsetUs =
      loading == null
          ? (info.id.isAd() && info.contentPositionUs != C.TIME_UNSET
              ? info.contentPositionUs
              : 0)
          : (loading.getRendererOffset() + loading.info.durationUs - info.startPositionUs);
  MediaPeriodHolder newPeriodHolder =
      new MediaPeriodHolder(
          rendererCapabilities,
          rendererPositionOffsetUs,
          trackSelector,
          allocator,
          mediaSource,
          info);
  if (loading != null) {
    Assertions.checkState(hasPlayingPeriod());
    loading.setNext(newPeriodHolder);
  }
  oldFrontPeriodUid = null;
  loading = newPeriodHolder;
  length++;
  return newPeriodHolder.mediaPeriod;
}