reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
GstRtpManager.cxx
Go to the documentation of this file.
1#include "GstRtpManager.hxx"
2
3#include <regex>
4
5#include "GStreamerUtils.hxx"
6
7#ifdef USE_GSTREAMER
8
9using namespace resipgst;
10using namespace resip;
11using namespace Glib;
12using namespace Gst;
13using namespace std;
14
15#define RESIPROCATE_SUBSYSTEM resip::GstSubsystem::GSTREAMER
16
17
18/*
19 * Initiating a call:
20 * - reserve ports
21 * - create local UDP sockets
22 * - generate SDP offer
23 * - receive SDP answer
24 * - intersect offer and answer
25 * - create decoders
26 * - create encoders
27 *
28 * Receiving a call:
29 * - receive SDP offer
30 * - reserve ports
31 * - create local UDP sockets
32 * - generate SDP answer (intersects with offer)
33 * - create decoders
34 * - create encoders
35 */
36
37
38GstRtpManager::GstRtpManager(const resip::Data& localAddress)
39 : mLocalAddress(localAddress),
41{
43}
44
45GstRtpManager::GstRtpManager(const resip::Data& localAddress, int portRangeMin, int portRangeMax)
46 : mLocalAddress(localAddress),
48{
50}
51
52GstRtpManager::~GstRtpManager()
53{
54}
55
56void
57GstRtpManager::initCodecConfigMap()
58{
63 mCodecConfigMap.insert({"PCMU", make_shared<CodecConfig>("PCMU", "mulawdec", "mulawenc", "", "rtppcmudepay", "rtppcmupay", "", 8000, "")});
64 mCodecConfigMap.insert({"PCMA", make_shared<CodecConfig>("PCMA", "alawdec", "alawenc", "", "rtppcmadepay", "rtppcmapay", "", 8000, "")});
65
66 // FIXME - OPUS needs 2 channels?
67 mCodecConfigMap.insert({"OPUS", make_shared<CodecConfig>("OPUS", "opusdec", "opusenc", "", "rtpopusdepay", "rtpopuspay", "", 48000, "")});
68
73 // Obtain a list of all H.264 plugins currently installed with
74 // the command:
75 //
76 // gst-inspect-1.0 | grep 264
77
78 // OpenMAX IL https://www.phoronix.com/scan.php?page=news_item&px=Libav-OMX-H264-MPEG4
79 // https://www.khronos.org/openmaxil
80 // VA-API is more advanced
81 // h264omx
82 //mCodecConfigMap.insert({"H264", make_shared<CodecConfig>("H264", "avdec_h264", "avenc_h264_omx", "baseline", "rtph264depay", "rtph264pay", "h264parse", 90000, // not working
83 // "packetization-mode=0;profile-level-id=420016;max-br=5000;max-mbps=245000;max-fs=9000;max-smbps=245000;max-fps=6000;max-rcmd-nalu-size=3456000;sar-supported=16")});
84
85 // Decode: libav
86 // Encode: x264 (GPL 2) https://www.videolan.org/developers/x264.html
87 // (x264 doesn't provide a decoder)
88 // h264avx
89 //mCodecConfigMap.insert({"H264", make_shared<CodecConfig>("H264", "avdec_h264", "x264enc", "baseline", "rtph264depay", "rtph264pay", "h264parse", 90000, // works
90 // "packetization-mode=0;profile-level-id=420016;max-br=5000;max-mbps=245000;max-fs=9000;max-smbps=245000;max-fps=6000;max-rcmd-nalu-size=3456000;sar-supported=16")});
91
92 // need to recompile the package gstreamer1.0-plugins-bad selecting the openh264 config option
93 // h264o
94 mCodecConfigMap.insert({"H264", make_shared<CodecConfig>("H264", "openh264dec", "openh264enc", "baseline", "rtph264depay", "rtph264pay", "h264parse", 90000, // works for 30 seconds
95 "packetization-mode=0;profile-level-id=420016;max-br=5000;max-mbps=245000;max-fs=9000;max-smbps=245000;max-fps=6000;max-rcmd-nalu-size=3456000;sar-supported=16")});
96
97 // VA-API for AMD and Intel GPU hardware decoding / encoding
98 // improves quality while using less CPU and giving real-time performance
99 // sudo apt install gstreamer1.0-vaapi
100 // h264v
101 //mCodecConfigMap.insert({"H264", make_shared<CodecConfig>("H264", "vaapih264dec", "vaapih264enc", "constrained-baseline", "rtph264depay", "rtph264pay", "h264parse", 90000, // garbled video stream
102 // "packetization-mode=0;profile-level-id=420016;max-br=5000;max-mbps=245000;max-fs=9000;max-smbps=245000;max-fps=6000;max-rcmd-nalu-size=3456000;sar-supported=16")});
103
104 // mix and match decoder and encoder
105 // h264m-av-open
106 //mCodecConfigMap.insert({"H264", make_shared<CodecConfig>("H264", "avdec_h264", "openh264enc", "baseline", "rtph264depay", "rtph264pay", "h264parse", 90000, // works
107 // "packetization-mode=0;profile-level-id=420016;max-br=5000;max-mbps=245000;max-fs=9000;max-smbps=245000;max-fps=6000;max-rcmd-nalu-size=3456000;sar-supported=16")});
108 // h264m-vaapi-x264
109 //mCodecConfigMap.insert({"H264", make_shared<CodecConfig>("H264", "vaapih264dec", "x264enc", "baseline", "rtph264depay", "rtph264pay", "h264parse", 90000, // works for a few seconds then replays
110 // "packetization-mode=0;profile-level-id=420016;max-br=5000;max-mbps=245000;max-fs=9000;max-smbps=245000;max-fps=6000;max-rcmd-nalu-size=3456000;sar-supported=16")});
111 // h264m-open-x264
112 //mCodecConfigMap.insert({"H264", make_shared<CodecConfig>("H264", "openh264dec", "x264enc", "baseline", "rtph264depay", "rtph264pay", "h264parse", 90000, // not working
113 // "packetization-mode=0;profile-level-id=420016;max-br=5000;max-mbps=245000;max-fs=9000;max-smbps=245000;max-fps=6000;max-rcmd-nalu-size=3456000;sar-supported=16")});
114 // h264m-vaapi-open
115 //mCodecConfigMap.insert({"H264", make_shared<CodecConfig>("H264", "vaapih264dec", "openh264enc", "baseline", "rtph264depay", "rtph264pay", "h264parse", 90000, // works
116 // "packetization-mode=0;profile-level-id=420016;max-br=5000;max-mbps=245000;max-fs=9000;max-smbps=245000;max-fps=6000;max-rcmd-nalu-size=3456000;sar-supported=16")});
117 // h264m-av-vaapi
118 //mCodecConfigMap.insert({"H264", make_shared<CodecConfig>("H264", "avdec_h264", "vaapih264enc", "constrained-baseline", "rtph264depay", "rtph264pay", "h264parse", 90000, // not working
119 // "packetization-mode=0;profile-level-id=420016;max-br=5000;max-mbps=245000;max-fs=9000;max-smbps=245000;max-fps=6000;max-rcmd-nalu-size=3456000;sar-supported=16")});
120
121 // VP8 with the open source reference implementation
122 // vp8
123 mCodecConfigMap.insert({"VP8", make_shared<CodecConfig>("VP8", "vp8dec", "vp8enc", "", "rtpvp8depay", "rtpvp8pay", "vp8parse", 90000, "profile-level-id=HiP")});
124}
125
126#endif
127
128/* ====================================================================
129 *
130 * Copyright (c) 2022, Software Freedom Institute https://softwarefreedom.institute
131 * Copyright (c) 2022, Daniel Pocock https://danielpocock.com
132 *
133 * Redistribution and use in source and binary forms, with or without
134 * modification, are permitted provided that the following conditions
135 * are met:
136 *
137 * 1. Redistributions of source code must retain the above copyright
138 * notice, this list of conditions and the following disclaimer.
139 *
140 * 2. Redistributions in binary form must reproduce the above copyright
141 * notice, this list of conditions and the following disclaimer in
142 * the documentation and/or other materials provided with the
143 * distribution.
144 *
145 * 3. Neither the name of the author(s) nor the names of any contributors
146 * may be used to endorse or promote products derived from this software
147 * without specific prior written permission.
148 *
149 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS "AS IS" AND
150 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
151 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
152 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
153 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
154 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
155 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
156 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
157 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
158 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
159 * SUCH DAMAGE.
160 *
161 * ====================================================================
162 *
163 *
164 */
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
dcm! – add UnusedChecking(_enum) below;
void list()
Definition userAdmin.cxx:66