mirror of
https://github.com/androidx/media.git
synced 2025-05-09 16:40:55 +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;
|
||||
} else if (fileName.endsWith(".m3u8")) {
|
||||
return C.TYPE_HLS;
|
||||
} else if (fileName.endsWith(".ism") || fileName.endsWith(".isml")
|
||||
|| fileName.endsWith(".ism/manifest") || fileName.endsWith(".isml/manifest")) {
|
||||
} else if (fileName.matches(".*\\.ism(l)?(/manifest(\\(.+\\))?)?")) {
|
||||
return C.TYPE_SS;
|
||||
} else {
|
||||
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.common.truth.Truth.assertThat;
|
||||
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.testutil.TestUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -39,6 +40,18 @@ import org.robolectric.annotation.Config;
|
||||
@Config(sdk = Config.TARGET_SDK, manifest = Config.NONE)
|
||||
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
|
||||
public void testArrayBinarySearchFloor() {
|
||||
long[] values = new long[0];
|
||||
|
@ -193,8 +193,8 @@ public final class SsMediaSource implements MediaSource,
|
||||
Assertions.checkState(manifest == null || !manifest.isLive);
|
||||
this.manifest = manifest;
|
||||
this.manifestUri = manifestUri == null ? null
|
||||
: Util.toLowerInvariant(manifestUri.getLastPathSegment()).equals("manifest") ? manifestUri
|
||||
: Uri.withAppendedPath(manifestUri, "Manifest");
|
||||
: Util.toLowerInvariant(manifestUri.getLastPathSegment()).matches("manifest(\\(.+\\))?")
|
||||
? manifestUri : Uri.withAppendedPath(manifestUri, "Manifest");
|
||||
this.manifestDataSourceFactory = manifestDataSourceFactory;
|
||||
this.manifestParser = manifestParser;
|
||||
this.chunkSourceFactory = chunkSourceFactory;
|
||||
|
Loading…
x
Reference in New Issue
Block a user