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

The following examples show how to use com.google.android.exoplayer2.source.CompositeSequenceableLoaderFactory. 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: HlsMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private HlsMediaSource(
    Uri manifestUri,
    HlsDataSourceFactory dataSourceFactory,
    HlsExtractorFactory extractorFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    DrmSessionManager<?> drmSessionManager,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistTracker playlistTracker,
    boolean allowChunklessPreparation,
    @MetadataType int metadataType,
    boolean useSessionKeys,
    @Nullable Object tag) {
  this.manifestUri = manifestUri;
  this.dataSourceFactory = dataSourceFactory;
  this.extractorFactory = extractorFactory;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.drmSessionManager = drmSessionManager;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.playlistTracker = playlistTracker;
  this.allowChunklessPreparation = allowChunklessPreparation;
  this.metadataType = metadataType;
  this.useSessionKeys = useSessionKeys;
  this.tag = tag;
}
 
Example #2
Source File: SsMediaPeriod.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public SsMediaPeriod(
    SsManifest manifest,
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator) {
  this.manifest = manifest;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  trackGroups = buildTrackGroups(manifest);
  sampleStreams = newSampleStreamArray(0);
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  eventDispatcher.mediaPeriodCreated();
}
 
Example #3
Source File: SsMediaSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private SsMediaSource(
    SsManifest manifest,
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends SsManifest> manifestParser,
    SsChunkSource.Factory chunkSourceFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    long livePresentationDelayMs,
    @Nullable Object tag) {
  Assertions.checkState(manifest == null || !manifest.isLive);
  this.manifest = manifest;
  this.manifestUri = manifestUri == null ? null : SsUtil.fixManifestUri(manifestUri);
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.manifestEventDispatcher = createEventDispatcher(/* mediaPeriodId= */ null);
  this.tag = tag;
  sideloadedManifest = manifest != null;
  mediaPeriods = new ArrayList<>();
}
 
Example #4
Source File: HlsMediaSource.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private HlsMediaSource(
    Uri manifestUri,
    HlsDataSourceFactory dataSourceFactory,
    HlsExtractorFactory extractorFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistTracker playlistTracker,
    boolean allowChunklessPreparation,
    @HlsMetadataType int metadataType,
    boolean useSessionKeys,
    @Nullable Object tag) {
  this.manifestUri = manifestUri;
  this.dataSourceFactory = dataSourceFactory;
  this.extractorFactory = extractorFactory;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.playlistTracker = playlistTracker;
  this.allowChunklessPreparation = allowChunklessPreparation;
  this.metadataType = metadataType;
  this.useSessionKeys = useSessionKeys;
  this.tag = tag;
}
 
Example #5
Source File: SsMediaPeriod.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public SsMediaPeriod(
    SsManifest manifest,
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator) {
  this.manifest = manifest;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  trackGroups = buildTrackGroups(manifest);
  sampleStreams = newSampleStreamArray(0);
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  eventDispatcher.mediaPeriodCreated();
}
 
Example #6
Source File: SsMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private SsMediaSource(
    SsManifest manifest,
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends SsManifest> manifestParser,
    SsChunkSource.Factory chunkSourceFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    long livePresentationDelayMs,
    @Nullable Object tag) {
  Assertions.checkState(manifest == null || !manifest.isLive);
  this.manifest = manifest;
  this.manifestUri = manifestUri == null ? null : SsUtil.fixManifestUri(manifestUri);
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.manifestEventDispatcher = createEventDispatcher(/* mediaPeriodId= */ null);
  this.tag = tag;
  sideloadedManifest = manifest != null;
  mediaPeriods = new ArrayList<>();
}
 
Example #7
Source File: HlsMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private HlsMediaSource(
    Uri manifestUri,
    HlsDataSourceFactory dataSourceFactory,
    HlsExtractorFactory extractorFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    HlsPlaylistTracker playlistTracker,
    boolean allowChunklessPreparation,
    @HlsMetadataType int metadataType,
    boolean useSessionKeys,
    @Nullable Object tag) {
  this.manifestUri = manifestUri;
  this.dataSourceFactory = dataSourceFactory;
  this.extractorFactory = extractorFactory;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.playlistTracker = playlistTracker;
  this.allowChunklessPreparation = allowChunklessPreparation;
  this.metadataType = metadataType;
  this.useSessionKeys = useSessionKeys;
  this.tag = tag;
}
 
