Commit 9d450e52 by olly Committed by Oliver Woodman

Allow empty values in ICY metadata

Issue: #5876
PiperOrigin-RevId: 248119726
parent 14915fd1
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Fix NPE when using HLS chunkless preparation * Fix NPE when using HLS chunkless preparation
([#5868](https://github.com/google/ExoPlayer/issues/5868)). ([#5868](https://github.com/google/ExoPlayer/issues/5868)).
* Fix handling of line terminators in SHOUTcast ICY metadata * Fix handling of empty values and line terminators in SHOUTcast ICY metadata
([#5876](https://github.com/google/ExoPlayer/issues/5876)). ([#5876](https://github.com/google/ExoPlayer/issues/5876)).
* Assume that encrypted content requires secure decoders in renderer support * Assume that encrypted content requires secure decoders in renderer support
checks ([#5568](https://github.com/google/ExoPlayer/issues/5568)). checks ([#5568](https://github.com/google/ExoPlayer/issues/5568)).
......
...@@ -31,7 +31,7 @@ public final class IcyDecoder implements MetadataDecoder { ...@@ -31,7 +31,7 @@ public final class IcyDecoder implements MetadataDecoder {
private static final String TAG = "IcyDecoder"; private static final String TAG = "IcyDecoder";
private static final Pattern METADATA_ELEMENT = Pattern.compile("(.+?)='(.+?)';", Pattern.DOTALL); private static final Pattern METADATA_ELEMENT = Pattern.compile("(.+?)='(.*?)';", Pattern.DOTALL);
private static final String STREAM_KEY_NAME = "streamtitle"; private static final String STREAM_KEY_NAME = "streamtitle";
private static final String STREAM_KEY_URL = "streamurl"; private static final String STREAM_KEY_URL = "streamurl";
......
...@@ -49,6 +49,17 @@ public final class IcyDecoderTest { ...@@ -49,6 +49,17 @@ public final class IcyDecoderTest {
} }
@Test @Test
public void decode_emptyTitle() {
IcyDecoder decoder = new IcyDecoder();
Metadata metadata = decoder.decode("StreamTitle='';StreamURL='test_url';");
assertThat(metadata.length()).isEqualTo(1);
IcyInfo streamInfo = (IcyInfo) metadata.get(0);
assertThat(streamInfo.title).isEmpty();
assertThat(streamInfo.url).isEqualTo("test_url");
}
@Test
public void decode_semiColonInTitle() { public void decode_semiColonInTitle() {
IcyDecoder decoder = new IcyDecoder(); IcyDecoder decoder = new IcyDecoder();
Metadata metadata = decoder.decode("StreamTitle='test; title';StreamURL='test_url';"); Metadata metadata = decoder.decode("StreamTitle='test; title';StreamURL='test_url';");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment