9#include <gst/rtp/gstrtcpbuffer.h>
11#include <gstreamermm.h>
26#define RESIPROCATE_SUBSYSTEM resip::GstSubsystem::GSTREAMER
43 default:
return Log::None;
87 testSrc = Parse::create_bin(
"audiotestsrc is-live=true wave=red-noise ! audioconvert ! audioresample",
true);
91 testSrc = Parse::create_bin(
"videotestsrc is-live=true pattern=ball ! videoconvert",
true);
106 ErrLog(<<
"caps is empty");
124 if(
caps->get_structure(0).has_field(
"media"))
135resip::getStreamIdFromPadName(
const Glib::ustring
padName)
140 std::regex r(
"recv_rtp_src_(\\d+)_(\\d+)_(\\d+)");
142 const std::string&
s =
padName.raw();
143 if(std::regex_search(
s.begin(),
s.end(),
match, r))
152 if(std::regex_search(
s.begin(),
s.end(),
match, r))
167resip::deduceKeyForPadName(
const Glib::ustring
padName)
169 StackLog(<<
"trying to extract pt from pad name");
170 std::regex r(
"recv_rtp_src_(\\d+)_(\\d+)_(\\d+)");
172 const std::string&
s =
padName.raw();
173 if (std::regex_search(
s.begin(),
s.end(),
match, r))
176 StackLog(<<
"found payload type: " << pt);
193 if (std::regex_search(
s.begin(),
s.end(),
match, r))
199 case 0:
return "audio";
200 case 1:
return "video";
231 StackLog(<<
"text from gst_sdp_message_as_text: " << text);
233 Mime type(
"application",
"sdp");
239std::shared_ptr<GstWebRTCSessionDescription>
242 std::ostringstream
sdpBuf;
249 ErrLog(<<
"failed to create GstSDPMessage");
259resip::addGstreamerKeyframeProbe(
const Glib::RefPtr<Gst::Pad>&
pad, std::function<
void()>
onKeyframeRequired)
264 DebugLog(<<
"received event on video stream");
268 event->has_name(
"GstForceKeyUnit"))
270 DebugLog(<<
"gstreamer decoder wants a keyframe");
289 if((
src->get_name().find(
"rtcp") != ustring::npos) &&
peer)
299 src->link(
tee->get_static_pad(
"sink"));
308 tee->sync_state_with_parent();
341 stream <<
"\"report_blocks\":[";
344 for (
i = 0;
i < count;
i++)
353 stream << (
i>0 ?
",":
"") <<
"{"
354 <<
"\"source_ssrc\":" << ssrc <<
","
357 <<
"\"ia_jitter\":" << jitter <<
","
359 <<
"\"lsr\":" << lsr <<
","
360 <<
"\"dlsr\":" << dlsr
364 stream <<
"],\"report_count\":" << count;
379 stream <<
"\"sender_information\":{"
380 <<
"\"ntp_timestamp_sec\":" << (
ntptime >> 32) <<
","
381 <<
"\"ntp_timestamp_usec\":" << (
ntptime & 0xffff) <<
","
383 <<
"\"rtp_timestamp\":" <<
rtptime <<
","
387 stream <<
",\"ssrc\":" << ssrc
388 <<
",\"type\":" << 200;
402 <<
",\"type\":" << 201;
413 ErrLog(<<
"__buffer is NULL");
424 StackLog(<<
"found GstMeta on RTCP");
449 ErrLog(<<
"_buffer validation failed");
456 ErrLog(<<
"gst_rtcp_buffer_map failed");
471 StackLog(<<
"processing a GstRTCPPacket, type: " << type);
481 WarningLog(<<
"unhandled RTCP packet type: " << type);
494 ErrLog(<<
"no JSON created");
513 if(
bin->get_name() ==
"webrtcbin0")
515 rtpbin = RefPtr<Bin>::cast_dynamic(
bin->get_element(
"rtpbin"));
517 else if(
bin->get_name() ==
"rtpbin" ||
bin->get_name() ==
"rtpbin0")
523 ErrLog(<<
"failed to find rtpbin");
571 DebugLog(<<
"on-receiving-rtcp invoked");
577 DebugLog(<<
"on-sending-rtcp invoked");
616 if(
padName.substr(0, 9) ==
"outbound_")
619 source =
ps.local.toGenericIPAddress();
620 destination =
ps.remote.toGenericIPAddress();
622 else if(
padName.substr(0, 8) ==
"inbound_")
624 source =
ps.remote.toGenericIPAddress();
625 destination =
ps.local.toGenericIPAddress();
633 <<
" destination " << destination
634 <<
" direction " << (
inbound ?
"inbound" :
"outbound"));
638 appSink->property_emit_signals() =
true;
642 StackLog(<<
"got an RTCP sample, caps = " <<
sample->get_caps()->to_string());
646 ErrLog(<<
"sample doesn't contain a buffer");
653 appSink->sync_state_with_parent();
669 SdpContents::Session::MediumContainer::const_iterator
iLocal =
local.session().media().cbegin();
670 SdpContents::Session::MediumContainer::const_iterator
iRemote =
remote.session().media().cbegin();
672 while((
iLocal !=
local.session().media().cend()) &&
#define RESIPROCATE_SUBSYSTEM
static const Data pad("\0\0\0\0\0\0\0", 7)
static bool genericLogCheckLevel(resip::Log::Level level, const resip::Subsystem &sub)
#define WarningLog(args_)
#define resip_assert(x)
This file needs to work for both C and C++ code.
An iostream that operates on an existing Data.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Implementation for logging macros.
Represents the "media-type" element in the RFC 3261 grammar.
process m= (media announcement) blocks
const std::list< Connection > getConnections() const
get a list of Connection objects, including the Session's c= line.
int firstRtcpPort() const
get the value of the first specified RTCP port or if no rtcp: attribute found, the default port() val...
Provides an interface to process and generate SDP bodies (MIME content-type application/sdp).
Class used to specify what sub-system given sections of code belong to, for use by the logging system...
Represents a network address.
dcm! – add UnusedChecking(_enum) below;
TransportType
An enumeration of transport protocols.
Represents an IP-address and port (V4 or V6).