Example #8
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private SsMediaSource(
    SsManifest manifest,
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends SsManifest> manifestParser,
    SsChunkSource.Factory chunkSourceFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    @Nullable Object tag) {
  Assertions.checkState(manifest == null || !manifest.isLive);
  this.manifest = manifest;
  this.manifestUri = manifestUri == null ? null : SsUtil.fixManifestUri(manifestUri);
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.manifestEventDispatcher = createEventDispatcher(/* mediaPeriodId= */ null);
  this.tag = tag;
  sideloadedManifest = manifest != null;
  mediaPeriods = new ArrayList<>();
}
 
Example #9
Source File: HlsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private HlsMediaSource(
    Uri manifestUri,
    HlsDataSourceFactory dataSourceFactory,
    HlsExtractorFactory extractorFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy<Chunk> chunkLoadErrorHandlingPolicy,
    int minLoadableRetryCount,
    HlsPlaylistTracker playlistTracker,
    boolean allowChunklessPreparation,
    @Nullable Object tag) {
  this.manifestUri = manifestUri;
  this.dataSourceFactory = dataSourceFactory;
  this.extractorFactory = extractorFactory;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.chunkLoadErrorHandlingPolicy = chunkLoadErrorHandlingPolicy;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.playlistTracker = playlistTracker;
  this.allowChunklessPreparation = allowChunklessPreparation;
  this.tag = tag;
}
 
Example #10
Source File: SsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private SsMediaSource(
    SsManifest manifest,
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends SsManifest> manifestParser,
    SsChunkSource.Factory chunkSourceFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    @Nullable Object tag) {
  Assertions.checkState(manifest == null || !manifest.isLive);
  this.manifest = manifest;
  this.manifestUri = manifestUri == null ? null : SsUtil.fixManifestUri(manifestUri);
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.manifestEventDispatcher = createEventDispatcher(/* mediaPeriodId= */ null);
  this.tag = tag;
  sideloadedManifest = manifest != null;
  mediaPeriods = new ArrayList<>();
}
 
Example #11
Source File: HlsMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private HlsMediaSource(
    Uri manifestUri,
    HlsDataSourceFactory dataSourceFactory,
    HlsExtractorFactory extractorFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy<Chunk> chunkLoadErrorHandlingPolicy,
    int minLoadableRetryCount,
    HlsPlaylistTracker playlistTracker,
    boolean allowChunklessPreparation,
    @Nullable Object tag) {
  this.manifestUri = manifestUri;
  this.dataSourceFactory = dataSourceFactory;
  this.extractorFactory = extractorFactory;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.chunkLoadErrorHandlingPolicy = chunkLoadErrorHandlingPolicy;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.playlistTracker = playlistTracker;
  this.allowChunklessPreparation = allowChunklessPreparation;
  this.tag = tag;
}
 
Example #12
Source File: SsMediaSource.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private SsMediaSource(
    @Nullable SsManifest manifest,
    @Nullable Uri manifestUri,
    @Nullable DataSource.Factory manifestDataSourceFactory,
    @Nullable ParsingLoadable.Parser<? extends SsManifest> manifestParser,
    SsChunkSource.Factory chunkSourceFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    DrmSessionManager<?> drmSessionManager,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    long livePresentationDelayMs,
    @Nullable Object tag) {
  Assertions.checkState(manifest == null || !manifest.isLive);
  this.manifest = manifest;
  this.manifestUri = manifestUri == null ? null : SsUtil.fixManifestUri(manifestUri);
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.drmSessionManager = drmSessionManager;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.manifestEventDispatcher = createEventDispatcher(/* mediaPeriodId= */ null);
  this.tag = tag;
  sideloadedManifest = manifest != null;
  mediaPeriods = new ArrayList<>();
}
 
Example #13
Source File: SsMediaPeriod.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
public SsMediaPeriod(
    SsManifest manifest,
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    DrmSessionManager<?> drmSessionManager,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator) {
  this.manifest = manifest;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.drmSessionManager = drmSessionManager;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  trackGroups = buildTrackGroups(manifest, drmSessionManager);
  sampleStreams = newSampleStreamArray(0);
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  eventDispatcher.mediaPeriodCreated();
}
 
