Java Code Examples for com.google.android.exoplayer2.util.Assertions#checkNotNull()

The following examples show how to use com.google.android.exoplayer2.util.Assertions#checkNotNull() . 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: FfmpegDecoder.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public FfmpegDecoder(
    int numInputBuffers,
    int numOutputBuffers,
    int initialInputBufferSize,
    Format format,
    boolean outputFloat)
    throws FfmpegDecoderException {
  super(new DecoderInputBuffer[numInputBuffers], new SimpleOutputBuffer[numOutputBuffers]);
  Assertions.checkNotNull(format.sampleMimeType);
  codecName =
      Assertions.checkNotNull(
          FfmpegLibrary.getCodecName(format.sampleMimeType, format.pcmEncoding));
  extraData = getExtraData(format.sampleMimeType, format.initializationData);
  encoding = outputFloat ? C.ENCODING_PCM_FLOAT : C.ENCODING_PCM_16BIT;
  outputBufferSize = outputFloat ? OUTPUT_BUFFER_SIZE_32BIT : OUTPUT_BUFFER_SIZE_16BIT;
  nativeContext =
      ffmpegInitialize(codecName, extraData, outputFloat, format.sampleRate, format.channelCount);
  if (nativeContext == 0) {
    throw new FfmpegDecoderException("Initialization failed.");
  }
  setInitialInputBufferSize(initialInputBufferSize);
}
 
Example 2
Source File: CacheFileMetadataIndex.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Removes metadata.
 *
 * @param names The names of the files whose metadata is to be removed.
 * @throws DatabaseIOException If an error occurs removing the metadata.
 */
public void removeAll(Set<String> names) throws DatabaseIOException {
  Assertions.checkNotNull(tableName);
  try {
    SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
    writableDatabase.beginTransaction();
    try {
      for (String name : names) {
        writableDatabase.delete(tableName, WHERE_NAME_EQUALS, new String[] {name});
      }
      writableDatabase.setTransactionSuccessful();
    } finally {
      writableDatabase.endTransaction();
    }
  } catch (SQLException e) {
    throw new DatabaseIOException(e);
  }
}
 
Example 3
Source File: Id3Decoder.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("ByteBufferBackingArray")
@Override
@Nullable
public Metadata decode(MetadataInputBuffer inputBuffer) {
  ByteBuffer buffer = Assertions.checkNotNull(inputBuffer.data);
  return decode(buffer.array(), buffer.limit());
}
 
Example 4
Source File: MediaSourceEventListener.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/** Dispatches {@link #onUpstreamDiscarded(int, MediaPeriodId, MediaLoadData)}. */
public void upstreamDiscarded(MediaLoadData mediaLoadData) {
  MediaPeriodId mediaPeriodId = Assertions.checkNotNull(this.mediaPeriodId);
  for (ListenerAndHandler listenerAndHandler : listenerAndHandlers) {
    final MediaSourceEventListener listener = listenerAndHandler.listener;
    postOrRun(
        listenerAndHandler.handler,
        () -> listener.onUpstreamDiscarded(windowIndex, mediaPeriodId, mediaLoadData));
  }
}
 
Example 5
Source File: DefaultTrackSelector.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Atomically sets the provided parameters for track selection.
 *
 * @param parameters The parameters for track selection.
 */
public void setParameters(Parameters parameters) {
  Assertions.checkNotNull(parameters);
  if (!parametersReference.getAndSet(parameters).equals(parameters)) {
    invalidate();
  }
}
 
Example 6
Source File: HlsMediaChunk.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * If the segment is fully encrypted, returns an {@link Aes128DataSource} that wraps the original
 * in order to decrypt the loaded data. Else returns the original.
 *
 * <p>{@code fullSegmentEncryptionKey} & {@code encryptionIv} can either both be null, or neither.
 */
private static DataSource buildDataSource(
    DataSource dataSource,
    @Nullable byte[] fullSegmentEncryptionKey,
    @Nullable byte[] encryptionIv) {
  if (fullSegmentEncryptionKey != null) {
    Assertions.checkNotNull(encryptionIv);
    return new Aes128DataSource(dataSource, fullSegmentEncryptionKey, encryptionIv);
  }
  return dataSource;
}
 
