mirror of
https://github.com/androidx/media.git
synced 2025-05-10 00:59:51 +08:00
Handle bracket params on the end of SmoothStreaming URLs
Issue: #3230 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=169421873
This commit is contained in:
parent
6314a0ec82
commit
ce7aaab3c6
@ -900,8 +900,7 @@ public final class Util {
|
|||||||
return C.TYPE_DASH;
|
return C.TYPE_DASH;
|
||||||
} else if (fileName.endsWith(".m3u8")) {
|
} else if (fileName.endsWith(".m3u8")) {
|
||||||
return C.TYPE_HLS;
|
return C.TYPE_HLS;
|
||||||
} else if (fileName.endsWith(".ism") || fileName.endsWith(".isml")
|
} else if (fileName.matches(".*\\.ism(l)?(/manifest(\\(.+\\))?)?")) {
|
||||||
|| fileName.endsWith(".ism/manifest") || fileName.endsWith(".isml/manifest")) {
|
|
||||||
return C.TYPE_SS;
|
return C.TYPE_SS;
|
||||||
} else {
|
} else {
|
||||||
return C.TYPE_OTHER;
|
return C.TYPE_OTHER;
|
||||||
|
@ -23,6 +23,7 @@ import static com.google.android.exoplayer2.util.Util.parseXsDuration;
|
|||||||
import static com.google.android.exoplayer2.util.Util.unescapeFileName;
|
import static com.google.android.exoplayer2.util.Util.unescapeFileName;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.testutil.TestUtil;
|
import com.google.android.exoplayer2.testutil.TestUtil;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -39,6 +40,18 @@ import org.robolectric.annotation.Config;
|
|||||||
@Config(sdk = Config.TARGET_SDK, manifest = Config.NONE)
|
@Config(sdk = Config.TARGET_SDK, manifest = Config.NONE)
|
||||||
public class UtilTest {
|
public class UtilTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testInferContentType() {
|
||||||
|
assertThat(Util.inferContentType("http://a.b/c.ism")).isEqualTo(C.TYPE_SS);
|
||||||
|
assertThat(Util.inferContentType("http://a.b/c.isml")).isEqualTo(C.TYPE_SS);
|
||||||
|
assertThat(Util.inferContentType("http://a.b/c.ism/Manifest")).isEqualTo(C.TYPE_SS);
|
||||||
|
assertThat(Util.inferContentType("http://a.b/c.isml/manifest")).isEqualTo(C.TYPE_SS);
|
||||||
|
assertThat(Util.inferContentType("http://a.b/c.isml/manifest(filter=x)")).isEqualTo(C.TYPE_SS);
|
||||||
|
|
||||||
|
assertThat(Util.inferContentType("http://a.b/c.ism/prefix-manifest")).isEqualTo(C.TYPE_OTHER);
|
||||||
|
assertThat(Util.inferContentType("http://a.b/c.ism/manifest-suffix")).isEqualTo(C.TYPE_OTHER);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testArrayBinarySearchFloor() {
|
public void testArrayBinarySearchFloor() {
|
||||||
long[] values = new long[0];
|
long[] values = new long[0];
|
||||||
|
@ -193,8 +193,8 @@ public final class SsMediaSource implements MediaSource,
|
|||||||
Assertions.checkState(manifest == null || !manifest.isLive);
|
Assertions.checkState(manifest == null || !manifest.isLive);
|
||||||
this.manifest = manifest;
|
this.manifest = manifest;
|
||||||
this.manifestUri = manifestUri == null ? null
|
this.manifestUri = manifestUri == null ? null
|
||||||
: Util.toLowerInvariant(manifestUri.getLastPathSegment()).equals("manifest") ? manifestUri
|
: Util.toLowerInvariant(manifestUri.getLastPathSegment()).matches("manifest(\\(.+\\))?")
|
||||||
: Uri.withAppendedPath(manifestUri, "Manifest");
|
? manifestUri : Uri.withAppendedPath(manifestUri, "Manifest");
|
||||||
this.manifestDataSourceFactory = manifestDataSourceFactory;
|
this.manifestDataSourceFactory = manifestDataSourceFactory;
|
||||||
this.manifestParser = manifestParser;
|
this.manifestParser = manifestParser;
|
||||||
this.chunkSourceFactory = chunkSourceFactory;
|
this.chunkSourceFactory = chunkSourceFactory;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user