Example #14
Source File: HlsMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an HLS media period.
 *
 * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments.
 * @param playlistTracker A tracker for HLS playlists.
 * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for segments
 *     and keys.
 * @param mediaTransferListener The transfer listener to inform of any media data transfers. May
 *     be null if no listener is available.
 * @param chunkLoadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy} for chunk loads.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param eventDispatcher A dispatcher to notify of events.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param compositeSequenceableLoaderFactory A factory to create composite {@link
 *     SequenceableLoader}s for when this media source loads data from multiple streams.
 * @param allowChunklessPreparation Whether chunkless preparation is allowed.
 */
public HlsMediaPeriod(
    HlsExtractorFactory extractorFactory,
    HlsPlaylistTracker playlistTracker,
    HlsDataSourceFactory dataSourceFactory,
    @Nullable TransferListener mediaTransferListener,
    LoadErrorHandlingPolicy<Chunk> chunkLoadErrorHandlingPolicy,
    int minLoadableRetryCount,
    EventDispatcher eventDispatcher,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    boolean allowChunklessPreparation) {
  this.extractorFactory = extractorFactory;
  this.playlistTracker = playlistTracker;
  this.dataSourceFactory = dataSourceFactory;
  this.mediaTransferListener = mediaTransferListener;
  this.chunkLoadErrorHandlingPolicy = chunkLoadErrorHandlingPolicy;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.allowChunklessPreparation = allowChunklessPreparation;
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader();
  streamWrapperIndices = new IdentityHashMap<>();
  timestampAdjusterProvider = new TimestampAdjusterProvider();
  sampleStreamWrappers = new HlsSampleStreamWrapper[0];
  enabledSampleStreamWrappers = new HlsSampleStreamWrapper[0];
  eventDispatcher.mediaPeriodCreated();
}
 
Example #15
Source File: DashMediaPeriod.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
public DashMediaPeriod(
    int id,
    DashManifest manifest,
    int periodIndex,
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    DrmSessionManager<?> drmSessionManager,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    long elapsedRealtimeOffsetMs,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    PlayerEmsgCallback playerEmsgCallback) {
  this.id = id;
  this.manifest = manifest;
  this.periodIndex = periodIndex;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.drmSessionManager = drmSessionManager;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.elapsedRealtimeOffsetMs = elapsedRealtimeOffsetMs;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  playerEmsgHandler = new PlayerEmsgHandler(manifest, playerEmsgCallback, allocator);
  sampleStreams = newSampleStreamArray(0);
  eventSampleStreams = new EventSampleStream[0];
  trackEmsgHandlerBySampleStream = new IdentityHashMap<>();
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  Period period = manifest.getPeriod(periodIndex);
  eventStreams = period.eventStreams;
  Pair<TrackGroupArray, TrackGroupInfo[]> result =
      buildTrackGroups(drmSessionManager, period.adaptationSets, eventStreams);
  trackGroups = result.first;
  trackGroupInfos = result.second;
  eventDispatcher.mediaPeriodCreated();
}
 
Example #16
Source File: DashMediaPeriod.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public DashMediaPeriod(
    int id,
    DashManifest manifest,
    int periodIndex,
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    long elapsedRealtimeOffsetMs,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    PlayerEmsgCallback playerEmsgCallback) {
  this.id = id;
  this.manifest = manifest;
  this.periodIndex = periodIndex;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.elapsedRealtimeOffsetMs = elapsedRealtimeOffsetMs;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  playerEmsgHandler = new PlayerEmsgHandler(manifest, playerEmsgCallback, allocator);
  sampleStreams = newSampleStreamArray(0);
  eventSampleStreams = new EventSampleStream[0];
  trackEmsgHandlerBySampleStream = new IdentityHashMap<>();
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  Period period = manifest.getPeriod(periodIndex);
  eventStreams = period.eventStreams;
  Pair<TrackGroupArray, TrackGroupInfo[]> result = buildTrackGroups(period.adaptationSets,
      eventStreams);
  trackGroups = result.first;
  trackGroupInfos = result.second;
  eventDispatcher.mediaPeriodCreated();
}
 
