reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
GstRemoteParticipant.hxx
Go to the documentation of this file.
1#if !defined(GstRemoteParticipant_hxx)
2#define GstRemoteParticipant_hxx
3
4#include <functional>
5#include <map>
6
9
11#include "Participant.hxx"
12#include "RemoteParticipant.hxx"
14#include "GstParticipant.hxx"
15
21
22#include <memory>
23
24#include <gst/sdp/gstsdpmessage.h>
25#include <glibmm/object.h>
26
27#include <gst/webrtc/webrtc.h>
28
29namespace resip
30{
31class DialogUsageManager;
32class SipMessage;
33}
34
35// Disable warning 4250
36// VS2019 give a 4250 warning:
37// GstRemoteParticipant.hxx(80,1): warning C4250: 'recon::GstRemoteParticipant': inherits 'recon::RemoteParticipant::recon::RemoteParticipant::addToConversation' via dominance
38#if defined(WIN32) && !defined(__GNUC__)
39#pragma warning( disable : 4250 )
40#endif
41
42namespace recon
43{
44class GstMediaStackAdapter;
45
52class GstRemoteParticipant : public virtual RemoteParticipant, public virtual GstParticipant
53{
54public:
60
65
66 virtual ~GstRemoteParticipant();
67
68 virtual void buildSdpOffer(bool holdSdp, CallbackSdpReady sdpReady, bool preferExistingSdp = false);
69
70 virtual int getConnectionPortOnBridge();
71 virtual bool hasInput() { return true; }
72 virtual bool hasOutput() { return true; }
73 virtual int getMediaConnectionId();
74
75 virtual void applyBridgeMixWeights() override;
77
78 virtual void adjustRTPStreams(bool sendingOffer=false);
79
80 void onIceGatheringDone() { mIceGatheringDone = true; };
81
82 virtual void addToConversation(Conversation *conversation, unsigned int inputGain = 100, unsigned int outputGain = 100) override;
83 virtual void removeFromConversation(Conversation *conversation) override;
84
85 //virtual std::shared_ptr<gstreamer::BaseRtpEndpoint> getEndpoint() { return mEndpoint; }; // FIXME Gst
86 //std::shared_ptr<gstreamer::MediaElement> mMultiqueue; // FIXME Gst
87 bool mWaitingModeVideo = false;
88 //std::shared_ptr<gstreamer::PlayerEndpoint> mPlayer; // FIXME Gst
89 //std::shared_ptr<gstreamer::PassThroughElement> mPassThrough; // FIXME Gst
90
91 virtual void waitingMode();
92 //virtual std::shared_ptr<gstreamer::MediaElement> getWaitingModeElement();
93
96
97 virtual void requestKeyframe() override;
98
99protected:
100 virtual bool mediaStackPortAvailable();
101
103
104 virtual bool holdPreferExistingSdp() override { return true; };
105
106private:
107 void initRtpManager();
108 void initRtpSession(bool isWebRTC);
109 //gstreamer::BaseRtpEndpoint* newEndpoint();
110 virtual void linkOutgoingPipeline(unsigned int streamId, Glib::RefPtr<Gst::Bin> bin, const Glib::RefPtr<Gst::Caps> caps);
111 virtual void prepareStream(unsigned int streamId, bool loopbackMode);
112 virtual bool initEndpointIfRequired(bool isWebRTC);
113 //virtual void doIceGathering(gstreamer::ContinuationString sdpReady);
114 //typedef Glib::ustring StreamKey;
115 virtual bool isWebRTCSession() const;
116 virtual void onMediaSourceAdded(const Glib::RefPtr<Gst::Pad>& pad);
117 virtual Glib::RefPtr<Gst::Bin> createIncomingPipeline(Glib::RefPtr<Gst::Pad> pad);
118 virtual void debugGraph();
119 virtual void createAndConnectElements(bool isWebRTC, std::function<void()> cConnected, CallbackSdpReady sdpReady);
120 virtual void createAndConnectElementsWebRTC(std::function<void()> cConnected, CallbackSdpReady sdpReady);
121 virtual void createAndConnectElementsStandard(std::function<void()> cConnected, CallbackSdpReady sdpReady);
122 virtual void setLocalDescription(GstWebRTCSessionDescription* gstwebrtcdesc);
123 virtual void setRemoteDescription(GstWebRTCSessionDescription* gstwebrtcdesc);
124 virtual void buildSdpAnswer(const resip::SdpContents& offer, CallbackSdpReady sdpReady) override;
125
126 bool onGstBusMessage(const Glib::RefPtr<Gst::Bus>&, const Glib::RefPtr<Gst::Message>& message);
127 virtual void onRemoteIceCandidate(const resip::Data& candidate, unsigned int lineIndex, const resip::Data& mid);
128
129 //std::shared_ptr<gstreamer::BaseRtpEndpoint> mEndpoint;
130 volatile bool mIceGatheringDone; // FIXME Gst use a concurrency primitive, e.g. condition_variable
131
132 std::chrono::time_point<std::chrono::steady_clock> mLastLocalKeyframeRequest = std::chrono::steady_clock::now();
133
134 Glib::RefPtr<Gst::Caps> mCapsVideo;
135 Glib::RefPtr<Gst::Caps> mCapsAudio;
136
137public: // FIXME
143 bool mWaitingAnswer; // have sent an offer, waiting for peer to send answer
144 bool mTrickleIcePermitted = false; // FIXME - complete
145 bool mWebRTCOutgoing = false; // FIXME - use WebRTC for outgoing call
146
147 //GstElement* mPipeline;
148 //GstElement* mRtpTransportElement;
149 Glib::RefPtr<Gst::Pipeline> mPipeline;
150 Glib::RefPtr<Gst::Element> mMediaBin;
151 Glib::RefPtr<Gst::Element> mRtpTransportElement;
152
153 //std::map<MediaTypeName, Glib::RefPtr<Gst::Bin>> mDecodes;
154 //std::map<StreamKey, Glib::RefPtr<Gst::Bin>> mEncodes;
155 //std::map<MediaTypeName, Glib::RefPtr<Gst::Pad>> mEncodes;
156
157 std::function<void(const Glib::RefPtr<Gst::Pad>& pad)> mPadAdded;
158
159 /*class MyWebRTCElement : public Gst::Element
160 {
161 public:
162 MyWebRTCElement() : Gst::Element(Glib::ConstructParams()) {};
163 };*/
164
165 std::shared_ptr<resipgst::GstRtpManager> mRtpManager = 0; // FIXME - move to MediaStackAdapter
166 std::shared_ptr<resipgst::GstRtpSession> mRtpSession = 0;
167};
168
169}
170
171#endif
172
173
174/* ====================================================================
175
176 Copyright (c) 2022, Software Freedom Institute https://softwarefreedom.institute
177 Copyright (c) 2022, Daniel Pocock https://danielpocock.com
178 Copyright (c) 2021, SIP Spectrum, Inc. www.sipspectrum.com
179 Copyright (c) 2007-2008, Plantronics, Inc.
180 All rights reserved.
181
182 Redistribution and use in source and binary forms, with or without
183 modification, are permitted provided that the following conditions are
184 met:
185
186 1. Redistributions of source code must retain the above copyright
187 notice, this list of conditions and the following disclaimer.
188
189 2. Redistributions in binary form must reproduce the above copyright
190 notice, this list of conditions and the following disclaimer in the
191 documentation and/or other materials provided with the distribution.
192
193 3. Neither the name of Plantronics nor the names of its contributors
194 may be used to endorse or promote products derived from this
195 software without specific prior written permission.
196
197 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
198 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
199 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
200 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
201 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
202 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
203 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
204 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
205 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
206 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
207 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
208
209 ==================================================================== */
static const Data pad("\0\0\0\0\0\0\0", 7)
This class is one of two main classes of concern to an application using the UserAgent library.
This class is used to manage membership of participants.
This class is one of two main classes of concern to an application using the UserAgent library.
This is the base class for a GstRemoteParticipant, GstLocalParticipant and a GstMediaResourceParticip...
This class is used by Invite DialogSets.
This class represent a remote participant.
virtual void applyBridgeMixWeights() override
std::function< void(const Glib::RefPtr< Gst::Pad > &pad)> mPadAdded
virtual void buildSdpOffer(bool holdSdp, CallbackSdpReady sdpReady, bool preferExistingSdp=false)
virtual bool onMediaControlEvent(resip::MediaControlContents::MediaControl &mediaControl)
virtual void requestKeyframe() override
Glib::RefPtr< Gst::Element > mRtpTransportElement
virtual void removeFromConversation(Conversation *conversation) override
Glib::RefPtr< Gst::Element > mMediaBin
virtual void adjustRTPStreams(bool sendingOffer=false)
std::shared_ptr< resipgst::GstRtpSession > mRtpSession
std::shared_ptr< resipgst::GstRtpManager > mRtpManager
virtual bool onTrickleIce(resip::TrickleIceContents &trickleIce) override
virtual GstRemoteParticipantDialogSet & getGstDialogSet()
virtual void addToConversation(Conversation *conversation, unsigned int inputGain=100, unsigned int outputGain=100) override
virtual bool holdPreferExistingSdp() override
Glib::RefPtr< Gst::Pipeline > mPipeline
This class is used by Invite DialogSets.
This class represent a remote participant.
std::function< void(bool sdpOk, std::unique_ptr< resip::SdpContents > sdp)> CallbackSdpReady
RemoteParticipantDialogSet & getDialogSet()
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
Provides an interface to process and generate SDP bodies (MIME content-type application/sdp).
unsigned int ParticipantHandle
dcm! – add UnusedChecking(_enum) below;
void list()
Definition userAdmin.cxx:66