diff --git a/lib/pipe_transport.ex b/lib/pipe_transport.ex index 807db2f6..f127d5ee 100644 --- a/lib/pipe_transport.ex +++ b/lib/pipe_transport.ex @@ -114,7 +114,7 @@ defmodule Mediasoup.PipeTransport do GenServer.call(pid, {:consume, [option]}) end - def consume(transport, option) do + def consume(%PipeTransport{} = transport, option) do consume(transport, Consumer.Options.from_map(option)) end @@ -128,7 +128,7 @@ defmodule Mediasoup.PipeTransport do GenServer.call(pid, {:consume_data, [option]}) end - def consume_data(transport, option) do + def consume_data(%PipeTransport{} = transport, option) do consume_data(transport, DataConsumer.Options.from_map(option)) end @@ -151,7 +151,7 @@ defmodule Mediasoup.PipeTransport do GenServer.call(pid, {:produce, [option]}) end - def produce(transport, %{} = option) do + def produce(%PipeTransport{} = transport, %{} = option) do produce(transport, Producer.Options.from_map(option)) end @@ -165,7 +165,7 @@ defmodule Mediasoup.PipeTransport do GenServer.call(pid, {:produce_data, [option]}) end - def produce_data(transport, %{} = option) do + def produce_data(%PipeTransport{} = transport, %{} = option) do produce_data(transport, DataProducer.Options.from_map(option)) end diff --git a/lib/plain_transport.ex b/lib/plain_transport.ex index 83c2d99f..2ba5ede7 100644 --- a/lib/plain_transport.ex +++ b/lib/plain_transport.ex @@ -191,7 +191,7 @@ defmodule Mediasoup.PlainTransport do GenServer.call(pid, {:produce, [option]}) end - def produce(transport, %{} = option) do + def produce(%PlainTransport{} = transport, %{} = option) do produce(transport, Producer.Options.from_map(option)) end @@ -205,7 +205,7 @@ defmodule Mediasoup.PlainTransport do GenServer.call(pid, {:consume, [option]}) end - def consume(transport, option) do + def consume(%PlainTransport{} = transport, option) do consume(transport, Consumer.Options.from_map(option)) end diff --git a/lib/router.ex b/lib/router.ex index 4bfb097b..6245f110 100644 --- a/lib/router.ex +++ b/lib/router.ex @@ -130,7 +130,7 @@ defmodule Mediasoup.Router do GenServer.call(pid, {:create_webrtc_transport, [option]}) end - def create_webrtc_transport(router, %{} = option) do + def create_webrtc_transport(%Router{} = router, %{} = option) do create_webrtc_transport(router, WebRtcTransport.Options.from_map(option)) end @@ -148,7 +148,7 @@ defmodule Mediasoup.Router do GenServer.call(pid, {:create_plain_transport, [option]}) end - def create_plain_transport(router, %{} = option) do + def create_plain_transport(%Router{} = router, %{} = option) do create_plain_transport(router, Mediasoup.PlainTransport.Options.from_map(option)) end diff --git a/lib/webrtc_transport.ex b/lib/webrtc_transport.ex index 132268ca..76236ac6 100644 --- a/lib/webrtc_transport.ex +++ b/lib/webrtc_transport.ex @@ -229,7 +229,7 @@ defmodule Mediasoup.WebRtcTransport do GenServer.call(pid, {:consume, [option]}) end - def consume(transport, option) do + def consume(%WebRtcTransport{} = transport, option) do consume(transport, Consumer.Options.from_map(option)) end @@ -243,7 +243,7 @@ defmodule Mediasoup.WebRtcTransport do GenServer.call(pid, {:consume_data, [option]}) end - def consume_data(transport, option) do + def consume_data(%WebRtcTransport{} = transport, option) do consume_data(transport, DataConsumer.Options.from_map(option)) end @@ -257,7 +257,7 @@ defmodule Mediasoup.WebRtcTransport do GenServer.call(pid, {:produce, [option]}) end - def produce(transport, %{} = option) do + def produce(%WebRtcTransport{} = transport, %{} = option) do produce(transport, Producer.Options.from_map(option)) end @@ -271,7 +271,7 @@ defmodule Mediasoup.WebRtcTransport do GenServer.call(pid, {:produce_data, [option]}) end - def produce_data(transport, %{} = option) do + def produce_data(%WebRtcTransport{} = transport, %{} = option) do produce_data(transport, DataProducer.Options.from_map(option)) end