Example #17
Source File: HlsMediaPeriod.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an HLS media period.
 *
 * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments.
 * @param playlistTracker A tracker for HLS playlists.
 * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for segments
 *     and keys.
 * @param mediaTransferListener The transfer listener to inform of any media data transfers. May
 *     be null if no listener is available.
 * @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}.
 * @param eventDispatcher A dispatcher to notify of events.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param compositeSequenceableLoaderFactory A factory to create composite {@link
 *     SequenceableLoader}s for when this media source loads data from multiple streams.
 * @param allowChunklessPreparation Whether chunkless preparation is allowed.
 * @param useSessionKeys Whether to use #EXT-X-SESSION-KEY tags.
 */
public HlsMediaPeriod(
    HlsExtractorFactory extractorFactory,
    HlsPlaylistTracker playlistTracker,
    HlsDataSourceFactory dataSourceFactory,
    @Nullable TransferListener mediaTransferListener,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    boolean allowChunklessPreparation,
    @HlsMetadataType int metadataType,
    boolean useSessionKeys) {
  this.extractorFactory = extractorFactory;
  this.playlistTracker = playlistTracker;
  this.dataSourceFactory = dataSourceFactory;
  this.mediaTransferListener = mediaTransferListener;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.allowChunklessPreparation = allowChunklessPreparation;
  this.metadataType = metadataType;
  this.useSessionKeys = useSessionKeys;
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader();
  streamWrapperIndices = new IdentityHashMap<>();
  timestampAdjusterProvider = new TimestampAdjusterProvider();
  sampleStreamWrappers = new HlsSampleStreamWrapper[0];
  enabledSampleStreamWrappers = new HlsSampleStreamWrapper[0];
  manifestUrlIndicesPerWrapper = new int[0][];
  eventDispatcher.mediaPeriodCreated();
}
 
Example #18
Source File: HlsMediaPeriod.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an HLS media period.
 *
 * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments.
 * @param playlistTracker A tracker for HLS playlists.
 * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for segments
 *     and keys.
 * @param mediaTransferListener The transfer listener to inform of any media data transfers. May
 *     be null if no listener is available.
 * @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}.
 * @param eventDispatcher A dispatcher to notify of events.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param compositeSequenceableLoaderFactory A factory to create composite {@link
 *     SequenceableLoader}s for when this media source loads data from multiple streams.
 * @param allowChunklessPreparation Whether chunkless preparation is allowed.
 * @param useSessionKeys Whether to use #EXT-X-SESSION-KEY tags.
 */
public HlsMediaPeriod(
    HlsExtractorFactory extractorFactory,
    HlsPlaylistTracker playlistTracker,
    HlsDataSourceFactory dataSourceFactory,
    @Nullable TransferListener mediaTransferListener,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    boolean allowChunklessPreparation,
    @HlsMetadataType int metadataType,
    boolean useSessionKeys) {
  this.extractorFactory = extractorFactory;
  this.playlistTracker = playlistTracker;
  this.dataSourceFactory = dataSourceFactory;
  this.mediaTransferListener = mediaTransferListener;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.allowChunklessPreparation = allowChunklessPreparation;
  this.metadataType = metadataType;
  this.useSessionKeys = useSessionKeys;
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader();
  streamWrapperIndices = new IdentityHashMap<>();
  timestampAdjusterProvider = new TimestampAdjusterProvider();
  sampleStreamWrappers = new HlsSampleStreamWrapper[0];
  enabledSampleStreamWrappers = new HlsSampleStreamWrapper[0];
  manifestUrlIndicesPerWrapper = new int[0][];
  eventDispatcher.mediaPeriodCreated();
}
 
Example #19
Source File: SsMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public SsMediaPeriod(
    SsManifest manifest,
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    int minLoadableRetryCount,
    EventDispatcher eventDispatcher,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator) {
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;

  trackGroups = buildTrackGroups(manifest);
  ProtectionElement protectionElement = manifest.protectionElement;
  if (protectionElement != null) {
    byte[] keyId = getProtectionElementKeyId(protectionElement.data);
    // We assume pattern encryption does not apply.
    trackEncryptionBoxes = new TrackEncryptionBox[] {
        new TrackEncryptionBox(true, null, INITIALIZATION_VECTOR_SIZE, keyId, 0, 0, null)};
  } else {
    trackEncryptionBoxes = null;
  }
  this.manifest = manifest;
  sampleStreams = newSampleStreamArray(0);
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  eventDispatcher.mediaPeriodCreated();
}
 
