Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
LVala committed Jun 21, 2024
1 parent 5bb3a61 commit ed0ffaf
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/ex_webrtc/rtp_receiver.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ defmodule ExWebRTC.RTPReceiver do
require Logger

alias ExRTCP.Packet.TransportFeedback.NACK
alias ExSDP.Attribute.Extmap
alias ExWebRTC.{MediaStreamTrack, Utils, RTPCodecParameters}
alias __MODULE__.{NACKGenerator, ReportRecorder, SimulcastDemuxer}

Expand All @@ -28,8 +29,8 @@ defmodule ExWebRTC.RTPReceiver do
bytes_received: non_neg_integer(),
packets_received: non_neg_integer(),
markers_received: non_neg_integer(),
report_recorder: ReportRecorder.t() | nil,
nack_generator: NACKGenerator.t() | nil
report_recorder: ReportRecorder.t(),
nack_generator: NACKGenerator.t()
}

@typedoc """
Expand Down Expand Up @@ -58,9 +59,7 @@ defmodule ExWebRTC.RTPReceiver do
end

@doc false
@spec new(MediaStreamTrack.t(), RTPCodecParameters.t() | nil, [ExSDP.Attribute.Extmap.t()], [
atom()
]) ::
@spec new(MediaStreamTrack.t(), RTPCodecParameters.t() | nil, [Extmap.t()], [atom()]) ::
receiver()
def new(track, codec, rtp_hdr_exts, features) do
# layer `nil` is for the packets without RID/ no simulcast
Expand All @@ -76,10 +75,7 @@ defmodule ExWebRTC.RTPReceiver do
end

@doc false
@spec update(receiver(), RTPCodecParameters.t() | nil, [ExSDP.Attribute.Extmap.t()], [
String.t()
]) ::
receiver()
@spec update(receiver(), RTPCodecParameters.t() | nil, [Extmap.t()], [String.t()]) :: receiver()
def update(receiver, codec, rtp_hdr_exts, stream_ids) do
simulcast_demuxer = SimulcastDemuxer.update(receiver.simulcast_demuxer, rtp_hdr_exts)
track = %MediaStreamTrack{receiver.track | streams: stream_ids}
Expand Down Expand Up @@ -115,7 +111,7 @@ defmodule ExWebRTC.RTPReceiver do
{rid, simulcast_demuxer} = SimulcastDemuxer.demux_packet(receiver.simulcast_demuxer, packet)
layer = receiver.layers[rid] || init_layer(receiver.codec)

# we only turn off the actual recording when features are not on
# we only turn off the actual recording when features are not on,
# other stuff (like updating some metadata in the recorders etc)
# does not meaningfully impact performance
report_recorder =
Expand Down

0 comments on commit ed0ffaf

Please sign in to comment.