mirror of
https://github.com/androidx/media.git
synced 2025-05-03 21:57:46 +08:00
Set StreamIndex Name as format.label in SS
Issue: #9252 #minor-release PiperOrigin-RevId: 388889406
This commit is contained in:
parent
6ca0b30755
commit
8fb1e5ce51
@ -154,6 +154,9 @@
|
|||||||
playlists, so that the `PlaybackStatsListener` can derive audio
|
playlists, so that the `PlaybackStatsListener` can derive audio
|
||||||
format-related information.
|
format-related information.
|
||||||
([#9175](https://github.com/google/ExoPlayer/issues/9175)).
|
([#9175](https://github.com/google/ExoPlayer/issues/9175)).
|
||||||
|
* SS:
|
||||||
|
* Propagate `StreamIndex` element `Name` attribute value as `Format`
|
||||||
|
label ([#9252](https://github.com/google/ExoPlayer/issues/9252)).
|
||||||
|
|
||||||
### 2.14.2 (2021-07-20)
|
### 2.14.2 (2021-07-20)
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ public class SsManifestParser implements ParsingLoadable.Parser<SsManifest> {
|
|||||||
* provided name, the parent element parser will be queried, and so on up the chain.
|
* provided name, the parent element parser will be queried, and so on up the chain.
|
||||||
*
|
*
|
||||||
* @param key The name of the attribute.
|
* @param key The name of the attribute.
|
||||||
* @return The stashed value, or null if the attribute was not be found.
|
* @return The stashed value, or null if the attribute was not found.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
protected final Object getNormalizedAttribute(String key) {
|
protected final Object getNormalizedAttribute(String key) {
|
||||||
@ -595,6 +595,7 @@ public class SsManifestParser implements ParsingLoadable.Parser<SsManifest> {
|
|||||||
}
|
}
|
||||||
putNormalizedAttribute(KEY_SUB_TYPE, subType);
|
putNormalizedAttribute(KEY_SUB_TYPE, subType);
|
||||||
name = parser.getAttributeValue(null, KEY_NAME);
|
name = parser.getAttributeValue(null, KEY_NAME);
|
||||||
|
putNormalizedAttribute(KEY_NAME, name);
|
||||||
url = parseRequiredString(parser, KEY_URL);
|
url = parseRequiredString(parser, KEY_URL);
|
||||||
maxWidth = parseInt(parser, KEY_MAX_WIDTH, Format.NO_VALUE);
|
maxWidth = parseInt(parser, KEY_MAX_WIDTH, Format.NO_VALUE);
|
||||||
maxHeight = parseInt(parser, KEY_MAX_HEIGHT, Format.NO_VALUE);
|
maxHeight = parseInt(parser, KEY_MAX_HEIGHT, Format.NO_VALUE);
|
||||||
|
@ -15,11 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.exoplayer2.source.smoothstreaming.manifest;
|
package com.google.android.exoplayer2.source.smoothstreaming.manifest;
|
||||||
|
|
||||||
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import androidx.test.core.app.ApplicationProvider;
|
import androidx.test.core.app.ApplicationProvider;
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||||
import com.google.android.exoplayer2.testutil.TestUtil;
|
import com.google.android.exoplayer2.testutil.TestUtil;
|
||||||
import java.io.IOException;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ public final class SsManifestParserTest {
|
|||||||
|
|
||||||
/** Simple test to ensure the sample manifests parse without any exceptions being thrown. */
|
/** Simple test to ensure the sample manifests parse without any exceptions being thrown. */
|
||||||
@Test
|
@Test
|
||||||
public void parseSmoothStreamingManifest() throws IOException {
|
public void parseSmoothStreamingManifest() throws Exception {
|
||||||
SsManifestParser parser = new SsManifestParser();
|
SsManifestParser parser = new SsManifestParser();
|
||||||
parser.parse(
|
parser.parse(
|
||||||
Uri.parse("https://example.com/test.ismc"),
|
Uri.parse("https://example.com/test.ismc"),
|
||||||
@ -41,4 +42,15 @@ public final class SsManifestParserTest {
|
|||||||
Uri.parse("https://example.com/test.ismc"),
|
Uri.parse("https://example.com/test.ismc"),
|
||||||
TestUtil.getInputStream(ApplicationProvider.getApplicationContext(), SAMPLE_ISMC_2));
|
TestUtil.getInputStream(ApplicationProvider.getApplicationContext(), SAMPLE_ISMC_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void parse_populatesFormatLabelWithStreamIndexName() throws Exception {
|
||||||
|
SsManifestParser parser = new SsManifestParser();
|
||||||
|
SsManifest ssManifest =
|
||||||
|
parser.parse(
|
||||||
|
Uri.parse("https://example.com/test.ismc"),
|
||||||
|
TestUtil.getInputStream(ApplicationProvider.getApplicationContext(), SAMPLE_ISMC_1));
|
||||||
|
|
||||||
|
assertThat(ssManifest.streamElements[0].formats[0].label).isEqualTo("video");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user