Move HttpEngineDataSource to the DataSource library.
Since HttpEngineDataSource does not have any external dependencies, it does not need to be in its own package. PiperOrigin-RevId: 592623750
This commit is contained in:
parent
e25e497227
commit
250fc80419
@ -41,6 +41,9 @@
|
||||
in an `IllegalArgumentException`
|
||||
([#888](https://github.com/androidx/media/issues/888)).
|
||||
* Support adaptive media sources with `PreloadMediaSource`.
|
||||
* Implement `HttpEngineDataSource`, an `HttpDataSource` using the
|
||||
[HttpEngine](https://developer.android.com/reference/android/net/http/HttpEngine)
|
||||
API.
|
||||
* Transformer:
|
||||
* Add support for flattening H.265/HEVC SEF slow motion videos.
|
||||
* Increase transmuxing speed, especially for 'remove video' edits.
|
||||
@ -116,10 +119,6 @@
|
||||
* Downloads:
|
||||
* OkHttp Extension:
|
||||
* Cronet Extension:
|
||||
* HttpEngine Extension:
|
||||
* Implement `HttpEngineDataSource`, an `HttpDataSource` using the
|
||||
[HttpEngine](https://developer.android.com/reference/android/net/http/HttpEngine)
|
||||
API.
|
||||
* RTMP Extension:
|
||||
* HLS Extension:
|
||||
* Reduce `HlsMediaPeriod` to package-private visibility. This type
|
||||
|
@ -19,6 +19,7 @@
|
||||
package="androidx.media3.datasource.test">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-sdk/>
|
||||
|
||||
<application
|
||||
|
@ -13,11 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.datasource.httpengine;
|
||||
package androidx.media3.datasource;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.net.http.HttpEngine;
|
||||
import androidx.media3.datasource.DataSource;
|
||||
import androidx.media3.test.utils.DataSourceContractTest;
|
||||
import androidx.media3.test.utils.HttpDataSourceTestEnv;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.datasource.httpengine;
|
||||
package androidx.media3.datasource;
|
||||
|
||||
import static java.lang.Math.min;
|
||||
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.datasource.httpengine;
|
||||
package androidx.media3.datasource;
|
||||
|
||||
import static android.net.http.UrlRequest.REQUEST_PRIORITY_MEDIUM;
|
||||
import static androidx.media3.common.util.Util.castNonNull;
|
||||
@ -38,16 +38,9 @@ import androidx.media3.common.util.Clock;
|
||||
import androidx.media3.common.util.ConditionVariable;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.common.util.Util;
|
||||
import androidx.media3.datasource.BaseDataSource;
|
||||
import androidx.media3.datasource.DataSource;
|
||||
import androidx.media3.datasource.DataSourceException;
|
||||
import androidx.media3.datasource.DataSpec;
|
||||
import androidx.media3.datasource.HttpDataSource;
|
||||
import androidx.media3.datasource.HttpDataSource.CleartextNotPermittedException;
|
||||
import androidx.media3.datasource.HttpDataSource.HttpDataSourceException;
|
||||
import androidx.media3.datasource.HttpDataSource.InvalidResponseCodeException;
|
||||
import androidx.media3.datasource.HttpUtil;
|
||||
import androidx.media3.datasource.TransferListener;
|
||||
import com.google.common.base.Ascii;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.net.HttpHeaders;
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.datasource.httpengine;
|
||||
package androidx.media3.datasource;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.times;
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package androidx.media3.datasource.httpengine;
|
||||
package androidx.media3.datasource;
|
||||
|
||||
import static android.net.http.NetworkException.ERROR_HOSTNAME_NOT_RESOLVED;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
@ -42,11 +42,8 @@ import android.os.ConditionVariable;
|
||||
import android.os.SystemClock;
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.util.Util;
|
||||
import androidx.media3.datasource.DataSpec;
|
||||
import androidx.media3.datasource.HttpDataSource;
|
||||
import androidx.media3.datasource.HttpDataSource.HttpDataSourceException;
|
||||
import androidx.media3.datasource.HttpDataSource.InvalidResponseCodeException;
|
||||
import androidx.media3.datasource.TransferListener;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
@ -1,56 +0,0 @@
|
||||
# HttpEngine DataSource module
|
||||
|
||||
This module provides an [HttpDataSource][] implementation that uses
|
||||
[HttpEngine][].
|
||||
|
||||
HttpEngine uses best HTTP stack available on the current platform. HttpEngine
|
||||
was added in API level 34.
|
||||
|
||||
[HttpDataSource]: ../datasource/src/main/java/androidx/media3/datasource/HttpDataSource.java
|
||||
[HttpEngine]: https://developer.android.com/reference/android/net/http/HttpEngine
|
||||
|
||||
## Getting the module
|
||||
|
||||
The easiest way to get the module is to add it as a gradle dependency:
|
||||
|
||||
```gradle
|
||||
implementation 'androidx.media3:media3-datasource-httpengine:1.X.X'
|
||||
```
|
||||
|
||||
where `1.X.X` is the version, which must match the version of the other media
|
||||
modules being used.
|
||||
|
||||
Alternatively, you can clone this GitHub project and depend on the module
|
||||
locally. Instructions for doing this can be found in the [top level README][].
|
||||
|
||||
[top level README]: ../../README.md
|
||||
|
||||
## Using the module
|
||||
|
||||
Media components request data through `DataSource` instances. These instances
|
||||
are obtained from instances of `DataSource.Factory`, which are instantiated and
|
||||
injected from application code.
|
||||
|
||||
If your application only needs to play http(s) content and the device is running
|
||||
at least API level 34, using the HttpEngine extension is as simple as updating
|
||||
`DataSource.Factory` instantiations in your application code to use
|
||||
`HttpEngineDataSource.Factory`. If your application also needs to play
|
||||
non-http(s) content such as local files, use:
|
||||
|
||||
```
|
||||
new DefaultDataSource.Factory(
|
||||
...
|
||||
/* baseDataSourceFactory= */ new HttpEngineDataSource.Factory(...) );
|
||||
```
|
||||
|
||||
## Cronet implementations
|
||||
|
||||
To instantiate an `HttpEngineDataSource.Factory` you'll need an `HttpEngine`. A
|
||||
`HttpEngine` can be obtained from the platform in API level 34 or greater. It's
|
||||
recommended that an application should only have a single `HttpEngine` instance.
|
||||
|
||||
## Links
|
||||
|
||||
* [Javadoc][]
|
||||
|
||||
[Javadoc]: https://developer.android.com/reference/androidx/media3/datasource/httpengine/package-summary
|
@ -1,50 +0,0 @@
|
||||
// Copyright (C) 2023 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle"
|
||||
|
||||
android {
|
||||
namespace 'androidx.media3.datasource.httpengine'
|
||||
compileSdk 34
|
||||
|
||||
defaultConfig {
|
||||
minSdk 34
|
||||
}
|
||||
|
||||
publishing {
|
||||
singleVariant('release') {
|
||||
withSourcesJar()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(modulePrefix + 'lib-common')
|
||||
implementation project(modulePrefix + 'lib-datasource')
|
||||
implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion
|
||||
compileOnly 'com.google.errorprone:error_prone_annotations:' + errorProneVersion
|
||||
compileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion
|
||||
compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion
|
||||
androidTestImplementation 'androidx.test:rules:' + androidxTestRulesVersion
|
||||
androidTestImplementation 'androidx.test:runner:' + androidxTestRunnerVersion
|
||||
androidTestImplementation 'com.linkedin.dexmaker:dexmaker-mockito:' + dexmakerVersion
|
||||
androidTestImplementation project(modulePrefix + 'test-utils')
|
||||
testImplementation project(modulePrefix + 'test-utils')
|
||||
testImplementation 'org.robolectric:robolectric:' + robolectricVersion
|
||||
}
|
||||
|
||||
ext {
|
||||
releaseArtifactId = 'media3-datasource-httpengine'
|
||||
releaseName = 'Media3 HttpEngine DataSource module'
|
||||
}
|
||||
apply from: '../../publish.gradle'
|
@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2023 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="androidx.media3.datasource.httpengine.test">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-sdk/>
|
||||
|
||||
<application
|
||||
android:name="androidx.multidex.MultiDexApplication"
|
||||
android:allowBackup="false"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:ignore="MissingApplicationIcon,HardcodedDebugMode"/>
|
||||
|
||||
<instrumentation
|
||||
android:targetPackage="androidx.media3.datasource.httpengine.test"
|
||||
android:name="androidx.test.runner.AndroidJUnitRunner"/>
|
||||
|
||||
</manifest>
|
@ -1,22 +0,0 @@
|
||||
<!-- Copyright (C) 2023 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="androidx.media3.datasource.httpengine">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-sdk />
|
||||
|
||||
</manifest>
|
@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@NonNullApi
|
||||
package androidx.media3.datasource.httpengine;
|
||||
|
||||
import androidx.media3.common.util.NonNullApi;
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2023 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<manifest package="androidx.media3.datasource.httpengine.test">
|
||||
<uses-sdk/>
|
||||
</manifest>
|
Loading…
x
Reference in New Issue
Block a user