Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.

Commit 64a7b44

Browse files
authored
Fix HLS tests (#282)
1 parent 9d1b113 commit 64a7b44

File tree

48 files changed

+18
-160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+18
-160
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/hls_reference/audio_mixer/g2QABWF1ZGlv.m3u8

-15
This file was deleted.

test/hls_reference/audio_mixer/g2QABXZpZGVv.m3u8

-15
This file was deleted.

test/hls_reference/audio_mixer/index.m3u8

-6
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/hls_reference/multiple-tracks-h264-aac/g2gCZAAFYXVkaW9tAAAAEHRlc3QtYXVkaW8tdHJhY2s.m3u8

-13
This file was deleted.

test/hls_reference/multiple-tracks-h264-aac/g2gCZAAFdmlkZW9tAAAAEHRlc3QtdmlkZW8tdHJhY2s.m3u8

-11
This file was deleted.

test/hls_reference/multiple-tracks-h264-aac/index.m3u8

-6
This file was deleted.

test/hls_reference/muxed-segments/g2QABXZpZGVv.m3u8

-13
This file was deleted.

test/hls_reference/muxed-segments/index.m3u8

-5
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/hls_reference/single-track-h264/g2gCZAAFdmlkZW9tAAAADXRlc3QtdHJhY2staWQ.m3u8

-11
This file was deleted.

test/hls_reference/single-track-h264/index.m3u8

-5
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/hls_reference/video_mixer/g2QABWF1ZGlv.m3u8

-15
This file was deleted.

test/hls_reference/video_mixer/g2QABXZpZGVv.m3u8

-13
This file was deleted.

test/hls_reference/video_mixer/index.m3u8

-6
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

test/membrane_rtc_engine/hls_endpoint_test.exs

+6-15
Original file line numberDiff line numberDiff line change
@@ -350,29 +350,20 @@ defmodule Membrane.RTC.HLSEndpointTest do
350350
case input_type do
351351
:single ->
352352
fn
353-
%{segments: %{video_segments: 2}} = state ->
354-
%{state | stopped?: true}
355-
356-
state ->
357-
state
353+
%{video_segments: video} ->
354+
video > 1
358355
end
359356

360357
:muxed ->
361358
fn
362-
%{segments: %{muxed_segments: 2}} = state ->
363-
%{state | stopped?: true}
364-
365-
state ->
366-
state
359+
%{muxed_segments: muxed} ->
360+
muxed > 1
367361
end
368362

369363
:multiple ->
370364
fn
371-
%{segments: %{video_segments: 2, audio_segments: 2}} = state ->
372-
%{state | stopped?: true}
373-
374-
state ->
375-
state
365+
%{video_segments: video, audio_segments: audio} ->
366+
video > 1 and audio > 1
376367
end
377368
end
378369

test/support/hls_storage.ex

+12-11
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@ defmodule Membrane.RTC.Engine.Support.HLSStorage do
3636
{result, file_storage} =
3737
FileStorage.store(parent_id, resource_name, content, metadata, context, state.file_storage)
3838

39-
if context.type == :segment do
40-
send(state.pid, {context.type, resource_name})
41-
end
39+
state = %{state | file_storage: file_storage}
40+
41+
case context.type do
42+
:segment ->
43+
send(state.pid, {context.type, resource_name})
44+
{result, state}
4245

43-
state =
44-
if context.type == :manifest do
46+
:manifest ->
4547
content = String.split(content, "\n")
4648

4749
video_segments = Enum.count(content, &String.match?(&1, ~r/^video.*\.m4s/))
@@ -59,12 +61,11 @@ defmodule Membrane.RTC.Engine.Support.HLSStorage do
5961
{context.type, segments}
6062
)
6163

62-
update_segments(segments, state)
63-
else
64-
state
65-
end
64+
{result, update_segments(segments, state)}
6665

67-
{result, %{state | file_storage: file_storage}}
66+
_other ->
67+
{result, state}
68+
end
6869
end
6970

7071
defp update_segments(
@@ -85,7 +86,7 @@ defmodule Membrane.RTC.Engine.Support.HLSStorage do
8586
muxed_segments: muxed_segments
8687
}
8788

88-
%{state | segments: segments, stopped?: state.should_stop?.(state)}
89+
%{state | segments: segments, stopped?: state.should_stop?.(segments)}
8990
end
9091

9192
@impl true

0 commit comments

Comments
 (0)