fix bug when reading/syncing from file using too large offset

This commit is contained in:
Andre Puschmann 2017-06-07 14:31:32 +02:00
parent 3e5a3d0d82
commit c55532c286
1 changed files with 11 additions and 2 deletions

View File

@ -78,8 +78,17 @@ int srslte_ue_sync_init_file(srslte_ue_sync_t *q, uint32_t nof_prb, char *file_n
}
INFO("Offseting input file by %d samples and %.1f kHz\n", offset_time, offset_freq/1000);
srslte_filesource_read(&q->file_source, dummy_offset_buffer, offset_time);
if (offset_time) {
cf_t *file_offset_buffer = srslte_vec_malloc(offset_time * sizeof(cf_t));
if (!file_offset_buffer) {
perror("malloc");
goto clean_exit;
}
srslte_filesource_read(&q->file_source, file_offset_buffer, offset_time);
free(file_offset_buffer);
}
srslte_ue_sync_reset(q);
ret = SRSLTE_SUCCESS;