120 return receiver_thread;
128 tx_frame = m_fec_state->encode(tx_frame);
131 auto data =
new pair<ultragrid_rtp_video_rxtx *, shared_ptr<video_frame>>(
this, tx_frame);
133 unique_lock<mutex> lk(m_async_sending_lock);
134 m_async_sending_cv.wait(lk, [
this]{
return !m_async_sending;});
135 m_async_sending =
true;
141 auto data = (pair<ultragrid_rtp_video_rxtx *, shared_ptr<video_frame>> *) arg;
143 data->first->send_frame_async(data->second);
165 struct timeval timeout { 0, 0 };
214 1.0 /
msg->new_desc.fps);
221 assert(0 &&
"Wrong message passed to ultragrid_rtp_video_rxtx::receiver_process_messages()");
249 if(!video_decoder_state) {
255 free(video_decoder_state);
265 if(!
state->decoder) {
266 fprintf(stderr,
"Error initializing decoder (incorrect '-M' or '-p' option?).\n");
287 if(shared_decoder == NULL) {
288 fprintf(stderr,
"Unable to create decoder!\n");
299 struct timeval timeout;
318 if ((curr_time - last_not_timeout) >
NS_IN_SEC) {
319 timeout.tv_usec = 100000;
321 timeout.tv_usec = 1000;
331 last_not_timeout = curr_time;
356 supp_for_mult_sources.
val =
false;
360 if (supp_for_mult_sources.
val ==
false) {
374 "participant %u.\n", cp->
ssrc);
389 if(vdecoder_state && vdecoder_state->
decoded % 100 == 99) {
391 if(new_size > last_buf_size) {
393 debug_msg(
"Recv buffer adjusted to %d\n", new_size);
397 last_buf_size = new_size;
struct video_desc video_desc_from_frame(const struct video_frame *frame)
Returns struct video_desc from video frame.
std::mutex m_network_devices_lock
static struct rtp * initialize_network(const char *addrs, int recv_port_base, int send_port_base, struct pdb *participants, int force_ip_version, const char *mcast_if, int ttl)
struct rtp * m_network_device
static void destroy_rtp_device(struct rtp *network_devices)
struct pdb * m_participants
std::string m_requested_receiver
static void display_buf_increase_warning(int size)
static void * send_frame_async_callback(void *arg)
struct display * m_display_device
std::mutex m_async_sending_lock
virtual void send_frame_async(std::shared_ptr< video_frame >)
void remove_display_from_decoders()
std::list< struct display * > m_display_copies
struct vcodec_state * new_video_decoder(struct display *d)
virtual void send_frame(std::shared_ptr< video_frame >) noexcept override
virtual ~ultragrid_rtp_video_rxtx()
virtual void *(*)(void *arg) get_receiver_thread() noexcept
struct control_state * m_control
std::condition_variable m_async_sending_cv
enum video_mode m_decoder_mode
void receiver_process_messages()
static void destroy_video_decoder(void *state)
ultragrid_rtp_video_rxtx(std::map< std::string, param_u > const &)
static void * receiver_thread(void *arg)
void log_msg(int level, const char *format,...)
#define LOG_LEVEL_NOTICE
information that may be interesting
#define LOG_LEVEL_ERROR
general errors
#define debug_msg(...)
#define debug_msg(...) log_msg(LOG_LEVEL_DEBUG, "[pid/%d +%d %s] ", getpid(), LINE,...
#define LOG_LEVEL_FATAL
errors that prevent UG run
bool display_put_frame(struct display *d, struct video_frame *frame, long long timeout_ns)
Puts filled video frame. After calling this function, video frame cannot be used.
bool display_ctl_property(struct display *d, int property, void *val, size_t *len)
Gets property from video display.
void display_done(struct display *d)
This function performs cleanup after done.
@ DISPLAY_PROPERTY_SUPPORTS_MULTI_SOURCES
struct module * get_module(struct module *root, const char *const_path)
struct module * get_root_module(struct module *node)
void video_decoder_destroy(struct state_video_decoder *decoder)
Destroys decoder created with decoder_init()
void video_decoder_remove_display(struct state_video_decoder *decoder)
This removes display from current decoder.
int decode_video_frame(struct coded_data *cdata, void *decoder_data, struct pbuf_stats *stats)
Decodes a participant buffer representing one video frame.
const char * get_commandline_param(const char *key)
@ LIBRARY_CLASS_VIDEO_RXTX
#define REGISTER_MODULE(name, info, lclass, abi)
Registers module to global modules' registry.
void free_message(struct message *msg, struct response *r)
struct response * new_response(int status, const char *text)
struct message * check_message(struct module *mod)
@ RECEIVER_MSG_CHANGE_RX_PORT
@ RECEIVER_MSG_VIDEO_PROP_CHANGED
#define RESPONSE_INT_SERV_ERR
int pbuf_decode(struct pbuf *playout_buf, time_ns_t curr_time, decode_frame_t decode_func, void *data)
void pbuf_set_playout_delay(struct pbuf *playout_buf, double playout_delay)
int pbuf_is_empty(struct pbuf *playout_buf)
void pbuf_remove(struct pbuf *playout_buf, time_ns_t curr_time)
void pdb_iter_done(pdb_iter_t *it)
struct pdb_e * pdb_iter_next(pdb_iter_t *it)
struct pdb_e * pdb_iter_init(struct pdb *db, pdb_iter_t *it)
bool rtp_set_recv_buf(struct rtp *session, int bufsize)
void rtp_update(struct rtp *session, time_ns_t curr_time)
uint32_t rtp_my_ssrc(struct rtp *session)
void rtp_send_ctrl(struct rtp *session, uint32_t rtp_ts, rtcp_app_callback appcallback, time_ns_t curr_time)
int rtp_get_recv_buf(struct rtp *session)
bool rtp_recv_r(struct rtp *session, struct timeval *timeout, uint32_t curr_rtp_ts)
Receive RTP packets and dispatch them.
bool rtcp_recv_r(struct rtp *session, struct timeval *timeout, uint32_t curr_rtp_ts)
This struct represents initialized video display state.
struct display *(* fork_display)(void *state)
decoder_state_deleter_t decoder_state_deleter
decoder state deleter
void * decoder_state
state of decoder for participant
struct pbuf * playout_buffer
unsigned int max_frame_size
struct state_video_decoder * decoder
struct module m_receiver_mod
struct common_opts m_common
double tfrc_feedback_txrate(struct tfrc *state, time_ns_t curr_time)
int tfrc_feedback_is_due(struct tfrc *state, time_ns_t curr_time)
void set_thread_name(const char *name)
void tx_send(struct tx *tx, struct video_frame *frame, struct rtp *rtp_session)
static time_ns_t get_time_in_ns()
static video_rxtx * create_video_rxtx_ultragrid_rtp(std::map< std::string, param_u > const ¶ms)
static const struct video_rxtx_info ultragrid_rtp_video_rxtx_info
This is an umbrella header for video functions.
API for video compress drivers.
struct state_video_decoder * video_decoder_init(struct module *parent, enum video_mode video_mode, struct display *display, const char *encryption)
Initializes video decompress state.
API for video decompress drivers.
#define VIDEO_RXTX_ABI_VERSION
void task_run_async_detached(runnable_t task, void *data)
Runs task asynchronously in a detached state.