1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20:35 +00:00

Fix segmentation fault in file_timestamp_signal_source

This commit is contained in:
Javier Arribas 2022-06-08 10:21:05 +02:00
parent e074883f06
commit 0a346c3017

View File

@ -50,21 +50,48 @@ gnss_shared_ptr<gr::block> FileTimestampSignalSource::source() const { return ti
void FileTimestampSignalSource::create_file_source_hook() void FileTimestampSignalSource::create_file_source_hook()
{ {
if (is_complex() == false) int source_items_to_samples = 1;
bool is_complex = false;
if (item_type().compare("ibyte") == 0)
{ {
source_items_to_samples = 1;
}
else if (item_type().compare("byte") == 0)
{
source_items_to_samples = 1;
}
else if (item_type().compare("short") == 0)
{
source_items_to_samples = 1;
}
else if (item_type().compare("ishort") == 0)
{
source_items_to_samples = 1;
}
else if (item_type().compare("gr_complex") == 0)
{
source_items_to_samples = 1;
is_complex = true;
}
if (is_complex == false)
{
std::cout << "A : " << std::get<0>(itemTypeToSize()) << "\n";
timestamp_block_ = gnss_sdr_make_Timestamp( timestamp_block_ = gnss_sdr_make_Timestamp(
std::get<0>(itemTypeToSize()), std::get<0>(itemTypeToSize()),
timestamp_file_, timestamp_file_,
timestamp_clock_offset_ms_, timestamp_clock_offset_ms_,
source_item_size() * 2); source_items_to_samples * 2);
} }
else else
{ {
std::cout << "B : " << std::get<0>(itemTypeToSize()) << "\n";
timestamp_block_ = gnss_sdr_make_Timestamp( timestamp_block_ = gnss_sdr_make_Timestamp(
std::get<0>(itemTypeToSize()), std::get<0>(itemTypeToSize()),
timestamp_file_, timestamp_file_,
timestamp_clock_offset_ms_, timestamp_clock_offset_ms_,
source_item_size()); source_items_to_samples);
} }
DLOG(INFO) << "timestamp_block_(" << timestamp_block_->unique_id() << ")"; DLOG(INFO) << "timestamp_block_(" << timestamp_block_->unique_id() << ")";
} }