Channel emulator: added input pointer checks

master
Xavier Arteaga 5 years ago committed by Xavier Arteaga
parent da78f373b1
commit 2530894374

@ -102,8 +102,12 @@ channel::~channel()
void channel::run(cf_t* in[SRSLTE_MAX_PORTS], cf_t* out[SRSLTE_MAX_PORTS], uint32_t len, const srslte_timestamp_t& t)
{
// check input pointers
if (in != nullptr && out != nullptr) {
if (current_srate) {
for (uint32_t i = 0; i < nof_ports; i++) {
// Check buffers are not null
if (in[i] != nullptr && out[i] != nullptr) {
// Copy input buffer
memcpy(buffer_in, in[i], sizeof(cf_t) * len);
@ -125,6 +129,16 @@ void channel::run(cf_t* in[SRSLTE_MAX_PORTS], cf_t* out[SRSLTE_MAX_PORTS], uint3
// Copy output buffer
memcpy(out[i], buffer_in, sizeof(cf_t) * len);
}
}
} else {
for (uint32_t i = 0; i < nof_ports; i++) {
// Check buffers are not null
if (in[i] != nullptr && out[i] != nullptr && in[i] != out[i]) {
memcpy(out[i], in[i], sizeof(cf_t) * len);
}
}
}
}
}
void channel::set_srate(uint32_t srate)

Loading…
Cancel
Save