Example #20
Source File: DashMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public DashMediaPeriod(
    int id,
    DashManifest manifest,
    int periodIndex,
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    int minLoadableRetryCount,
    EventDispatcher eventDispatcher,
    long elapsedRealtimeOffset,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    PlayerEmsgCallback playerEmsgCallback) {
  this.id = id;
  this.manifest = manifest;
  this.periodIndex = periodIndex;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.elapsedRealtimeOffset = elapsedRealtimeOffset;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  playerEmsgHandler = new PlayerEmsgHandler(manifest, playerEmsgCallback, allocator);
  sampleStreams = newSampleStreamArray(0);
  eventSampleStreams = new EventSampleStream[0];
  trackEmsgHandlerBySampleStream = new IdentityHashMap<>();
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  Period period = manifest.getPeriod(periodIndex);
  eventStreams = period.eventStreams;
  Pair<TrackGroupArray, TrackGroupInfo[]> result = buildTrackGroups(period.adaptationSets,
      eventStreams);
  trackGroups = result.first;
  trackGroupInfos = result.second;
  eventDispatcher.mediaPeriodCreated();
}
 
Example #21
Source File: HlsMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an HLS media period.
 *
 * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments.
 * @param playlistTracker A tracker for HLS playlists.
 * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for segments
 *     and keys.
 * @param mediaTransferListener The transfer listener to inform of any media data transfers. May
 *     be null if no listener is available.
 * @param chunkLoadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy} for chunk loads.
 * @param minLoadableRetryCount The minimum number of times to retry if a loading error occurs.
 * @param eventDispatcher A dispatcher to notify of events.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param compositeSequenceableLoaderFactory A factory to create composite {@link
 *     SequenceableLoader}s for when this media source loads data from multiple streams.
 * @param allowChunklessPreparation Whether chunkless preparation is allowed.
 */
public HlsMediaPeriod(
    HlsExtractorFactory extractorFactory,
    HlsPlaylistTracker playlistTracker,
    HlsDataSourceFactory dataSourceFactory,
    @Nullable TransferListener mediaTransferListener,
    LoadErrorHandlingPolicy<Chunk> chunkLoadErrorHandlingPolicy,
    int minLoadableRetryCount,
    EventDispatcher eventDispatcher,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    boolean allowChunklessPreparation) {
  this.extractorFactory = extractorFactory;
  this.playlistTracker = playlistTracker;
  this.dataSourceFactory = dataSourceFactory;
  this.mediaTransferListener = mediaTransferListener;
  this.chunkLoadErrorHandlingPolicy = chunkLoadErrorHandlingPolicy;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.allowChunklessPreparation = allowChunklessPreparation;
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader();
  streamWrapperIndices = new IdentityHashMap<>();
  timestampAdjusterProvider = new TimestampAdjusterProvider();
  sampleStreamWrappers = new HlsSampleStreamWrapper[0];
  enabledSampleStreamWrappers = new HlsSampleStreamWrapper[0];
  eventDispatcher.mediaPeriodCreated();
}
 
Example #22
Source File: DashMediaPeriod.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public DashMediaPeriod(
    int id,
    DashManifest manifest,
    int periodIndex,
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    long elapsedRealtimeOffsetMs,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    PlayerEmsgCallback playerEmsgCallback) {
  this.id = id;
  this.manifest = manifest;
  this.periodIndex = periodIndex;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.elapsedRealtimeOffsetMs = elapsedRealtimeOffsetMs;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  playerEmsgHandler = new PlayerEmsgHandler(manifest, playerEmsgCallback, allocator);
  sampleStreams = newSampleStreamArray(0);
  eventSampleStreams = new EventSampleStream[0];
  trackEmsgHandlerBySampleStream = new IdentityHashMap<>();
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  Period period = manifest.getPeriod(periodIndex);
  eventStreams = period.eventStreams;
  Pair<TrackGroupArray, TrackGroupInfo[]> result = buildTrackGroups(period.adaptationSets,
      eventStreams);
  trackGroups = result.first;
  trackGroupInfos = result.second;
  eventDispatcher.mediaPeriodCreated();
}
 
