/** Node type: rtp * * @file * @author Steffen Vogel * @author Marvin Klimke * @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC * @license GNU General Public License (version 3) * * VILLASnode * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . *********************************************************************************/ /** * @addtogroup rtp rtp node type * @ingroup node * @{ */ #pragma once #include #include #include #include #include #include #include #include #include #include extern "C" { #include #include } /* Forward declarations */ struct format_type; /** The maximum length of a packet which contains rtp data. */ #define RTP_INITIAL_BUFFER_LEN 1500 #define RTP_PACKET_TYPE 21 enum class RTPHookType { DISABLED, DECIMATE, LIMIT_RATE }; struct rtp { struct rtp_sock *rs; /**< RTP socket */ villas::Logger logger; struct { struct sa saddr_rtp; /**< Local/Remote address of the RTP socket */ struct sa saddr_rtcp; /**< Local/Remote address of the RTCP socket */ } in, out; struct format_type *format; struct io io; struct { int enabled; int num_rrs; } rtcp; struct { double a; double b; enum RTPHookType rate_hook_type; villas::node::LimitHook *rate_hook; villas::dsp::PID rate_pid; /* PID parameters for rate controller */ double Kp, Ki, Kd; double rate_min; double rate; double rate_last; double rate_source; /**< Sample rate of source */ std::ofstream *log; char *log_filename; } aimd; /** AIMD state */ struct queue_signalled recv_queue; struct mbuf *send_mb; }; /** @see node_type::print */ char * rtp_print(struct vnode *n); /** @see node_type::parse */ int rtp_parse(struct vnode *n, json_t *cfg); /** @see node_type::start */ int rtp_start(struct vnode *n); /** @see node_type::stop */ int rtp_stop(struct vnode *n); /** @see node_type::read */ int rtp_read(struct vnode *n, struct sample *smps[], unsigned cnt, unsigned *release); /** @see node_type::write */ int rtp_write(struct vnode *n, struct sample *smps[], unsigned cnt, unsigned *release); /** @} */