@@ -271,13 +271,20 @@ public void testVideoStreams() throws Exception {
271271 assertFalse (videoStreams .isEmpty ());
272272
273273 for (final VideoStream stream : videoStreams ) {
274- assertIsSecureUrl (stream .getUrl ());
275- assertFalse (stream .getResolution ().isEmpty ());
276-
277- final int formatId = stream .getFormatId ();
278- // see MediaFormat: video stream formats range from 0 to 0x100
279- assertTrue (0 <= formatId && formatId < 0x100 ,
280- "format id does not fit a video stream: " + formatId );
274+ if (stream .isUrl ()) {
275+ assertIsSecureUrl (stream .getContent ());
276+ }
277+ final StreamType streamType = extractor ().getStreamType ();
278+ // On some video streams, the resolution can be empty and the format be unknown,
279+ // especially on livestreams (like streams with HLS master playlists)
280+ if (streamType != StreamType .LIVE_STREAM
281+ && streamType != StreamType .AUDIO_LIVE_STREAM ) {
282+ assertFalse (stream .getResolution ().isEmpty ());
283+ final int formatId = stream .getFormatId ();
284+ // see MediaFormat: video stream formats range from 0 to 0x100
285+ assertTrue (0 <= formatId && formatId < 0x100 ,
286+ "Format id does not fit a video stream: " + formatId );
287+ }
281288 }
282289 } else {
283290 assertTrue (videoStreams .isEmpty ());
@@ -294,12 +301,17 @@ public void testAudioStreams() throws Exception {
294301 assertFalse (audioStreams .isEmpty ());
295302
296303 for (final AudioStream stream : audioStreams ) {
297- assertIsSecureUrl (stream .getUrl ());
304+ if (stream .isUrl ()) {
305+ assertIsSecureUrl (stream .getContent ());
306+ }
298307
299- final int formatId = stream .getFormatId ();
300- // see MediaFormat: video stream formats range from 0x100 to 0x1000
301- assertTrue (0x100 <= formatId && formatId < 0x1000 ,
302- "format id does not fit an audio stream: " + formatId );
308+ // The media format can be unknown on some audio streams
309+ if (stream .getFormat () != null ) {
310+ final int formatId = stream .getFormat ().id ;
311+ // see MediaFormat: audio stream formats range from 0x100 to 0x1000
312+ assertTrue (0x100 <= formatId && formatId < 0x1000 ,
313+ "Format id does not fit an audio stream: " + formatId );
314+ }
303315 }
304316 } else {
305317 assertTrue (audioStreams .isEmpty ());
@@ -316,12 +328,14 @@ public void testSubtitles() throws Exception {
316328 assertFalse (subtitles .isEmpty ());
317329
318330 for (final SubtitlesStream stream : subtitles ) {
319- assertIsSecureUrl (stream .getUrl ());
331+ if (stream .isUrl ()) {
332+ assertIsSecureUrl (stream .getContent ());
333+ }
320334
321335 final int formatId = stream .getFormatId ();
322336 // see MediaFormat: video stream formats range from 0x1000 to 0x10000
323337 assertTrue (0x1000 <= formatId && formatId < 0x10000 ,
324- "format id does not fit a subtitles stream: " + formatId );
338+ "Format id does not fit a subtitles stream: " + formatId );
325339 }
326340 } else {
327341 assertTrue (subtitles .isEmpty ());
@@ -344,7 +358,8 @@ public void testGetDashMpdUrl() throws Exception {
344358 assertTrue (dashMpdUrl .isEmpty ());
345359 } else {
346360 assertIsSecureUrl (dashMpdUrl );
347- ExtractorAsserts .assertContains (expectedDashMpdUrlContains (), extractor ().getDashMpdUrl ());
361+ ExtractorAsserts .assertContains (expectedDashMpdUrlContains (),
362+ extractor ().getDashMpdUrl ());
348363 }
349364 }
350365
0 commit comments