/
rtp.ex
83 lines (70 loc) · 2.08 KB
/
rtp.ex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
defmodule Membrane.RTP do
@moduledoc """
This module provides caps struct for RTP packet.
"""
@typedoc """
RTP payload type that is statically mapped to encoding and clock rate.
"""
@type static_payload_type_t :: 0..95
@typedoc """
RTP payload type that can be dynamically mapped to encoding and clock rate.
"""
@type dynamic_payload_type_t :: 96..127
@typedoc """
RTP payload type.
"""
@type payload_type_t() :: static_payload_type_t() | dynamic_payload_type_t()
@typedoc """
Predefined names of encoding for static payload types (< 96).
"""
@type static_encoding_name_t() ::
:PCMU
| :GSM
| :G732
| :DVI4
| :LPC
| :PCMA
| :G722
| :L16
| :QCELP
| :CN
| :MPA
| :G728
| :G729
| :CELB
| :JPEG
| :NV
| :H261
| :MPV
| :MP2T
| :H263
@typedoc """
Dynamically assigned encoding names for payload types >= 96
They should be atoms matching the encoding name in SDP's attribute `rtpmap`. This is usually defined by
RFC for that payload format (e.g. for H264 there's RFC 6184 defining it must be "H264", so the atom `:H264` should be used
https://tools.ietf.org/html/rfc6184#section-8.2.1)
"""
@type dynamic_encoding_name_t() :: atom()
@typedoc """
Encoding name of RTP payload.
"""
@type encoding_name_t() :: static_encoding_name_t | dynamic_encoding_name_t()
@typedoc """
Rate of the clock used for RTP timestamps in Hz
"""
@type clock_rate_t() :: non_neg_integer()
@typedoc """
The source of a stream of RTP packets, identified by a 32-bit numeric identifier.
"""
@type ssrc_t() :: pos_integer()
@type t() :: %__MODULE__{}
defstruct []
@doc """
Determines if payload type is `t:static_payload_type_t/0`.
"""
defguard is_payload_type_static(payload_type) when payload_type in 0..95
@doc """
Determines if payload type is `t:dynamic_payload_type_t/0`.
"""
defguard is_payload_type_dynamic(payload_type) when payload_type in 96..127
end