Add checkNotNull(uri)
to DataSpec
constructor
This check is already present in `DataSpec.Builder.build()` but there are many public constructors which bypass the builder (only some of which are deprecated), so this adds an additional check. PiperOrigin-RevId: 613908358
This commit is contained in:
parent
f4c60c52b9
commit
f9032a5893
@ -57,6 +57,8 @@
|
|||||||
where `package` is different to the package of the current application.
|
where `package` is different to the package of the current application.
|
||||||
This wasn't previously documented to work, but is a more efficient way
|
This wasn't previously documented to work, but is a more efficient way
|
||||||
of accessing resources in another package than by name.
|
of accessing resources in another package than by name.
|
||||||
|
* Eagerly check `url` is non-null in the `DataSpec` constructors. This
|
||||||
|
parameter was already annotated to be non-null.
|
||||||
* Effect:
|
* Effect:
|
||||||
* Improved PQ to SDR tone-mapping by converting color spaces.
|
* Improved PQ to SDR tone-mapping by converting color spaces.
|
||||||
* Support multiple speed changes within the same `EditedMediaItem` or
|
* Support multiple speed changes within the same `EditedMediaItem` or
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.datasource;
|
package androidx.media3.datasource;
|
||||||
|
|
||||||
|
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||||
import static java.lang.annotation.ElementType.TYPE_USE;
|
import static java.lang.annotation.ElementType.TYPE_USE;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@ -473,7 +474,7 @@ public final class DataSpec {
|
|||||||
Assertions.checkArgument(uriPositionOffset + position >= 0);
|
Assertions.checkArgument(uriPositionOffset + position >= 0);
|
||||||
Assertions.checkArgument(position >= 0);
|
Assertions.checkArgument(position >= 0);
|
||||||
Assertions.checkArgument(length > 0 || length == C.LENGTH_UNSET);
|
Assertions.checkArgument(length > 0 || length == C.LENGTH_UNSET);
|
||||||
this.uri = uri;
|
this.uri = checkNotNull(uri);
|
||||||
this.uriPositionOffset = uriPositionOffset;
|
this.uriPositionOffset = uriPositionOffset;
|
||||||
this.httpMethod = httpMethod;
|
this.httpMethod = httpMethod;
|
||||||
this.httpBody = httpBody != null && httpBody.length != 0 ? httpBody : null;
|
this.httpBody = httpBody != null && httpBody.length != 0 ? httpBody : null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user