65 if (strncmp(c_str,
"LDGM percents ", strlen(
"LDGM percents ")) == 0) {
66 char *str = strdup(c_str);
67 char *ptr = str + strlen(
"LDGM percents ");
68 char *save_ptr =
nullptr;
70 item = strtok_r(ptr,
" ", &save_ptr);
71 assert (
item !=
nullptr);
72 int mtu_len = stoi(
item);
74 item = strtok_r(
nullptr,
" ", &save_ptr);
75 assert (
item !=
nullptr);
76 int data_len = stoi(
item);
78 item = strtok_r(
nullptr,
" ", &save_ptr);
79 assert (
item !=
nullptr);
80 double loss_pct = stof(
item);
81 assert(loss_pct > 0.0);
82 fec *ret =
new ldgm(mtu_len, data_len, loss_pct);
86 if (strncmp(c_str,
"LDGM cfg ", strlen(
"LDGM cfg ")) == 0) {
87 return new ldgm(c_str + strlen(
"LDGM cfg "));
89 if (strncmp(c_str,
"RS cfg ", strlen(
"RS cfg ")) == 0) {
90 return new rs(c_str + strlen(
"rs cfg "), is_audio);
93 }
catch (
string const &s) {
95 }
catch (exception
const &e) {
118 }
catch (
string const &s) {
120 }
catch (exception
const &e) {
154 UG_ASSERT(0 &&
"Unsupported media/FEC type combination");
#define LOG_LEVEL_ERROR
general errors
int fec_pt_from_fec_type(enum tx_media_type media_type, enum fec_type fec_type, bool encrypted)
#define UG_ASSERT(cond)
unconditional alternative to assert that is not affected by NDEBUG macro
#define PT_ENCRYPT_AUDIO_RS
#define PT_ENCRYPT_VIDEO_RS
#define PT_ENCRYPT_VIDEO_LDGM
static fec * create_from_desc(struct fec_desc) noexcept
static enum fec_type fec_type_from_pt(int pt)
static fec * create_from_config(const char *str, bool is_audio) noexcept
static int pt_from_fec_type(enum tx_media_type media_type, enum fec_type fec_type, bool encrypted)