Example 7
Source File: MetadataRenderer.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param output The output.
 * @param outputLooper The looper associated with the thread on which the output should be called.
 *     If the output makes use of standard Android UI components, then this should normally be the
 *     looper associated with the application's main thread, which can be obtained using {@link
 *     android.app.Activity#getMainLooper()}. Null may be passed if the output should be called
 *     directly on the player's internal rendering thread.
 * @param decoderFactory A factory from which to obtain {@link MetadataDecoder} instances.
 */
public MetadataRenderer(
    MetadataOutput output, @Nullable Looper outputLooper, MetadataDecoderFactory decoderFactory) {
  super(C.TRACK_TYPE_METADATA);
  this.output = Assertions.checkNotNull(output);
  this.outputHandler =
      outputLooper == null ? null : Util.createHandler(outputLooper, /* callback= */ this);
  this.decoderFactory = Assertions.checkNotNull(decoderFactory);
  formatHolder = new FormatHolder();
  buffer = new MetadataInputBuffer();
  pendingMetadata = new Metadata[MAX_PENDING_METADATA_COUNT];
  pendingMetadataTimestamps = new long[MAX_PENDING_METADATA_COUNT];
}
 
Example 8
Source File: DefaultDrmSessionManager.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param uuid The UUID of the drm scheme.
 * @param mediaDrm An underlying {@link ExoMediaDrm} for use by the manager.
 * @param callback Performs key and provisioning requests.
 * @param optionalKeyRequestParameters An optional map of parameters to pass as the last argument
 *     to {@link ExoMediaDrm#getKeyRequest(byte[], List, int, HashMap)}. May be null.
 * @param multiSession A boolean that specify whether multiple key session support is enabled.
 *     Default is false.
 * @param initialDrmRequestRetryCount The number of times to retry for initial provisioning and
 *     key request before reporting error.
 */
public DefaultDrmSessionManager(
    UUID uuid,
    ExoMediaDrm<T> mediaDrm,
    MediaDrmCallback callback,
    @Nullable HashMap<String, String> optionalKeyRequestParameters,
    boolean multiSession,
    int initialDrmRequestRetryCount) {
  Assertions.checkNotNull(uuid);
  Assertions.checkNotNull(mediaDrm);
  Assertions.checkArgument(!C.COMMON_PSSH_UUID.equals(uuid), "Use C.CLEARKEY_UUID instead");
  this.uuid = uuid;
  this.mediaDrm = mediaDrm;
  this.callback = callback;
  this.optionalKeyRequestParameters = optionalKeyRequestParameters;
  this.eventDispatcher = new EventDispatcher<>();
  this.multiSession = multiSession;
  this.initialDrmRequestRetryCount = initialDrmRequestRetryCount;
  mode = MODE_PLAYBACK;
  sessions = new ArrayList<>();
  provisioningSessions = new ArrayList<>();
  if (multiSession && C.WIDEVINE_UUID.equals(uuid) && Util.SDK_INT >= 19) {
    // TODO: Enabling session sharing probably doesn't do anything useful here. It would only be
    // useful if DefaultDrmSession instances were aware of one another's state, which is not
    // implemented. Or if custom renderers are being used that allow playback to proceed before
    // keys, which seems unlikely to be true in practice.
    mediaDrm.setPropertyString("sessionSharing", "enable");
  }
  mediaDrm.setOnEventListener(new MediaDrmEventListener());
}
 
Example 9
Source File: OfflineLicenseHelper.java    From K-Sonic with MIT License 5 votes vote down vote up
/**
 * Returns license and playback durations remaining in seconds of the given offline license.
 *
 * @param offlineLicenseKeySetId The key set id of the license.
 */
public Pair<Long, Long> getLicenseDurationRemainingSec(byte[] offlineLicenseKeySetId)
    throws DrmSessionException {
  Assertions.checkNotNull(offlineLicenseKeySetId);
  DrmSession<T> session = openBlockingKeyRequest(DefaultDrmSessionManager.MODE_QUERY,
      offlineLicenseKeySetId, null);
  Pair<Long, Long> licenseDurationRemainingSec =
      WidevineUtil.getLicenseDurationRemainingSec(drmSessionManager);
  drmSessionManager.releaseSession(session);
  return licenseDurationRemainingSec;
}
 
Example 10
Source File: SimpleCache.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public synchronized void releaseHoleSpan(CacheSpan holeSpan) {
  Assertions.checkState(!released);
  CachedContent cachedContent = contentIndex.get(holeSpan.key);
  Assertions.checkNotNull(cachedContent);
  Assertions.checkState(cachedContent.isLocked());
  cachedContent.setLocked(false);
  contentIndex.maybeRemove(cachedContent.key);
  notifyAll();
}
 
Example 11
Source File: HlsMediaSource.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new factory for {@link HlsMediaSource}s.
 *
 * @param hlsDataSourceFactory An {@link HlsDataSourceFactory} for {@link DataSource}s for
 *     manifests, segments and keys.
 */
public Factory(HlsDataSourceFactory hlsDataSourceFactory) {
  this.hlsDataSourceFactory = Assertions.checkNotNull(hlsDataSourceFactory);
  playlistParserFactory = new DefaultHlsPlaylistParserFactory();
  playlistTrackerFactory = DefaultHlsPlaylistTracker.FACTORY;
  extractorFactory = HlsExtractorFactory.DEFAULT;
  loadErrorHandlingPolicy = new DefaultLoadErrorHandlingPolicy();
  compositeSequenceableLoaderFactory = new DefaultCompositeSequenceableLoaderFactory();
  metadataType = HlsMetadataType.ID3;
}
 
Example 12
Source File: CacheFileMetadataIndex.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
/**
 * Removes metadata.
 *
 * <p>This method may be slow and shouldn't normally be called on the main thread.
 *
 * @param name The name of the file whose metadata is to be removed.
 * @throws DatabaseIOException If an error occurs removing the metadata.
 */
@WorkerThread
public void remove(String name) throws DatabaseIOException {
  Assertions.checkNotNull(tableName);
  try {
    SQLiteDatabase writableDatabase = databaseProvider.getWritableDatabase();
    writableDatabase.delete(tableName, WHERE_NAME_EQUALS, new String[] {name});
  } catch (SQLException e) {
    throw new DatabaseIOException(e);
  }
}
 
Example 13
Source File: DefaultHttpDataSource.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void clearRequestProperty(String name) {
  Assertions.checkNotNull(name);
  requestProperties.remove(name);
}
 
Example 14
Source File: HlsMediaPeriod.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@Override
public long selectTracks(
    @NullableType TrackSelection[] selections,
    boolean[] mayRetainStreamFlags,
    @NullableType SampleStream[] streams,
    boolean[] streamResetFlags,
    long positionUs) {
  // Map each selection and stream onto a child period index.
  int[] streamChildIndices = new int[selections.length];
  int[] selectionChildIndices = new int[selections.length];
  for (int i = 0; i < selections.length; i++) {
    streamChildIndices[i] = streams[i] == null ? C.INDEX_UNSET
        : streamWrapperIndices.get(streams[i]);
    selectionChildIndices[i] = C.INDEX_UNSET;
    if (selections[i] != null) {
      TrackGroup trackGroup = selections[i].getTrackGroup();
      for (int j = 0; j < sampleStreamWrappers.length; j++) {
        if (sampleStreamWrappers[j].getTrackGroups().indexOf(trackGroup) != C.INDEX_UNSET) {
          selectionChildIndices[i] = j;
          break;
        }
      }
    }
  }

  boolean forceReset = false;
  streamWrapperIndices.clear();
  // Select tracks for each child, copying the resulting streams back into a new streams array.
  SampleStream[] newStreams = new SampleStream[selections.length];
  @NullableType SampleStream[] childStreams = new SampleStream[selections.length];
  @NullableType TrackSelection[] childSelections = new TrackSelection[selections.length];
  int newEnabledSampleStreamWrapperCount = 0;
  HlsSampleStreamWrapper[] newEnabledSampleStreamWrappers =
      new HlsSampleStreamWrapper[sampleStreamWrappers.length];
  for (int i = 0; i < sampleStreamWrappers.length; i++) {
    for (int j = 0; j < selections.length; j++) {
      childStreams[j] = streamChildIndices[j] == i ? streams[j] : null;
      childSelections[j] = selectionChildIndices[j] == i ? selections[j] : null;
    }
    HlsSampleStreamWrapper sampleStreamWrapper = sampleStreamWrappers[i];
    boolean wasReset = sampleStreamWrapper.selectTracks(childSelections, mayRetainStreamFlags,
        childStreams, streamResetFlags, positionUs, forceReset);
    boolean wrapperEnabled = false;
    for (int j = 0; j < selections.length; j++) {
      SampleStream childStream = childStreams[j];
      if (selectionChildIndices[j] == i) {
        // Assert that the child provided a stream for the selection.
        Assertions.checkNotNull(childStream);
        newStreams[j] = childStream;
        wrapperEnabled = true;
        streamWrapperIndices.put(childStream, i);
      } else if (streamChildIndices[j] == i) {
        // Assert that the child cleared any previous stream.
        Assertions.checkState(childStream == null);
      }
    }
    if (wrapperEnabled) {
      newEnabledSampleStreamWrappers[newEnabledSampleStreamWrapperCount] = sampleStreamWrapper;
      if (newEnabledSampleStreamWrapperCount++ == 0) {
        // The first enabled wrapper is responsible for initializing timestamp adjusters. This
        // way, if enabled, variants are responsible. Else audio renditions. Else text renditions.
        sampleStreamWrapper.setIsTimestampMaster(true);
        if (wasReset || enabledSampleStreamWrappers.length == 0
            || sampleStreamWrapper != enabledSampleStreamWrappers[0]) {
          // The wrapper responsible for initializing the timestamp adjusters was reset or
          // changed. We need to reset the timestamp adjuster provider and all other wrappers.
          timestampAdjusterProvider.reset();
          forceReset = true;
        }
      } else {
        sampleStreamWrapper.setIsTimestampMaster(false);
      }
    }
  }
  // Copy the new streams back into the streams array.
  System.arraycopy(newStreams, 0, streams, 0, newStreams.length);
  // Update the local state.
  enabledSampleStreamWrappers =
      Util.nullSafeArrayCopy(newEnabledSampleStreamWrappers, newEnabledSampleStreamWrapperCount);
  compositeSequenceableLoader =
      compositeSequenceableLoaderFactory.createCompositeSequenceableLoader(
          enabledSampleStreamWrappers);
  return positionUs;
}
 
Example 15
Source File: BinarySearchSeeker.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Continues to handle the pending seek operation. Returns one of the {@code RESULT_} values from
 * {@link Extractor}.
 *
 * @param input The {@link ExtractorInput} from which data should be read.
 * @param seekPositionHolder If {@link Extractor#RESULT_SEEK} is returned, this holder is updated
 *     to hold the position of the required seek.
 * @param outputFrameHolder If {@link Extractor#RESULT_CONTINUE} is returned, this holder may be
 *     updated to hold the extracted frame that contains the target sample. The caller needs to
 *     check the byte buffer limit to see if an extracted frame is available.
 * @return One of the {@code RESULT_} values defined in {@link Extractor}.
 * @throws IOException If an error occurred reading from the input.
 * @throws InterruptedException If the thread was interrupted.
 */
public int handlePendingSeek(
    ExtractorInput input, PositionHolder seekPositionHolder, OutputFrameHolder outputFrameHolder)
    throws InterruptedException, IOException {
  TimestampSeeker timestampSeeker = Assertions.checkNotNull(this.timestampSeeker);
  while (true) {
    SeekOperationParams seekOperationParams = Assertions.checkNotNull(this.seekOperationParams);
    long floorPosition = seekOperationParams.getFloorBytePosition();
    long ceilingPosition = seekOperationParams.getCeilingBytePosition();
    long searchPosition = seekOperationParams.getNextSearchBytePosition();

    if (ceilingPosition - floorPosition <= minimumSearchRange) {
      // The seeking range is too small, so we can just continue from the floor position.
      markSeekOperationFinished(/* foundTargetFrame= */ false, floorPosition);
      return seekToPosition(input, floorPosition, seekPositionHolder);
    }
    if (!skipInputUntilPosition(input, searchPosition)) {
      return seekToPosition(input, searchPosition, seekPositionHolder);
    }

    input.resetPeekPosition();
    TimestampSearchResult timestampSearchResult =
        timestampSeeker.searchForTimestamp(
            input, seekOperationParams.getTargetTimePosition(), outputFrameHolder);

    switch (timestampSearchResult.result) {
      case TimestampSearchResult.RESULT_POSITION_OVERESTIMATED:
        seekOperationParams.updateSeekCeiling(
            timestampSearchResult.timestampToUpdate, timestampSearchResult.bytePositionToUpdate);
        break;
      case TimestampSearchResult.RESULT_POSITION_UNDERESTIMATED:
        seekOperationParams.updateSeekFloor(
            timestampSearchResult.timestampToUpdate, timestampSearchResult.bytePositionToUpdate);
        break;
      case TimestampSearchResult.RESULT_TARGET_TIMESTAMP_FOUND:
        markSeekOperationFinished(
            /* foundTargetFrame= */ true, timestampSearchResult.bytePositionToUpdate);
        skipInputUntilPosition(input, timestampSearchResult.bytePositionToUpdate);
        return seekToPosition(
            input, timestampSearchResult.bytePositionToUpdate, seekPositionHolder);
      case TimestampSearchResult.RESULT_NO_TIMESTAMP:
        // We can't find any timestamp in the search range from the search position.
        // Give up, and just continue reading from the last search position in this case.
        markSeekOperationFinished(/* foundTargetFrame= */ false, searchPosition);
        return seekToPosition(input, searchPosition, seekPositionHolder);
      default:
        throw new IllegalStateException("Invalid case");
    }
  }
}
 
Example 16
Source File: DefaultDrmSession.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@RequiresNonNull("sessionId")
private void doLicense(boolean allowRetry) {
  switch (mode) {
    case DefaultDrmSessionManager.MODE_PLAYBACK:
    case DefaultDrmSessionManager.MODE_QUERY:
      if (offlineLicenseKeySetId == null) {
        postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_STREAMING, allowRetry);
      } else if (state == STATE_OPENED_WITH_KEYS || restoreKeys()) {
        long licenseDurationRemainingSec = getLicenseDurationRemainingSec();
        if (mode == DefaultDrmSessionManager.MODE_PLAYBACK
            && licenseDurationRemainingSec <= MAX_LICENSE_DURATION_TO_RENEW) {
          Log.d(TAG, "Offline license has expired or will expire soon. "
              + "Remaining seconds: " + licenseDurationRemainingSec);
          postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_OFFLINE, allowRetry);
        } else if (licenseDurationRemainingSec <= 0) {
          onError(new KeysExpiredException());
        } else {
          state = STATE_OPENED_WITH_KEYS;
          eventDispatcher.dispatch(DefaultDrmSessionEventListener::onDrmKeysRestored);
        }
      }
      break;
    case DefaultDrmSessionManager.MODE_DOWNLOAD:
      if (offlineLicenseKeySetId == null) {
        postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_OFFLINE, allowRetry);
      } else {
        // Renew
        if (restoreKeys()) {
          postKeyRequest(sessionId, ExoMediaDrm.KEY_TYPE_OFFLINE, allowRetry);
        }
      }
      break;
    case DefaultDrmSessionManager.MODE_RELEASE:
      Assertions.checkNotNull(offlineLicenseKeySetId);
      // It's not necessary to restore the key (and open a session to do that) before releasing it
      // but this serves as a good sanity/fast-failure check.
      if (restoreKeys()) {
        postKeyRequest(offlineLicenseKeySetId, ExoMediaDrm.KEY_TYPE_RELEASE, allowRetry);
      }
      break;
    default:
      break;
  }
}
 