Example #23
Source File: SsMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public SsMediaPeriod(
    SsManifest manifest,
    SsChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    int minLoadableRetryCount,
    EventDispatcher eventDispatcher,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator) {
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;

  trackGroups = buildTrackGroups(manifest);
  ProtectionElement protectionElement = manifest.protectionElement;
  if (protectionElement != null) {
    byte[] keyId = getProtectionElementKeyId(protectionElement.data);
    // We assume pattern encryption does not apply.
    trackEncryptionBoxes = new TrackEncryptionBox[] {
        new TrackEncryptionBox(true, null, INITIALIZATION_VECTOR_SIZE, keyId, 0, 0, null)};
  } else {
    trackEncryptionBoxes = null;
  }
  this.manifest = manifest;
  sampleStreams = newSampleStreamArray(0);
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  eventDispatcher.mediaPeriodCreated();
}
 
Example #24
Source File: HlsMediaPeriod.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an HLS media period.
 *
 * @param extractorFactory An {@link HlsExtractorFactory} for {@link Extractor}s for the segments.
 * @param playlistTracker A tracker for HLS playlists.
 * @param dataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for segments
 *     and keys.
 * @param mediaTransferListener The transfer listener to inform of any media data transfers. May
 *     be null if no listener is available.
 * @param drmSessionManager The {@link DrmSessionManager} to acquire {@link DrmSession
 *     DrmSessions} with.
 * @param loadErrorHandlingPolicy A {@link LoadErrorHandlingPolicy}.
 * @param eventDispatcher A dispatcher to notify of events.
 * @param allocator An {@link Allocator} from which to obtain media buffer allocations.
 * @param compositeSequenceableLoaderFactory A factory to create composite {@link
 *     SequenceableLoader}s for when this media source loads data from multiple streams.
 * @param allowChunklessPreparation Whether chunkless preparation is allowed.
 * @param useSessionKeys Whether to use #EXT-X-SESSION-KEY tags.
 */
public HlsMediaPeriod(
    HlsExtractorFactory extractorFactory,
    HlsPlaylistTracker playlistTracker,
    HlsDataSourceFactory dataSourceFactory,
    @Nullable TransferListener mediaTransferListener,
    DrmSessionManager<?> drmSessionManager,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    EventDispatcher eventDispatcher,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    boolean allowChunklessPreparation,
    @HlsMediaSource.MetadataType int metadataType,
    boolean useSessionKeys) {
  this.extractorFactory = extractorFactory;
  this.playlistTracker = playlistTracker;
  this.dataSourceFactory = dataSourceFactory;
  this.mediaTransferListener = mediaTransferListener;
  this.drmSessionManager = drmSessionManager;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.eventDispatcher = eventDispatcher;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.allowChunklessPreparation = allowChunklessPreparation;
  this.metadataType = metadataType;
  this.useSessionKeys = useSessionKeys;
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader();
  streamWrapperIndices = new IdentityHashMap<>();
  timestampAdjusterProvider = new TimestampAdjusterProvider();
  sampleStreamWrappers = new HlsSampleStreamWrapper[0];
  enabledSampleStreamWrappers = new HlsSampleStreamWrapper[0];
  manifestUrlIndicesPerWrapper = new int[0][];
  eventDispatcher.mediaPeriodCreated();
}
 
Example #25
Source File: DashMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public DashMediaPeriod(
    int id,
    DashManifest manifest,
    int periodIndex,
    DashChunkSource.Factory chunkSourceFactory,
    @Nullable TransferListener transferListener,
    int minLoadableRetryCount,
    EventDispatcher eventDispatcher,
    long elapsedRealtimeOffset,
    LoaderErrorThrower manifestLoaderErrorThrower,
    Allocator allocator,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    PlayerEmsgCallback playerEmsgCallback) {
  this.id = id;
  this.manifest = manifest;
  this.periodIndex = periodIndex;
  this.chunkSourceFactory = chunkSourceFactory;
  this.transferListener = transferListener;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.eventDispatcher = eventDispatcher;
  this.elapsedRealtimeOffset = elapsedRealtimeOffset;
  this.manifestLoaderErrorThrower = manifestLoaderErrorThrower;
  this.allocator = allocator;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  playerEmsgHandler = new PlayerEmsgHandler(manifest, playerEmsgCallback, allocator);
  sampleStreams = newSampleStreamArray(0);
  eventSampleStreams = new EventSampleStream[0];
  trackEmsgHandlerBySampleStream = new IdentityHashMap<>();
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(sampleStreams);
  Period period = manifest.getPeriod(periodIndex);
  eventStreams = period.eventStreams;
  Pair<TrackGroupArray, TrackGroupInfo[]> result = buildTrackGroups(period.adaptationSets,
      eventStreams);
  trackGroups = result.first;
  trackGroupInfos = result.second;
  eventDispatcher.mediaPeriodCreated();
}
 
