![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include "src/rtp/audio_decoders.h"#include <algorithm>#include <atomic>#include <cassert>#include <chrono>#include <cmath>#include <cstdlib>#include <cstring>#include <iomanip>#include <iostream>#include <map>#include <string>#include <utility>#include <vector>#include "audio/audio_playback.h"#include "audio/codec.h"#include "audio/resampler.hpp"#include "audio/types.h"#include "audio/utils.h"#include "compat/htonl.h"#include "compat/strings.h"#include "control_socket.h"#include "crypto/openssl_decrypt.h"#include "crypto/openssl_encrypt.h"#include "debug.h"#include "host.h"#include "lib_common.h"#include "messaging.h"#include "module.h"#include "rtp/fec.h"#include "rtp/pbuf.h"#include "rtp/rtp.h"#include "rtp/rtp_types.h"#include "tv.h"#include "types.h"#include "ug_runtime_error.hpp"#include "utils/color_out.h"#include "utils/macros.h"#include "utils/packet_counter.h"#include "utils/worker.h"
Go to the source code of this file.
Classes | |
| struct | adec_stats_processing_data |
| struct | scale_data |
| struct | state_audio_decoder |
| struct | state_audio_decoder_summary |
Macros | |
| #define | AUDIO_DECODER_MAGIC 0x12ab332bu |
| #define | MOD_NAME "[audio dec.] " |
Functions | |
| ADD_TO_PARAM ("audio-dec-format", "* audio-dec-format=<fmt>|help\n" " Forces specified format playback format.\n") | |
| ADD_TO_PARAM ("soft-resample", "* soft-resample=<num>/<den>\n" " Resample to specified sampling rate, eg. 12288128/256 for 48000.5 Hz\n") | |
| static void * | adec_compute_and_print_stats (void *arg) |
| void | audio_decoder_destroy (void *state) |
| void * | audio_decoder_init (char *audio_channel_map, const char *audio_scale, const char *encryption, audio_playback_ctl_t c, void *p_state, struct module *parent) |
| static void | audio_decoder_process_message (struct module *m) |
| static bool | audio_decoder_reconfigure (struct state_audio_decoder *decoder, struct pbuf_audio_data *s, audio_frame2 &received_frame, int input_channels, int bps, int sample_rate, uint32_t audio_tag) |
| void | audio_decoder_set_volume (void *state, double val) |
| static bool | audio_fec_decode (struct pbuf_audio_data *s, vector< pair< vector< char >, map< int, int > > > &fec_data, uint32_t fec_params, audio_frame2 &received_frame) |
| static void | compute_scale (struct scale_data *scale_data, double vol_avg, int samples, int sample_rate) |
| int | decode_audio_frame (struct coded_data *cdata, void *pbuf_data, struct pbuf_stats *) |
| int | decode_audio_frame_mulaw (struct coded_data *cdata, void *data, struct pbuf_stats *) |
| bool | parse_audio_hdr (uint32_t *hdr, struct audio_desc *desc) |
Variables | |
| constexpr double | VOL_DOWN = 1.0/1.1 |
| constexpr double | VOL_UP = 1.1 |
Definition in file audio_decoders.cpp.
| #define AUDIO_DECODER_MAGIC 0x12ab332bu |
Definition at line 96 of file audio_decoders.cpp.
Referenced by audio_decoder_destroy(), and audio_decoder_init().
| #define MOD_NAME "[audio dec.] " |
Definition at line 97 of file audio_decoders.cpp.
Referenced by audio_decoder_init(), audio_decoder_process_message(), audio_decoder_reconfigure(), audio_fec_decode(), and decode_audio_frame().
| ADD_TO_PARAM | ( | "audio-dec-format" | ) |
| ADD_TO_PARAM | ( | "soft-resample" | , |
| "* soft- | resample = <num>/<den>\n" " Resample to specified sampling rate, | ||
| eg. 12288128/256 for 48000.5 Hz\n" | ) |
|
static |
Definition at line 377 of file audio_decoders.cpp.
References calculate_rms(), format_audio_channel_volume(), LOG_LEVEL_INFO, log_msg(), loss, STR_LEN, TBOLD, TERM_BOLD, TERM_FG_MAGENTA, and TRED.
Referenced by decode_audio_frame().

| void audio_decoder_destroy | ( | void * | state | ) |
Definition at line 338 of file audio_decoders.cpp.
References audio_codec_done(), AUDIO_DECODER_MAGIC, state_audio_decoder::audio_decompress, state_audio_decoder::dec_funcs, state_audio_decoder::decrypt, openssl_decrypt_info::destroy, state_audio_decoder::fec_state, state_audio_decoder::magic, state_audio_decoder::mod, module_done(), state_audio_decoder::packet_counter, packet_counter_destroy(), and state.
Referenced by audio_decoder_init(), and audio_decoder_state_deleter().

| void * audio_decoder_init | ( | char * | audio_channel_map, |
| const char * | audio_scale, | ||
| const char * | encryption, | ||
| audio_playback_ctl_t | c, | ||
| void * | p_state, | ||
| struct module * | parent ) |
Definition at line 238 of file audio_decoders.cpp.
References audio_decoder_destroy(), AUDIO_DECODER_MAGIC, audio_decoder_process_message(), state_audio_decoder::audio_decompress, state_audio_decoder::audio_playback_ctl_func, state_audio_decoder::audio_playback_state, state_audio_decoder::channel_map, state_audio_decoder::channel_remapping, module::cls, state_audio_decoder::control, state_audio_decoder::dec_funcs, state_audio_decoder::decrypt, state_audio_decoder::fixed_scale, get_commandline_param(), get_module(), get_root_module(), openssl_decrypt_info::init, LIBRARY_CLASS_UNDEFINED, load_library(), LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, log_msg(), state_audio_decoder::magic, channel_map::map, state_audio_decoder::mod, MOD_NAME, MODULE_CLASS_DECODER, module_init_default(), module_register(), module::new_message, OPENSSL_DECRYPT_ABI_VERSION, state_audio_decoder::packet_counter, packet_counter_init(), parent, parse_channel_map_cfg(), module::priv_data, state_audio_decoder::req_resample_to, state_audio_decoder::scale, channel_map::size, channel_map::sizes, state_audio_decoder::t0, and val.
Referenced by audio_decoder_state_create().

|
static |
Definition at line 218 of file audio_decoders.cpp.
References ADEC_CH_RATE_SHIFT, check_message(), free_message(), LOG, LOG_LEVEL_VERBOSE, MOD_NAME, MSG_UNIVERSAL_TAG_AUDIO_DECODER, new_response(), module::priv_data, RESPONSE_NOT_FOUND, and RESPONSE_OK.
Referenced by audio_decoder_init().

|
static |
Compares provided parameters with previous configuration and if it differs, reconfigure the decoder, otherwise the reconfiguration is skipped.
Definition at line 417 of file audio_decoders.cpp.
References AC_PCM, audio_codec_reconfigure(), AUDIO_DECODER, state_audio_decoder::audio_decompress, state_audio_decoder::audio_playback_ctl_func, AUDIO_PLAYBACK_CTL_QUERY_FORMAT, state_audio_decoder::audio_playback_state, audio_desc::bps, audio_frame::bps, pbuf_audio_data::buffer, audio_desc::ch_count, audio_frame::ch_count, state_audio_decoder::channel_map, state_audio_decoder::channel_remapping, state_audio_decoder::decoded, exit_uv(), state_audio_decoder::fixed_scale, fmt, get_audio_codec_to_tag(), get_commandline_param(), get_name_to_audio_codec(), audio_frame2::init(), len, LOG_LEVEL_ERROR, LOG_LEVEL_FATAL, LOG_LEVEL_NOTICE, log_msg(), channel_map::max_output, MOD_NAME, parse_audio_format(), state_audio_decoder::resample_remainder, audio_frame2::reserve(), audio_desc::sample_rate, audio_frame::sample_rate, sample_rate, state_audio_decoder::saved_audio_tag, state_audio_decoder::saved_desc, state_audio_decoder::scale, and channel_map::size.
Referenced by audio_fec_decode(), and decode_audio_frame().

| void audio_decoder_set_volume | ( | void * | state, |
| double | val ) |
Definition at line 881 of file audio_decoders.cpp.
Referenced by audio_decoder_state_create(), and audio_receiver_process_message().
|
static |
Definition at line 480 of file audio_decoders.cpp.
References audio_decoder_reconfigure(), fec_desc::c, fec::create_from_desc(), fec::decode(), pbuf_audio_data::decoder, desc, FEC_RS, state_audio_decoder::fec_state, state_audio_decoder::fec_state_desc, flags, get_audio_codec_to_tag(), fec_desc::k, LOG, LOG_LEVEL_ERROR, fec_desc::m, MOD_NAME, and audio_frame2::replace().
Referenced by decode_audio_frame().

|
static |
Definition at line 192 of file audio_decoders.cpp.
References MSG, sample_rate, scale_data::samples, scale_data::scale, scale_data::vol_avg, VOL_DOWN, and VOL_UP.
Referenced by decode_audio_frame().
| int decode_audio_frame | ( | struct coded_data * | cdata, |
| void * | pbuf_data, | ||
| struct pbuf_stats * | stats ) |
Definition at line 534 of file audio_decoders.cpp.
References ADEC_CH_RATE_SHIFT, adec_compute_and_print_stats(), audio_frame2_resampler::align_bps(), audio_frame2::append(), audio_codec_decompress(), audio_decoder_reconfigure(), state_audio_decoder::audio_decompress, audio_fec_decode(), audio_desc::bps, audio_frame::bps, pbuf_audio_data::buffer, BUFNUM_BITS, calculate_rms(), audio_desc::ch_count, audio_frame::ch_count, audio_frame2::change_bps(), state_audio_decoder::channel_map, state_audio_decoder::channel_remapping, compute_scale(), channel_map::contributors, state_audio_decoder::control, control_audio_ch_report_count(), control_report_stats(), control_stats_enabled(), audio_frame::data, coded_data::data, audio_frame::data_len, DEBUG_TIMER_START, DEBUG_TIMER_STOP, state_audio_decoder::dec_funcs, state_audio_decoder::decoded, pbuf_audio_data::decoder, openssl_decrypt_info::decrypt, state_audio_decoder::decrypt, first, state_audio_decoder::fixed_scale, adec_stats_processing_data::frame, pbuf_audio_data::frame_size, get_audio_codec_to_tag(), get_avg_volume(), audio_frame2::get_bps(), audio_frame2::get_channel_count(), audio_frame2::get_codec(), audio_frame2::get_data(), audio_frame2::get_data_len(), audio_frame2::get_sample_rate(), audio_frame2::get_timestamp(), audio_frame2::init(), LOG, LOG_LEVEL_INFO, LOG_LEVEL_WARNING, log_msg(), log_msg_once(), channel_map::map, channel_map::max_output, audio_frame::max_size, MOD_NAME, MODE_AES128_MAX, MODE_AES128_NONE, state_audio_decoder::muted, mux_and_mix_channel(), coded_data::nxt, offset, state_audio_decoder::packet_counter, packet_counter_clear(), packet_counter_destroy(), packet_counter_get_all_bytes(), packet_counter_get_channels(), packet_counter_get_total_bytes(), packet_counter_init(), packet_counter_register_packet(), PT_AUDIO_HAS_FEC, PT_AUDIO_IS_ENCRYPTED, PT_IS_AUDIO, PT_Unassign_Type95, audio_frame2::replace(), state_audio_decoder::req_resample_to, audio_frame2::resample(), audio_frame2::resample_fake(), state_audio_decoder::resample_remainder, state_audio_decoder::resampler, audio_frame2::resize(), RTP_MAX_PACKET_LEN, audio_desc::sample_rate, audio_frame::sample_rate, sample_rate, state_audio_decoder::saved_audio_tag, state_audio_decoder::saved_desc, state_audio_decoder::scale, audio_frame2::set_timestamp(), channel_map::size, channel_map::sizes, pbuf_audio_data::source, state_audio_decoder::summary, state_audio_decoder::t0, task_run_async_detached(), audio_frame::timestamp, to_fourcc, tv_diff(), and state_audio_decoder_summary::update().
Referenced by audio_receiver_thread().

| int decode_audio_frame_mulaw | ( | struct coded_data * | cdata, |
| void * | data, | ||
| struct pbuf_stats * | stats ) |
Definition at line 821 of file audio_decoders.cpp.
References audio_frame2::append(), audio, audio_frame::bps, audio_frame::ch_count, coded_data::data, pbuf_audio_data::decoder, audio_frame2::get_bps(), audio_frame2::get_channel_count(), audio_frame2::init(), coded_data::nxt, and audio_frame::sample_rate.
Referenced by audio_receiver_thread().

| bool parse_audio_hdr | ( | uint32_t * | hdr, |
| struct audio_desc * | desc ) |
Definition at line 357 of file audio_decoders.cpp.
References desc, and get_audio_codec_to_tag().
Referenced by decode_yuri_audio_frame().

|
constexpr |
Definition at line 190 of file audio_decoders.cpp.
Referenced by compute_scale().
|
constexpr |
Definition at line 189 of file audio_decoders.cpp.
Referenced by compute_scale().