Merge pull request #7010 from dbrain:fix_nullability
PiperOrigin-RevId: 297187116
This commit is contained in:
commit
46ebaff965
@ -270,8 +270,8 @@ public final class DownloadHelper {
|
|||||||
* @param dataSourceFactory A {@link DataSource.Factory} used to load the manifest.
|
* @param dataSourceFactory A {@link DataSource.Factory} used to load the manifest.
|
||||||
* @param renderersFactory A {@link RenderersFactory} creating the renderers for which tracks are
|
* @param renderersFactory A {@link RenderersFactory} creating the renderers for which tracks are
|
||||||
* selected.
|
* selected.
|
||||||
* @param drmSessionManager An optional {@link DrmSessionManager} used by the renderers created by
|
* @param drmSessionManager An optional {@link DrmSessionManager}. Used to help determine which
|
||||||
* {@code renderersFactory}.
|
* tracks can be selected.
|
||||||
* @param trackSelectorParameters {@link DefaultTrackSelector.Parameters} for selecting tracks for
|
* @param trackSelectorParameters {@link DefaultTrackSelector.Parameters} for selecting tracks for
|
||||||
* downloading.
|
* downloading.
|
||||||
* @return A {@link DownloadHelper} for DASH streams.
|
* @return A {@link DownloadHelper} for DASH streams.
|
||||||
@ -340,8 +340,8 @@ public final class DownloadHelper {
|
|||||||
* @param dataSourceFactory A {@link DataSource.Factory} used to load the playlist.
|
* @param dataSourceFactory A {@link DataSource.Factory} used to load the playlist.
|
||||||
* @param renderersFactory A {@link RenderersFactory} creating the renderers for which tracks are
|
* @param renderersFactory A {@link RenderersFactory} creating the renderers for which tracks are
|
||||||
* selected.
|
* selected.
|
||||||
* @param drmSessionManager An optional {@link DrmSessionManager} used by the renderers created by
|
* @param drmSessionManager An optional {@link DrmSessionManager}. Used to help determine which
|
||||||
* {@code renderersFactory}.
|
* tracks can be selected.
|
||||||
* @param trackSelectorParameters {@link DefaultTrackSelector.Parameters} for selecting tracks for
|
* @param trackSelectorParameters {@link DefaultTrackSelector.Parameters} for selecting tracks for
|
||||||
* downloading.
|
* downloading.
|
||||||
* @return A {@link DownloadHelper} for HLS streams.
|
* @return A {@link DownloadHelper} for HLS streams.
|
||||||
@ -410,8 +410,8 @@ public final class DownloadHelper {
|
|||||||
* @param dataSourceFactory A {@link DataSource.Factory} used to load the manifest.
|
* @param dataSourceFactory A {@link DataSource.Factory} used to load the manifest.
|
||||||
* @param renderersFactory A {@link RenderersFactory} creating the renderers for which tracks are
|
* @param renderersFactory A {@link RenderersFactory} creating the renderers for which tracks are
|
||||||
* selected.
|
* selected.
|
||||||
* @param drmSessionManager An optional {@link DrmSessionManager} used by the renderers created by
|
* @param drmSessionManager An optional {@link DrmSessionManager}. Used to help determine which
|
||||||
* {@code renderersFactory}.
|
* tracks can be selected.
|
||||||
* @param trackSelectorParameters {@link DefaultTrackSelector.Parameters} for selecting tracks for
|
* @param trackSelectorParameters {@link DefaultTrackSelector.Parameters} for selecting tracks for
|
||||||
* downloading.
|
* downloading.
|
||||||
* @return A {@link DownloadHelper} for SmoothStreaming streams.
|
* @return A {@link DownloadHelper} for SmoothStreaming streams.
|
||||||
@ -439,27 +439,27 @@ public final class DownloadHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalent to {@link #createMediaSource(DownloadRequest, Factory, DrmSessionManager)
|
* Equivalent to {@link #createMediaSource(DownloadRequest, Factory, DrmSessionManager)
|
||||||
* createMediaSource(downloadRequest, dataSourceFactory,
|
* createMediaSource(downloadRequest, dataSourceFactory, null)}.
|
||||||
* DrmSessionManager.getDummyDrmSessionManager())}.
|
|
||||||
*/
|
*/
|
||||||
public static MediaSource createMediaSource(
|
public static MediaSource createMediaSource(
|
||||||
DownloadRequest downloadRequest, DataSource.Factory dataSourceFactory) {
|
DownloadRequest downloadRequest, DataSource.Factory dataSourceFactory) {
|
||||||
return createMediaSource(
|
return createMediaSource(downloadRequest, dataSourceFactory, /* drmSessionManager= */ null);
|
||||||
downloadRequest, dataSourceFactory, DrmSessionManager.getDummyDrmSessionManager());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method to create a MediaSource which only contains the tracks defined in {@code
|
* Utility method to create a {@link MediaSource} that only exposes the tracks defined in {@code
|
||||||
* downloadRequest}.
|
* downloadRequest}.
|
||||||
*
|
*
|
||||||
* @param downloadRequest A {@link DownloadRequest}.
|
* @param downloadRequest A {@link DownloadRequest}.
|
||||||
* @param dataSourceFactory A factory for {@link DataSource}s to read the media.
|
* @param dataSourceFactory A factory for {@link DataSource}s to read the media.
|
||||||
* @return A MediaSource which only contains the tracks defined in {@code downloadRequest}.
|
* @param drmSessionManager An optional {@link DrmSessionManager} to be passed to the {@link
|
||||||
|
* MediaSource}.
|
||||||
|
* @return A {@link MediaSource} that only exposes the tracks defined in {@code downloadRequest}.
|
||||||
*/
|
*/
|
||||||
public static MediaSource createMediaSource(
|
public static MediaSource createMediaSource(
|
||||||
DownloadRequest downloadRequest,
|
DownloadRequest downloadRequest,
|
||||||
DataSource.Factory dataSourceFactory,
|
DataSource.Factory dataSourceFactory,
|
||||||
DrmSessionManager<?> drmSessionManager) {
|
@Nullable DrmSessionManager<?> drmSessionManager) {
|
||||||
@Nullable Constructor<? extends MediaSourceFactory> constructor;
|
@Nullable Constructor<? extends MediaSourceFactory> constructor;
|
||||||
switch (downloadRequest.type) {
|
switch (downloadRequest.type) {
|
||||||
case DownloadRequest.TYPE_DASH:
|
case DownloadRequest.TYPE_DASH:
|
||||||
|
@ -595,7 +595,7 @@ public abstract class DownloadService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(@Nullable Intent intent, int flags, int startId) {
|
||||||
lastStartId = startId;
|
lastStartId = startId;
|
||||||
taskRemoved = false;
|
taskRemoved = false;
|
||||||
@Nullable String intentAction = null;
|
@Nullable String intentAction = null;
|
||||||
@ -617,7 +617,9 @@ public abstract class DownloadService extends Service {
|
|||||||
// Do nothing.
|
// Do nothing.
|
||||||
break;
|
break;
|
||||||
case ACTION_ADD_DOWNLOAD:
|
case ACTION_ADD_DOWNLOAD:
|
||||||
@Nullable DownloadRequest downloadRequest = intent.getParcelableExtra(KEY_DOWNLOAD_REQUEST);
|
@Nullable
|
||||||
|
DownloadRequest downloadRequest =
|
||||||
|
Assertions.checkNotNull(intent).getParcelableExtra(KEY_DOWNLOAD_REQUEST);
|
||||||
if (downloadRequest == null) {
|
if (downloadRequest == null) {
|
||||||
Log.e(TAG, "Ignored ADD_DOWNLOAD: Missing " + KEY_DOWNLOAD_REQUEST + " extra");
|
Log.e(TAG, "Ignored ADD_DOWNLOAD: Missing " + KEY_DOWNLOAD_REQUEST + " extra");
|
||||||
} else {
|
} else {
|
||||||
@ -642,7 +644,7 @@ public abstract class DownloadService extends Service {
|
|||||||
downloadManager.pauseDownloads();
|
downloadManager.pauseDownloads();
|
||||||
break;
|
break;
|
||||||
case ACTION_SET_STOP_REASON:
|
case ACTION_SET_STOP_REASON:
|
||||||
if (!intent.hasExtra(KEY_STOP_REASON)) {
|
if (!Assertions.checkNotNull(intent).hasExtra(KEY_STOP_REASON)) {
|
||||||
Log.e(TAG, "Ignored SET_STOP_REASON: Missing " + KEY_STOP_REASON + " extra");
|
Log.e(TAG, "Ignored SET_STOP_REASON: Missing " + KEY_STOP_REASON + " extra");
|
||||||
} else {
|
} else {
|
||||||
int stopReason = intent.getIntExtra(KEY_STOP_REASON, /* defaultValue= */ 0);
|
int stopReason = intent.getIntExtra(KEY_STOP_REASON, /* defaultValue= */ 0);
|
||||||
@ -650,7 +652,9 @@ public abstract class DownloadService extends Service {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_SET_REQUIREMENTS:
|
case ACTION_SET_REQUIREMENTS:
|
||||||
@Nullable Requirements requirements = intent.getParcelableExtra(KEY_REQUIREMENTS);
|
@Nullable
|
||||||
|
Requirements requirements =
|
||||||
|
Assertions.checkNotNull(intent).getParcelableExtra(KEY_REQUIREMENTS);
|
||||||
if (requirements == null) {
|
if (requirements == null) {
|
||||||
Log.e(TAG, "Ignored SET_REQUIREMENTS: Missing " + KEY_REQUIREMENTS + " extra");
|
Log.e(TAG, "Ignored SET_REQUIREMENTS: Missing " + KEY_REQUIREMENTS + " extra");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user