Example 17
Source File: ClippingMediaSource.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a new clipping source that wraps the specified source.
 *
 * <p>If the start point is guaranteed to be a key frame, pass {@code false} to {@code
 * enableInitialPositionDiscontinuity} to suppress an initial discontinuity when a period is first
 * read from.
 *
 * <p>For live streams, if the clipping positions should move with the live window, pass {@code
 * true} to {@code allowDynamicClippingUpdates}. Otherwise, the live stream ends when the playback
 * reaches {@code endPositionUs} in the last reported live window at the time a media period was
 * created.
 *
 * @param mediaSource The single-period source to wrap.
 * @param startPositionUs The start position at which to start providing samples, in microseconds.
 *     If {@code relativeToDefaultPosition} is {@code false}, this position is relative to the
 *     start of the window in {@code mediaSource}'s timeline. If {@code relativeToDefaultPosition}
 *     is {@code true}, this position is relative to the default position in the window in {@code
 *     mediaSource}'s timeline.
 * @param endPositionUs The end position at which to stop providing samples, in microseconds.
 *     Specify {@link C#TIME_END_OF_SOURCE} to provide samples from the specified start point up
 *     to the end of the source. Specifying a position that exceeds the {@code mediaSource}'s
 *     duration will also result in the end of the source not being clipped. If {@code
 *     relativeToDefaultPosition} is {@code false}, the specified position is relative to the
 *     start of the window in {@code mediaSource}'s timeline. If {@code relativeToDefaultPosition}
 *     is {@code true}, this position is relative to the default position in the window in {@code
 *     mediaSource}'s timeline.
 * @param enableInitialDiscontinuity Whether the initial discontinuity should be enabled.
 * @param allowDynamicClippingUpdates Whether the clipping of active media periods moves with a
 *     live window. If {@code false}, playback ends when it reaches {@code endPositionUs} in the
 *     last reported live window at the time a media period was created.
 * @param relativeToDefaultPosition Whether {@code startPositionUs} and {@code endPositionUs} are
 *     relative to the default position in the window in {@code mediaSource}'s timeline.
 */
public ClippingMediaSource(
    MediaSource mediaSource,
    long startPositionUs,
    long endPositionUs,
    boolean enableInitialDiscontinuity,
    boolean allowDynamicClippingUpdates,
    boolean relativeToDefaultPosition) {
  Assertions.checkArgument(startPositionUs >= 0);
  this.mediaSource = Assertions.checkNotNull(mediaSource);
  startUs = startPositionUs;
  endUs = endPositionUs;
  this.enableInitialDiscontinuity = enableInitialDiscontinuity;
  this.allowDynamicClippingUpdates = allowDynamicClippingUpdates;
  this.relativeToDefaultPosition = relativeToDefaultPosition;
  mediaPeriods = new ArrayList<>();
  window = new Timeline.Window();
}
 
Example 18
Source File: SsMediaSource.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Sets the manifest parser to parse loaded manifest data when loading a manifest URI.
 *
 * @param manifestParser A parser for loaded manifest data.
 * @return This factory, for convenience.
 * @throws IllegalStateException If one of the {@code create} methods has already been called.
 */
public Factory setManifestParser(ParsingLoadable.Parser<? extends SsManifest> manifestParser) {
  Assertions.checkState(!isCreateCalled);
  this.manifestParser = Assertions.checkNotNull(manifestParser);
  return this;
}
 
Example 19
Source File: VideoRendererEventListener.java    From K-Sonic with MIT License 2 votes vote down vote up
/**
 * @param handler A handler for dispatching events, or null if creating a dummy instance.
 * @param listener The listener to which events should be dispatched, or null if creating a
 *     dummy instance.
 */
public EventDispatcher(Handler handler, VideoRendererEventListener listener) {
  this.handler = listener != null ? Assertions.checkNotNull(handler) : null;
  this.listener = listener;
}
 
Example 20
Source File: ExoPlaybackException.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Retrieves the underlying error when {@link #type} is {@link #TYPE_OUT_OF_MEMORY}.
 *
 * @throws IllegalStateException If {@link #type} is not {@link #TYPE_OUT_OF_MEMORY}.
 */
public OutOfMemoryError getOutOfMemoryError() {
  Assertions.checkState(type == TYPE_OUT_OF_MEMORY);
  return (OutOfMemoryError) Assertions.checkNotNull(cause);
}