Example #26
Source File: DashMediaSource.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
private DashMediaSource(
    DashManifest manifest,
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends DashManifest> manifestParser,
    DashChunkSource.Factory chunkSourceFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    long livePresentationDelayMs,
    boolean livePresentationDelayOverridesManifest,
    @Nullable Object tag) {
  this.initialManifestUri = manifestUri;
  this.manifest = manifest;
  this.manifestUri = manifestUri;
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.livePresentationDelayOverridesManifest = livePresentationDelayOverridesManifest;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.tag = tag;
  sideloadedManifest = manifest != null;
  manifestEventDispatcher = createEventDispatcher(/* mediaPeriodId= */ null);
  manifestUriLock = new Object();
  periodsById = new SparseArray<>();
  playerEmsgCallback = new DefaultPlayerEmsgCallback();
  expiredManifestPublishTimeUs = C.TIME_UNSET;
  if (sideloadedManifest) {
    Assertions.checkState(!manifest.dynamic);
    manifestCallback = null;
    refreshManifestRunnable = null;
    simulateManifestRefreshRunnable = null;
    manifestLoadErrorThrower = new LoaderErrorThrower.Dummy();
  } else {
    manifestCallback = new ManifestCallback();
    manifestLoadErrorThrower = new ManifestLoadErrorThrower();
    refreshManifestRunnable = this::startLoadingManifest;
    simulateManifestRefreshRunnable = () -> processManifest(false);
  }
}
 
Example #27
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private DashMediaSource(
    DashManifest manifest,
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends DashManifest> manifestParser,
    DashChunkSource.Factory chunkSourceFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    boolean livePresentationDelayOverridesManifest,
    @Nullable Object tag) {
  this.initialManifestUri = manifestUri;
  this.manifest = manifest;
  this.manifestUri = manifestUri;
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.livePresentationDelayOverridesManifest = livePresentationDelayOverridesManifest;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.tag = tag;
  sideloadedManifest = manifest != null;
  manifestEventDispatcher = createEventDispatcher(/* mediaPeriodId= */ null);
  manifestUriLock = new Object();
  periodsById = new SparseArray<>();
  playerEmsgCallback = new DefaultPlayerEmsgCallback();
  expiredManifestPublishTimeUs = C.TIME_UNSET;
  if (sideloadedManifest) {
    Assertions.checkState(!manifest.dynamic);
    manifestCallback = null;
    refreshManifestRunnable = null;
    simulateManifestRefreshRunnable = null;
    manifestLoadErrorThrower = new LoaderErrorThrower.Dummy();
  } else {
    manifestCallback = new ManifestCallback();
    manifestLoadErrorThrower = new ManifestLoadErrorThrower();
    refreshManifestRunnable = new Runnable() {
      @Override
      public void run() {
        startLoadingManifest();
      }
    };
    simulateManifestRefreshRunnable = new Runnable() {
      @Override
      public void run() {
        processManifest(false);
      }
    };
  }
}
 
Example #28
Source File: DashMediaSource.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
private DashMediaSource(
    DashManifest manifest,
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends DashManifest> manifestParser,
    DashChunkSource.Factory chunkSourceFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    long livePresentationDelayMs,
    boolean livePresentationDelayOverridesManifest,
    @Nullable Object tag) {
  this.initialManifestUri = manifestUri;
  this.manifest = manifest;
  this.manifestUri = manifestUri;
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.livePresentationDelayOverridesManifest = livePresentationDelayOverridesManifest;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.tag = tag;
  sideloadedManifest = manifest != null;
  manifestEventDispatcher = createEventDispatcher(/* mediaPeriodId= */ null);
  manifestUriLock = new Object();
  periodsById = new SparseArray<>();
  playerEmsgCallback = new DefaultPlayerEmsgCallback();
  expiredManifestPublishTimeUs = C.TIME_UNSET;
  if (sideloadedManifest) {
    Assertions.checkState(!manifest.dynamic);
    manifestCallback = null;
    refreshManifestRunnable = null;
    simulateManifestRefreshRunnable = null;
    manifestLoadErrorThrower = new LoaderErrorThrower.Dummy();
  } else {
    manifestCallback = new ManifestCallback();
    manifestLoadErrorThrower = new ManifestLoadErrorThrower();
    refreshManifestRunnable = this::startLoadingManifest;
    simulateManifestRefreshRunnable = () -> processManifest(false);
  }
}
 
