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

Fix HLS tests #282

Merged
merged 2 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 0 additions & 15 deletions test/hls_reference/audio_mixer/g2QABWF1ZGlv.m3u8

This file was deleted.

15 changes: 0 additions & 15 deletions test/hls_reference/audio_mixer/g2QABXZpZGVv.m3u8

This file was deleted.

6 changes: 0 additions & 6 deletions test/hls_reference/audio_mixer/index.m3u8

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions test/hls_reference/multiple-tracks-h264-aac/index.m3u8

This file was deleted.

Binary file not shown.
13 changes: 0 additions & 13 deletions test/hls_reference/muxed-segments/g2QABXZpZGVv.m3u8

This file was deleted.

5 changes: 0 additions & 5 deletions test/hls_reference/muxed-segments/index.m3u8

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

5 changes: 0 additions & 5 deletions test/hls_reference/single-track-h264/index.m3u8

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 0 additions & 15 deletions test/hls_reference/video_mixer/g2QABWF1ZGlv.m3u8

This file was deleted.

13 changes: 0 additions & 13 deletions test/hls_reference/video_mixer/g2QABXZpZGVv.m3u8

This file was deleted.

6 changes: 0 additions & 6 deletions test/hls_reference/video_mixer/index.m3u8

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
21 changes: 6 additions & 15 deletions test/membrane_rtc_engine/hls_endpoint_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -350,29 +350,20 @@ defmodule Membrane.RTC.HLSEndpointTest do
case input_type do
:single ->
fn
%{segments: %{video_segments: 2}} = state ->
%{state | stopped?: true}

state ->
state
%{video_segments: video} ->
video > 1
end

:muxed ->
fn
%{segments: %{muxed_segments: 2}} = state ->
%{state | stopped?: true}

state ->
state
%{muxed_segments: muxed} ->
muxed > 1
end

:multiple ->
fn
%{segments: %{video_segments: 2, audio_segments: 2}} = state ->
%{state | stopped?: true}

state ->
state
%{video_segments: video, audio_segments: audio} ->
video > 1 and audio > 1
end
end

Expand Down
23 changes: 12 additions & 11 deletions test/support/hls_storage.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ defmodule Membrane.RTC.Engine.Support.HLSStorage do
{result, file_storage} =
FileStorage.store(parent_id, resource_name, content, metadata, context, state.file_storage)

if context.type == :segment do
send(state.pid, {context.type, resource_name})
end
state = %{state | file_storage: file_storage}

case context.type do
:segment ->
send(state.pid, {context.type, resource_name})
{result, state}

state =
if context.type == :manifest do
:manifest ->
content = String.split(content, "\n")

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

update_segments(segments, state)
else
state
end
{result, update_segments(segments, state)}

{result, %{state | file_storage: file_storage}}
_other ->
{result, state}
end
end

defp update_segments(
Expand All @@ -85,7 +86,7 @@ defmodule Membrane.RTC.Engine.Support.HLSStorage do
muxed_segments: muxed_segments
}

%{state | segments: segments, stopped?: state.should_stop?.(state)}
%{state | segments: segments, stopped?: state.should_stop?.(segments)}
end

@impl true
Expand Down