![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include <array>#include <cinttypes>#include <cstdio>#include <cstdlib>#include <cstring>#include <iomanip>#include <memory>#include <sstream>#include <string>#include "../export.h"#include "audio/audio.h"#include "audio/audio_capture.h"#include "audio/audio_filter.h"#include "audio/audio_playback.h"#include "audio/capture/sdi.h"#include "audio/codec.h"#include "audio/echo.h"#include "audio/filter_chain.hpp"#include "audio/jack.h"#include "audio/playback/sdi.h"#include "audio/resampler.hpp"#include "audio/utils.h"#include "debug.h"#include "host.h"#include "module.h"#include "pdb.h"#include "rtp/audio_decoders.h"#include "rtp/fec.h"#include "rtp/pbuf.h"#include "rtp/rtp.h"#include "rtp/rtp_callback.h"#include "transmit.h"#include "tv.h"#include "types.h"#include "ug_runtime_error.hpp"#include "utils/color_out.h"#include "utils/net.h"#include "utils/sdp.h"#include "utils/string_view_utils.hpp"#include "utils/thread.h"#include "utils/worker.h"#include "video_rxtx.hpp"
Go to the source code of this file.
Classes | |
| struct | asend_stats_processing_data |
| struct | audio_decoder |
| struct | audio_network_parameters |
| struct | state_audio |
| struct | state_audio::audio_network_parameters |
| struct | state_audio::opts |
Macros | |
| #define | DEFAULT_AUDIO_RECV_BUF_SIZE (256 * 1024) |
| #define | MOD_NAME "[audio] " |
Typedefs | |
| typedef void(* | audio_device_help_t) (void) |
Enumerations | |
| enum | audio_transport_device { NET_NATIVE , NET_JACK , NET_STANDARD } |
Functions | |
| static void * | asend_compute_and_print_stats (void *arg) |
| static void | audio_channel_map_usage (void) |
| static struct audio_decoder * | audio_decoder_state_create (struct state_audio *s) |
| static void | audio_decoder_state_deleter (void *state) |
| void | audio_done (struct state_audio *s) |
| unsigned int | audio_get_display_flags (struct state_audio *s) |
| int | audio_init (struct state_audio **ret, const struct audio_options *opt, const struct common_opts *common) |
| void | audio_join (struct state_audio *s) |
| static struct response * | audio_receiver_process_message (struct state_audio *s, struct msg_receiver *msg) |
| static void * | audio_receiver_thread (void *arg) |
| void | audio_register_aux_data (struct state_audio *s, struct additional_audio_data data) |
| static void | audio_scale_usage (void) |
| void | audio_sdi_send (struct state_audio *s, struct audio_frame *frame) |
| static struct response * | audio_sender_process_message (struct state_audio *s, struct msg_sender *msg) |
| static void * | audio_sender_thread (void *arg) |
| void | audio_start (struct state_audio *s) |
| static void | audio_update_recv_buf (struct state_audio *s, size_t curr_frame_len) |
| static int | find_codec_sample_rate (int sample_rate, const int *supported) |
| static struct rtp * | initialize_audio_network (struct audio_network_parameters *params) |
| std::ostream & | operator<< (std::ostream &os, const audio_desc &desc) |
| static void | process_statistics (struct state_audio *s, audio_frame2 *buffer) |
| void | sdp_send_change_address_message (struct module *root, const enum module_class *path, const char *address) |
| static void | set_audio_spec_to_vrxtx (struct video_rxtx *vrxtx, audio_frame2 *compressed_frm, struct rtp *netdev, int tx_port, bool *audio_spec_to_vrxtx_set) |
| static void | should_exit_audio (void *state) |
| #define DEFAULT_AUDIO_RECV_BUF_SIZE (256 * 1024) |
Definition at line 109 of file audio.cpp.
Referenced by initialize_audio_network().
| #define MOD_NAME "[audio] " |
Definition at line 110 of file audio.cpp.
Referenced by ultragrid::aja::display::display(), audio_init(), audio_sender_thread(), check_reconf(), check_state_count(), debug_print_metadata_id(), display_conference_init(), display_conference_worker(), display_decklink_init(), display_decklink_put_audio_frame(), display_decklink_reconfigure_audio(), display_pw_init(), AudioDriftFixer::enable(), keyboard_control::impl::exec_local_command(), get_ansi_code(), bmd_option::get_flag(), bmd_option::get_int(), keyboard_control::impl::get_next_key(), get_utf8_code(), keycontrol_register_key(), keycontrol_send_key(), on_add_buffer(), on_param_changed(), on_state_changed(), print_output_modes(), ultragrid::aja::display::print_stats(), ultragrid::aja::display::process_frames(), ultragrid::aja::display::Putf(), ultragrid::aja::display::RouteOutputSignal(), keyboard_control::impl::run(), set_v4l2_buffers(), settings_init(), ultragrid::aja::display::SetUpVideo(), keyboard_control::impl::signal(), keyboard_control::impl::start(), try_open_v4l2_device(), and AudioDriftFixer::update().
| typedef void(* audio_device_help_t) (void) |
| Enumerator | |
|---|---|
| NET_NATIVE | |
| NET_JACK | |
| NET_STANDARD | |
|
static |
Definition at line 979 of file audio.cpp.
References calculate_rms(), format_audio_channel_volume(), LOG_LEVEL_INFO, log_msg(), STR_LEN, TBOLD, TERM_BOLD, TERM_FG_GREEN, and TRED.
Referenced by process_statistics().

|
static |
Definition at line 205 of file audio.cpp.
Referenced by audio_init().
|
static |
Definition at line 657 of file audio.cpp.
References state_audio::audio_channel_map, audio_decoder_init(), audio_decoder_set_volume(), audio_playback_ctl(), state_audio::audio_playback_device, state_audio::audio_receiver_module, state_audio::audio_scale, state_audio::muted_receiver, and state_audio::volume.
Referenced by audio_receiver_thread().

|
static |
Definition at line 674 of file audio.cpp.
References audio_decoder_destroy(), pbuf_audio_data::buffer, audio_frame::data, pbuf_audio_data::decoder, audio_decoder::pbuf_data, and state.
Referenced by audio_receiver_thread().

| void audio_done | ( | struct state_audio * | s | ) |
Definition at line 512 of file audio.cpp.
References state_audio::audio_capture_device, audio_capture_done(), audio_codec_done(), state_audio::audio_encoder, state_audio::audio_network_device, state_audio::audio_participants, state_audio::audio_playback_device, audio_playback_done(), state_audio::audio_receiver_module, audio_receiver_process_message(), state_audio::audio_sender_module, audio_sender_process_message(), CAST_MODULE, check_message(), free_message(), get_root_module(), state_audio::mod, module_done(), msg, pdb_destroy(), rtp_done(), should_exit_audio(), state_audio::tx_session, and unregister_should_exit_callback().
Referenced by main(), and vidcap_ug_input_done().

| unsigned int audio_get_display_flags | ( | struct state_audio * | s | ) |
Definition at line 1210 of file audio.cpp.
References state_audio::audio_playback_device, and audio_playback_get_display_flags().
Referenced by main().

| int audio_init | ( | struct state_audio ** | ret, |
| const struct audio_options * | opt, | ||
| const struct common_opts * | common ) |
take care that addrs can also be comma-separated list of addresses !
| 0 | state succesfully initialized |
| <0 | error occured |
| >0 | success but no state was created (eg. help printed) |
Definition at line 272 of file audio.cpp.
References state_audio::state_audio(), state_audio::audio_capture_device, audio_capture_init(), audio_capture_init_null_device(), state_audio::audio_channel_map, audio_channel_map_usage(), audio_codec_done(), audio_codec_init_cfg(), AUDIO_CODER, state_audio::audio_encoder, state_audio::audio_network_device, audio_offset, state_audio::audio_participants, audio_playback_ctl(), state_audio::audio_playback_device, audio_playback_init(), audio_playback_init_null_device(), AUDIO_PLAYBACK_PUT_NETWORK_DEVICE, state_audio::audio_receiver_thread_started, state_audio::audio_scale, audio_scale_usage(), state_audio::audio_sender_module, state_audio::audio_sender_thread_started, state_audio::audio_tx_mode, CAST_MODULE, audio_options::channel_map, audio_options::codec_cfg, audio_options::echo_cancellation, echo_cancellation_init(), state_audio::echo_state, Filter_chain::emplace_new(), common_opts::encryption, common_opts::exporter, state_audio::exporter, audio_options::fec_cfg, audio_options::filter_cfg, state_audio::filter_chain, common_opts::force_ip_version, audio_options::host, initialize_audio_network(), len, LOG, LOG_LEVEL_ERROR, log_msg(), MOD_NAME, MODE_RECEIVER, MODE_SENDER, module_done(), common_opts::mtu, NET_JACK, NET_NATIVE, NET_STANDARD, rtp::opt, common_opts::parent, parse_audio_codec_params(), pdb_destroy(), pdb_init(), state_audio::proto_cfg, state_audio::receiver, audio_options::recv_cfg, audio_options::recv_port, register_should_exit_callback(), state_audio::resample_to, audio_codec_params::sample_rate, audio_options::scale, sdp_set_options(), audio_options::send_cfg, audio_options::send_port, state_audio::sender, should_exit_audio(), common_opts::start_time, tokenize(), tx_init(), TX_MEDIA_AUDIO, and state_audio::tx_session.
Referenced by main(), and vidcap_ug_input_init().

| void audio_join | ( | struct state_audio * | s | ) |
Definition at line 502 of file audio.cpp.
References state_audio::audio_receiver_thread_id, state_audio::audio_receiver_thread_started, state_audio::audio_sender_thread_id, and state_audio::audio_sender_thread_started.
Referenced by main(), and vidcap_ug_input_done().
|
static |
Definition at line 578 of file audio.cpp.
References audio_decoder_set_volume(), state_audio::audio_network_device, state_audio::audio_participants, state_audio::audio_tx_mode, rtp::db, pdb_e::decoder_state, initialize_audio_network(), LOG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_NOTICE, log_msg(), MODE_RECEIVER, state_audio::muted_receiver, new_response(), pdb_iter_done(), pdb_iter_init(), pdb_iter_next(), RECEIVER_MSG_CHANGE_RX_PORT, RECEIVER_MSG_DECREASE_VOLUME, RECEIVER_MSG_GET_AUDIO_STATUS, RECEIVER_MSG_INCREASE_VOLUME, RECEIVER_MSG_MUTE, RECEIVER_MSG_MUTE_TOGGLE, RECEIVER_MSG_UNMUTE, RECEIVER_MSG_VIDEO_PROP_CHANGED, RESPONSE_INT_SERV_ERR, RESPONSE_OK, rtp_done(), and state_audio::volume.
Referenced by audio_done(), and audio_receiver_thread().

|
static |
Definition at line 695 of file audio.cpp.
References audio_decoder_state_create(), audio_decoder_state_deleter(), audio_desc_eq(), audio_desc_from_frame(), state_audio::audio_network_device, state_audio::audio_participants, audio_playback_ctl(), AUDIO_PLAYBACK_CTL_MULTIPLE_STREAMS, state_audio::audio_playback_device, audio_playback_put_frame(), audio_playback_reconfigure(), state_audio::audio_receiver_module, audio_receiver_process_message(), audio_update_recv_buf(), audio_desc::bps, pbuf_audio_data::buffer, audio_desc::ch_count, check_message(), audio_frame::data, audio_frame::data_len, decode_audio_frame(), decode_audio_frame_mulaw(), pdb_e::decoder_state, pdb_e::decoder_state_deleter, echo_play(), state_audio::echo_state, audio_decoder::enabled, enabled, exit_uv(), pbuf_audio_data::frame_size, free_message(), get_commandline_param(), get_time_in_ns(), state_audio::jack_connection, jack_receive(), len, LOG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_WARNING, msg, NET_NATIVE, NET_STANDARD, audio_frame::network_source, NS_IN_SEC, audio_decoder::pbuf_data, pbuf_decode(), pbuf_is_empty(), pbuf_remove(), pbuf_set_playout_delay(), pdb_iter_done(), pdb_iter_init(), pdb_iter_next(), pdb_e::playout_buffer, state_audio::receiver, rtp_flush_recv_buf(), rtp_recv_r(), rtp_send_ctrl(), rtp_update(), audio_desc::sample_rate, set_thread_name(), state_audio::should_exit, pbuf_audio_data::source, state_audio::start_time, audio_frame::timestamp, TRUE, and ts.
Referenced by audio_start().

| void audio_register_aux_data | ( | struct state_audio * | s, |
| struct additional_audio_data | data ) |
Definition at line 1191 of file audio.cpp.
References state_audio::audio_playback_device, audio_playback_get_display_flags(), audio_playback_get_state_pointer(), additional_audio_data::display_callbacks, additional_audio_data::get_property, additional_audio_data::putf, additional_audio_data::reconfigure, sdi_register_display_callbacks(), additional_audio_data::udata, additional_audio_data::vrxtx, and state_audio::vrxtx.
Referenced by main(), and vidcap_ug_input_init().

|
static |
Definition at line 219 of file audio.cpp.
Referenced by audio_init().
| void audio_sdi_send | ( | struct state_audio * | s, |
| struct audio_frame * | frame ) |
Definition at line 1179 of file audio.cpp.
References state_audio::audio_capture_device, audio_capture_get_driver_name(), audio_capture_get_state_pointer(), audio_capture_get_vidcap_flags(), frame, and sdi_capture_new_incoming_frame().
Referenced by capture_thread().

|
static |
Definition at line 866 of file audio.cpp.
References state_audio::audio_network_device, state_audio::audio_tx_mode, fec::create_from_config(), exit_uv(), state_audio::fec_state, initialize_audio_network(), LOG, LOG_LEVEL_ERROR, LOG_LEVEL_NOTICE, log_msg(), MODE_SENDER, MSG, state_audio::muted_sender, new_response(), RESPONSE_BAD_REQUEST, RESPONSE_INT_SERV_ERR, RESPONSE_OK, rtp_done(), rtp_my_ssrc(), SENDER_MSG_CHANGE_FEC, SENDER_MSG_CHANGE_PORT, SENDER_MSG_CHANGE_RECEIVER, SENDER_MSG_GET_STATUS, SENDER_MSG_MUTE, SENDER_MSG_MUTE_TOGGLE, SENDER_MSG_QUERY_VIDEO_MODE, SENDER_MSG_RESET_SSRC, and SENDER_MSG_UNMUTE.
Referenced by audio_done(), and audio_sender_thread().

|
static |
Definition at line 1072 of file audio.cpp.
References state_audio::audio_capture_device, audio_capture_read(), audio_codec_compress(), audio_codec_get_supported_samplerates(), state_audio::audio_encoder, state_audio::audio_network_device, state_audio::audio_sender_module, audio_sender_process_message(), state_audio::audio_tx_mode, audio_tx_send(), audio_tx_send_standard(), audio_frame2::change_bps(), check_message(), audio_frame::data, audio_frame::data_len, echo_cancel(), state_audio::echo_state, fec::encode(), exit_uv(), export_audio(), state_audio::exporter, state_audio::fec_state, Filter_chain::filter(), state_audio::filter_chain, find_codec_sample_rate(), free_message(), audio_frame2::get_bps(), audio_frame2::get_sample_rate(), get_time_in_ns(), state_audio::jack_connection, jack_send(), LOG_LEVEL_ERROR, log_msg(), MOD_NAME, MODE_RECEIVER, msg, state_audio::muted_sender, NET_NATIVE, NET_STANDARD, process_statistics(), audio_frame2::resample(), state_audio::resample_to, rtcp_recv_r(), rtp_send_ctrl(), rtp_update(), state_audio::sender, set_audio_spec_to_vrxtx(), set_thread_name(), state_audio::should_exit, state_audio::start_time, ts, state_audio::tx_session, and state_audio::vrxtx.
Referenced by audio_start().

| void audio_start | ( | struct state_audio * | s | ) |
Definition at line 463 of file audio.cpp.
References audio_receiver_thread(), state_audio::audio_receiver_thread_id, audio_sender_thread(), state_audio::audio_sender_thread_id, state_audio::audio_tx_mode, EXIT_FAIL_AUDIO, exit_uv(), is_jack_receiver(), is_jack_sender(), state_audio::jack_connection, jack_start(), LOG_LEVEL_FATAL, log_msg(), MODE_RECEIVER, MODE_SENDER, NET_JACK, NET_NATIVE, state_audio::proto_cfg, state_audio::receiver, and state_audio::sender.
Referenced by main(), vidcap_ug_input_init(), and write_video_frame().

|
static |
Definition at line 684 of file audio.cpp.
References state_audio::audio_network_device, LOG, LOG_LEVEL_DEBUG, state_audio::recv_buf_size, and rtp_set_recv_buf().
Referenced by audio_receiver_thread().

|
static |
Definition at line 1026 of file audio.cpp.
References sample_rate.
Referenced by audio_sender_thread().
|
static |
Definition at line 547 of file audio.cpp.
References DEFAULT_AUDIO_RECV_BUF_SIZE, FALSE, IN6_BLACKHOLE_SERVER_MODE_STR, pdb_add(), rtp::rtcp_bw, RTCP_SDES_TOOL, rtp_init_if(), rtp_my_ssrc(), RTP_OPT_PROMISC, RTP_OPT_RECORD_SOURCE, RTP_OPT_SEND_BACK, RTP_OPT_WEAK_VALIDATION, rtp_recv_callback(), rtp_set_option(), rtp_set_recv_buf(), rtp_set_sdes(), and TRUE.
Referenced by audio_init(), audio_receiver_process_message(), and audio_sender_process_message().

| std::ostream & operator<< | ( | std::ostream & | os, |
| const audio_desc & | desc ) |
Definition at line 1215 of file audio.cpp.
References desc, and get_name_to_audio_codec().

|
static |
Definition at line 1005 of file audio.cpp.
References audio_frame2::append(), asend_compute_and_print_stats(), state_audio::captured, audio_frame2::get_bps(), audio_frame2::get_channel_count(), audio_frame2::get_codec(), audio_frame2::get_sample_rate(), get_time_in_ns(), audio_frame2::has_same_prop_as(), audio_frame2::init(), state_audio::muted_sender, NS_IN_SEC, asend_stats_processing_data::seconds, state_audio::t0, and task_run_async_detached().
Referenced by audio_sender_thread().

| void sdp_send_change_address_message | ( | struct module * | root, |
| const enum module_class * | path, | ||
| const char * | address ) |
Definition at line 238 of file audio.cpp.
References append_message_path(), free_response(), LOG, LOG_LEVEL_NOTICE, LOG_LEVEL_WARNING, new_message(), response_get_status(), RESPONSE_OK, send_message(), and SENDER_MSG_CHANGE_RECEIVER.
Referenced by h264_sdp_video_rxtx::change_address_callback(), and sdp_change_address_callback().

|
static |
Definition at line 1053 of file audio.cpp.
References audio_desc_to_cstring(), desc, audio_frame2::get_desc(), MSG, rtp_get_udp_rx_port(), rtp_is_ipv6(), and video_rxtx::set_audio_spec().
Referenced by audio_sender_thread().

|
static |
Definition at line 232 of file audio.cpp.
References state.
Referenced by audio_done(), and audio_init().