Skip to content

Commit

Permalink
R-S: removed VLAs from C++ code
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinPulec committed Mar 26, 2024
1 parent 3708bd7 commit 8d1dc87
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/rtp/rs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ shared_ptr<video_frame> rs::encode(shared_ptr<video_frame> in)
memset(out_data + sizeof(len32) + hdr_len + len, 0, ss * m_k - (sizeof(len32) + hdr_len + len));

#if 0
void *src[m_k];
void *src[MAX_K];
for (int k = 0; k < m_k; ++k) {
src[k] = *out + ss * k;
}
Expand All @@ -164,12 +164,12 @@ shared_ptr<video_frame> rs::encode(shared_ptr<video_frame> in)
fec_encode(state, src, *out + ss * (m_k + m), m, ss);
}
#else
void *src[m_k];
void *src[MAX_K];
for (unsigned int k = 0; k < m_k; ++k) {
src[k] = out_data + ss * k;
}
void *dst[m_n-m_k];
unsigned int dst_idx[m_n-m_k];
void *dst[MAX_N];
unsigned int dst_idx[MAX_N];
for (unsigned int m = 0; m < m_n-m_k; ++m) {
dst[m] = out_data + ss * (m_k + m);
dst_idx[m] = m_k + m;
Expand Down Expand Up @@ -221,13 +221,13 @@ audio_frame2 rs::encode(const audio_frame2 &in)

out.set_fec_params(i, fec_desc(FEC_RS, m_k, m_n - m_k, 0, 0, ss));

void *src[m_k];
void *src[MAX_K];
for (unsigned int k = 0; k < m_k; ++k) {
src[k] = out.get_data(i) + ss * k;
}

void *dst[m_n-m_k];
unsigned int dst_idx[m_n-m_k];
void *dst[MAX_N];
unsigned int dst_idx[MAX_N];
for (unsigned int m = 0; m < m_n-m_k; ++m) {
dst[m] = out.get_data(i) + ss * (m_k + m);
dst_idx[m] = m_k + m;
Expand Down Expand Up @@ -291,8 +291,9 @@ bool rs::decode(char *in, int in_len, char **out, int *len,
}

#ifdef HAVE_ZFEC
void *pkt[m_n];
unsigned int index[m_n];
assert(m_n <= MAX_N);
void *pkt[MAX_N];
unsigned int index[MAX_N];
unsigned int i = 0;
#if 0

Expand Down

0 comments on commit 8d1dc87

Please sign in to comment.