Skip to content

Commit 572ac38

Browse files
committed
Fix compilation warnings
1 parent 5349ad0 commit 572ac38

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

lib/membrane_http_adaptive_stream/hls_source.ex

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ defmodule Membrane.HLS.Source do
22
use Membrane.Source
33
require Membrane.Pad, as: Pad
44

5-
alias ExHLS.Client
65
alias __MODULE__.ClientGenServer
76

87
alias Membrane.{
@@ -12,14 +11,14 @@ defmodule Membrane.HLS.Source do
1211
}
1312

1413
def_output_pad :video_output,
15-
accepted_format: any_of(H264, %RemoteStream{content_type: H264}),
14+
accepted_format: any_of(H264, %RemoteStream{content_format: H264}),
1615
availability: :on_request,
1716
max_instances: 1,
1817
flow_control: :manual,
1918
demand_unit: :buffers
2019

2120
def_output_pad :audio_output,
22-
accepted_format: any_of(AAC, %RemoteStream{content_type: AAC}),
21+
accepted_format: any_of(AAC, %RemoteStream{content_format: AAC}),
2322
availability: :on_request,
2423
max_instances: 1,
2524
flow_control: :manual,
@@ -50,8 +49,8 @@ defmodule Membrane.HLS.Source do
5049
:fmp4 -> ExHLS.DemuxingEngine.CMAF
5150
end
5251

53-
{:ok, clinet_genserver} = ClientGenServer.start_link(url, demuxing_engine)
54-
%{state | client_genserver: clinet_genserver}
52+
{:ok, clinet_genserver} = ClientGenServer.start_link(state.url, demuxing_engine)
53+
{[], %{state | client_genserver: clinet_genserver}}
5554
end
5655

5756
@impl true
@@ -61,7 +60,7 @@ defmodule Membrane.HLS.Source do
6160
end
6261

6362
@impl true
64-
def handle_playing(_ctx, state) do
63+
def handle_playing(ctx, state) do
6564
if ctx.pads |> map_size() < 2 do
6665
raise "HLS Source requires both audio and video output pads to be present"
6766
end
@@ -70,16 +69,18 @@ defmodule Membrane.HLS.Source do
7069
ClientGenServer.get_tracks_info(state.client_genserver)
7170
|> Map.values()
7271
|> Enum.split_with(fn
73-
%RemoteStream{content_type: AAC} -> true
74-
%RemoteStream{content_type: H264} -> false
72+
%RemoteStream{content_format: AAC} -> true
73+
%RemoteStream{content_format: H264} -> false
7574
%AAC{} -> true
7675
%H264{} -> false
7776
end)
7877

79-
{[
80-
stream_format: {:audio_output, audio_stream_format},
81-
stream_format: {:video_output, video_stream_format}
82-
], %{state | client_server: client_server}}
78+
actions = [
79+
stream_format: {state.audio_output.pad_ref, audio_stream_format},
80+
stream_format: {state.video_output.pad_ref, video_stream_format}
81+
]
82+
83+
{actions, state}
8384
end
8485

8586
@impl true
@@ -107,7 +108,7 @@ defmodule Membrane.HLS.Source do
107108
{[redemand: state[pad_name].pad_ref], state}
108109
end
109110

110-
defp pop_buffers(Pad.ref(pad_name, _id) = pad_ref, demand, state) do
111+
defp pop_buffers(Pad.ref(pad_name, _id), demand, state) do
111112
range_upperbound = min(state[pad_name].qex_size, demand)
112113

113114
if range_upperbound > 0 do
@@ -135,8 +136,8 @@ defmodule Membrane.HLS.Source do
135136
end
136137

137138
defp request_frames(state) do
138-
[audio_output: :request_audio, video_output: :request_video]
139-
|> Enum.reduce(state, fn {pad_name, request_type}, state ->
139+
[:audio_output, :video_output]
140+
|> Enum.reduce(state, fn pad_name, state ->
140141
request_size = state.buffer_size - state[pad_name].qex_size - state[pad_name].requested
141142
:ok = do_request(state, pad_name, request_size)
142143

@@ -145,7 +146,7 @@ defmodule Membrane.HLS.Source do
145146
end)
146147
end
147148

148-
defp do_request(_state, _pad_name, 0), do: :ok
149+
defp do_request(_state, _pad_name, request_size) when request_size < 1, do: :ok
149150

150151
defp do_request(state, :audio_output, request_size) do
151152
1..request_size

lib/membrane_http_adaptive_stream/hls_source/client_genserver.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ defmodule Membrane.HLS.Source.ClientGenServer do
4646
def handle_cast({:request_video, pid}, state) do
4747
{frame, client} = Client.read_video_frame(state.client)
4848
send(pid, {:video_stream, frame})
49-
{:noreply}
49+
{:noreply, %{state | client: client}}
5050
end
5151

5252
@impl true

mix.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ defmodule Membrane.HTTPAdaptiveStream.MixProject do
6868
{:membrane_mp4_plugin, "~> 0.35.0"},
6969
{:membrane_aac_plugin, "~> 0.19.0"},
7070
{:membrane_h26x_plugin, "~> 0.10.0"},
71-
{:ex_hls, path: "../ex_hls"},
71+
{:ex_hls,
72+
github: "membraneframework-labs/ex_hls", ref: "d72569595f3a4eeb9d1521dfbc8b2445b6e50943"},
7273
{:bunch, "~> 1.6"},
7374
{:qex, "~> 0.5"},
7475
{:membrane_hackney_plugin, "~> 0.11.0", only: :test},

mix.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"},
1010
"erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"},
1111
"ex_doc": {:hex, :ex_doc, "0.38.2", "504d25eef296b4dec3b8e33e810bc8b5344d565998cd83914ffe1b8503737c02", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "732f2d972e42c116a70802f9898c51b54916e542cc50968ac6980512ec90f42b"},
12+
"ex_hls": {:git, "https://github.com/membraneframework-labs/ex_hls.git", "d72569595f3a4eeb9d1521dfbc8b2445b6e50943", [ref: "d72569595f3a4eeb9d1521dfbc8b2445b6e50943"]},
1213
"ex_m3u8": {:git, "https://github.com/membraneframework/ex_m3u8.git", "8a83e4f6dd14e749aadf551bf1adb7ad4d4eb495", [branch: "allow-empty-default"]},
1314
"file_system": {:hex, :file_system, "1.1.0", "08d232062284546c6c34426997dd7ef6ec9f8bbd090eb91780283c9016840e8f", [:mix], [], "hexpm", "bfcf81244f416871f2a2e15c1b515287faa5db9c6bcf290222206d120b3d43f6"},
1415
"finch": {:hex, :finch, "0.19.0", "c644641491ea854fc5c1bbaef36bfc764e3f08e7185e1f084e35e0672241b76d", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "fc5324ce209125d1e2fa0fcd2634601c52a787aff1cd33ee833664a5af4ea2b6"},

0 commit comments

Comments
 (0)