From a74fd17e925ae4146aade446d667ca62cf4c1923 Mon Sep 17 00:00:00 2001 From: Oliver Woodman Date: Mon, 26 Oct 2015 15:31:09 +0000 Subject: [PATCH] Handle curle braces in SystemID UUID. Issue: #863 --- .../assets/smoothstreaming/sample_ismc_1 | 45 +++++++++++++++++++ .../assets/smoothstreaming/sample_ismc_2 | 45 +++++++++++++++++++ .../SmoothStreamingManifestParserTest.java | 44 ++++++++++++++++++ .../SmoothStreamingManifestParser.java | 7 +++ 4 files changed, 141 insertions(+) create mode 100755 library/src/androidTest/assets/smoothstreaming/sample_ismc_1 create mode 100755 library/src/androidTest/assets/smoothstreaming/sample_ismc_2 create mode 100644 library/src/androidTest/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParserTest.java diff --git a/library/src/androidTest/assets/smoothstreaming/sample_ismc_1 b/library/src/androidTest/assets/smoothstreaming/sample_ismc_1 new file mode 100755 index 0000000000..25a37d65b4 --- /dev/null +++ b/library/src/androidTest/assets/smoothstreaming/sample_ismc_1 @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/src/androidTest/assets/smoothstreaming/sample_ismc_2 b/library/src/androidTest/assets/smoothstreaming/sample_ismc_2 new file mode 100755 index 0000000000..5875a18183 --- /dev/null +++ b/library/src/androidTest/assets/smoothstreaming/sample_ismc_2 @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/library/src/androidTest/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParserTest.java b/library/src/androidTest/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParserTest.java new file mode 100644 index 0000000000..c8bc4241fa --- /dev/null +++ b/library/src/androidTest/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParserTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2014 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. + */ +package com.google.android.exoplayer.smoothstreaming; + +import android.test.InstrumentationTestCase; + +import java.io.IOException; +import java.io.InputStream; + +/** + * Unit tests for {@link SmoothStreamingManifestParser}. + */ +public class SmoothStreamingManifestParserTest extends InstrumentationTestCase { + + private static final String SAMPLE_ISMC_1 = "smoothstreaming/sample_ismc_1"; + private static final String SAMPLE_ISMC_2 = "smoothstreaming/sample_ismc_2"; + + public void testParseSmoothStreamingManifest() throws IOException { + SmoothStreamingManifestParser parser = new SmoothStreamingManifestParser(); + // Simple test to ensure that the sample manifest parses without throwing any exceptions. + // SystemID UUID in the manifest is not wrapped in braces. + InputStream inputStream1 = + getInstrumentation().getContext().getResources().getAssets().open(SAMPLE_ISMC_1); + parser.parse("https://example.com/test.ismc", inputStream1); + // Simple test to ensure that the sample manifest parses without throwing any exceptions. + // SystemID UUID in the manifest is wrapped in braces. + InputStream inputStream2 = + getInstrumentation().getContext().getResources().getAssets().open(SAMPLE_ISMC_2); + parser.parse("https://example.com/test.ismc", inputStream2); + } +} diff --git a/library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParser.java b/library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParser.java index a0bc0e7926..ee40743623 100644 --- a/library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParser.java +++ b/library/src/main/java/com/google/android/exoplayer/smoothstreaming/SmoothStreamingManifestParser.java @@ -404,6 +404,7 @@ public class SmoothStreamingManifestParser implements UriLoadable.Parser