mirror of
https://github.com/androidx/media.git
synced 2025-05-17 04:29:55 +08:00
Allow line terminators in ICY metadata
Issue: #5876 PiperOrigin-RevId: 247935822
This commit is contained in:
parent
bef386bea8
commit
48de1010a8
@ -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)).
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user