Skip to content

Commit

Permalink
Instantiate sources only once
Browse files Browse the repository at this point in the history
  • Loading branch information
carlesfernandez committed Aug 10, 2024
1 parent 621ee34 commit 7ce4f62
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/core/receiver/gnss_flowgraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,7 @@ void GNSSFlowgraph::init()
sources_count_ = configuration_->property("GNSS-SDR.num_sources", sources_count_deprecated);

// Avoid segmentation fault caused by wrong configuration
auto check_not_nullptr = block_factory->GetSignalSource(configuration_.get(), queue_.get(), 0);
if (!check_not_nullptr)
{
std::cout << "GNSS-SDR program ended.\n";
exit(1);
}
if (sources_count_ == 2 && check_not_nullptr->implementation() == "Multichannel_File_Signal_Source")
if (sources_count_ == 2 && configuration_->property("SignalSource.implementation", std::string("")) == "Multichannel_File_Signal_Source")
{
std::cout << " * Please set GNSS-SDR.num_sources=1 in your configuration file\n";
std::cout << " if you are using the Multichannel_File_Signal_Source implementation.\n";
Expand All @@ -143,7 +137,13 @@ void GNSSFlowgraph::init()
for (int i = 0; i < sources_count_; i++)
{
DLOG(INFO) << "Creating source " << i;
sig_source_.push_back(block_factory->GetSignalSource(configuration_.get(), queue_.get(), i));
auto check_not_nullptr = block_factory->GetSignalSource(configuration_.get(), queue_.get(), i);
if (!check_not_nullptr)
{
std::cout << "GNSS-SDR program ended.\n";
exit(1);
}
sig_source_.push_back(std::move(check_not_nullptr));
if (enable_fpga_offloading_ == false)
{
auto& src = sig_source_.back();
Expand Down

0 comments on commit 7ce4f62

Please sign in to comment.