Allow line terminators in ICY metadata

Issue: #5876
PiperOrigin-RevId: 247935822
This commit is contained in:
olly 2019-05-13 16:05:34 +01:00 committed by Oliver Woodman
parent bef386bea8
commit 48de1010a8
3 changed files with 14 additions and 1 deletions

View File

@ -4,6 +4,8 @@
* Fix NPE when using HLS chunkless preparation
([#5868](https://github.com/google/ExoPlayer/issues/5868)).
* Fix handling of line terminators in SHOUTcast ICY metadata
([#5876](https://github.com/google/ExoPlayer/issues/5876)).
* Offline: Add option to remove all downloads.
* Add a workaround for a decoder failure on ZTE Axon7 mini devices when playing
48kHz audio ([#5821](https://github.com/google/ExoPlayer/issues/5821)).

View File

@ -31,7 +31,7 @@ public final class IcyDecoder implements MetadataDecoder {
private static final String TAG = "IcyDecoder";
private static final Pattern METADATA_ELEMENT = Pattern.compile("(.+?)='(.+?)';");
private static final Pattern METADATA_ELEMENT = Pattern.compile("(.+?)='(.+?)';", Pattern.DOTALL);
private static final String STREAM_KEY_NAME = "streamtitle";
private static final String STREAM_KEY_URL = "streamurl";

View File

@ -70,6 +70,17 @@ public final class IcyDecoderTest {
assertThat(streamInfo.url).isEqualTo("test_url");
}
@Test
public void decode_lineTerminatorInTitle() {
IcyDecoder decoder = new IcyDecoder();
Metadata metadata = decoder.decode("StreamTitle='test\r\ntitle';StreamURL='test_url';");
assertThat(metadata.length()).isEqualTo(1);
IcyInfo streamInfo = (IcyInfo) metadata.get(0);
assertThat(streamInfo.title).isEqualTo("test\r\ntitle");
assertThat(streamInfo.url).isEqualTo("test_url");
}
@Test
public void decode_notIcy() {
IcyDecoder decoder = new IcyDecoder();