Example #29
Source File: DashMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
private DashMediaSource(
    DashManifest manifest,
    Uri manifestUri,
    DataSource.Factory manifestDataSourceFactory,
    ParsingLoadable.Parser<? extends DashManifest> manifestParser,
    DashChunkSource.Factory chunkSourceFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    int minLoadableRetryCount,
    long livePresentationDelayMs,
    boolean livePresentationDelayOverridesManifest,
    @Nullable Object tag) {
  this.initialManifestUri = manifestUri;
  this.manifest = manifest;
  this.manifestUri = manifestUri;
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.minLoadableRetryCount = minLoadableRetryCount;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.livePresentationDelayOverridesManifest = livePresentationDelayOverridesManifest;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.tag = tag;
  sideloadedManifest = manifest != null;
  manifestEventDispatcher = createEventDispatcher(/* mediaPeriodId= */ null);
  manifestUriLock = new Object();
  periodsById = new SparseArray<>();
  playerEmsgCallback = new DefaultPlayerEmsgCallback();
  expiredManifestPublishTimeUs = C.TIME_UNSET;
  if (sideloadedManifest) {
    Assertions.checkState(!manifest.dynamic);
    manifestCallback = null;
    refreshManifestRunnable = null;
    simulateManifestRefreshRunnable = null;
    manifestLoadErrorThrower = new LoaderErrorThrower.Dummy();
  } else {
    manifestCallback = new ManifestCallback();
    manifestLoadErrorThrower = new ManifestLoadErrorThrower();
    refreshManifestRunnable = new Runnable() {
      @Override
      public void run() {
        startLoadingManifest();
      }
    };
    simulateManifestRefreshRunnable = new Runnable() {
      @Override
      public void run() {
        processManifest(false);
      }
    };
  }
}
 
Example #30
Source File: DashMediaSource.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
private DashMediaSource(
    @Nullable DashManifest manifest,
    @Nullable Uri manifestUri,
    @Nullable DataSource.Factory manifestDataSourceFactory,
    @Nullable ParsingLoadable.Parser<? extends DashManifest> manifestParser,
    DashChunkSource.Factory chunkSourceFactory,
    CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
    DrmSessionManager<?> drmSessionManager,
    LoadErrorHandlingPolicy loadErrorHandlingPolicy,
    long livePresentationDelayMs,
    boolean livePresentationDelayOverridesManifest,
    @Nullable Object tag) {
  this.initialManifestUri = manifestUri;
  this.manifest = manifest;
  this.manifestUri = manifestUri;
  this.manifestDataSourceFactory = manifestDataSourceFactory;
  this.manifestParser = manifestParser;
  this.chunkSourceFactory = chunkSourceFactory;
  this.drmSessionManager = drmSessionManager;
  this.loadErrorHandlingPolicy = loadErrorHandlingPolicy;
  this.livePresentationDelayMs = livePresentationDelayMs;
  this.livePresentationDelayOverridesManifest = livePresentationDelayOverridesManifest;
  this.compositeSequenceableLoaderFactory = compositeSequenceableLoaderFactory;
  this.tag = tag;
  sideloadedManifest = manifest != null;
  manifestEventDispatcher = createEventDispatcher(/* mediaPeriodId= */ null);
  manifestUriLock = new Object();
  periodsById = new SparseArray<>();
  playerEmsgCallback = new DefaultPlayerEmsgCallback();
  expiredManifestPublishTimeUs = C.TIME_UNSET;
  if (sideloadedManifest) {
    Assertions.checkState(!manifest.dynamic);
    manifestCallback = null;
    refreshManifestRunnable = null;
    simulateManifestRefreshRunnable = null;
    manifestLoadErrorThrower = new LoaderErrorThrower.Dummy();
  } else {
    manifestCallback = new ManifestCallback();
    manifestLoadErrorThrower = new ManifestLoadErrorThrower();
    refreshManifestRunnable = this::startLoadingManifest;
    simulateManifestRefreshRunnable = () -> processManifest(false);
  }
}