Skip to content

Commit

Permalink
Refactor namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
varsill committed Aug 7, 2024
1 parent 7d511b7 commit f3c6ac2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/source_with_standalone_server.exs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ end
# Run the standalone server
{:ok, server} =
Membrane.RTMP.Server.start_link(
handler: %Membrane.RTMP.Source.ClientHandler{controlling_process: self()},
handler: %Membrane.RTMP.Source.ClientHandlerForSource{controlling_process: self()},
port: port,
use_ssl?: false,
new_client_callback: new_client_callback,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Membrane.RTMP.Source.SourceClientHandler do
defmodule Membrane.RTMP.Source.ClientHandlerForSource do
@moduledoc """
An implementation of `Membrane.RTMP.Server.ClienHandlerBehaviour` compatible with the
`Membrane.RTMP.Source` element.
Expand Down Expand Up @@ -67,10 +67,4 @@ defmodule Membrane.RTMP.Source.SourceClientHandler do
send(pid, :end_of_stream)
:ok
end

@spec request_for_data(pid()) :: :ok
def request_for_data(client_reference) do
send(client_reference, {:send_me_data, self()})
:ok
end
end
7 changes: 3 additions & 4 deletions lib/membrane_rtmp_plugin/rtmp/source/source.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ defmodule Membrane.RTMP.Source do
use Membrane.Source
require Membrane.Logger
require Logger
alias __MODULE__.SourceClientHandler
alias Membrane.RTMP.Server.ClientHandler

def_output_pad :output,
Expand Down Expand Up @@ -91,7 +90,7 @@ defmodule Membrane.RTMP.Source do

{:ok, server_pid} =
Membrane.RTMP.Server.start_link(
handler: %SourceClientHandler{controlling_process: self()},
handler: %__MODULE__.ClientHandlerForSource{controlling_process: self()},
port: port,
use_ssl?: use_ssl?,
new_client_callback: new_client_callback,
Expand All @@ -114,7 +113,7 @@ defmodule Membrane.RTMP.Source do
{:output, %Membrane.RemoteStream{content_format: Membrane.FLV, type: :bytestream}}
]

:ok = SourceClientHandler.request_for_data(state.client_ref)
send(state.client_ref, {:send_me_data, self()})

{stream_format, state}
end
Expand Down Expand Up @@ -149,7 +148,7 @@ defmodule Membrane.RTMP.Source do
%{client_ref: client_ref, mode: :builtin_server} = state
) do
:ok = ClientHandler.demand_data(client_ref, size)
:ok = SourceClientHandler.request_for_data(client_ref)
send(client_ref, {:send_me_data, self()})
{[], state}
end

Expand Down
2 changes: 1 addition & 1 deletion test/membrane_rtmp_plugin/rtmp_source_bin_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ defmodule Membrane.RTMP.SourceBin.IntegrationTest do

{:ok, server_pid} =
Membrane.RTMP.Server.start_link(
handler: %Membrane.RTMP.Source.ClientHandler{
handler: %Membrane.RTMP.Source.ClientHandlerForSource{
controlling_process: self()
},
port: port,
Expand Down

0 comments on commit f3c6ac2

Please sign in to comment.