-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dsp freeze fix #1004
Dsp freeze fix #1004
Conversation
Workaround gnuradio blocks state corruption after device change by recreating dc_corr (fixes white waterfall and no sound) and resetting the demod (fixes corrupted sound). Pure hack. It is better to find a way to prevent corruption than fix it this way...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 I'm new here, but this looks like a clean PR after a couple formatting changes.
src/applications/gqrx/receiver.cpp
Outdated
qDebug() << " new: " << device.c_str(); | ||
#endif | ||
return; | ||
}else{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the rest of the code puts parentheses on their own lines. Should we update this to match?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 060e0af.
src/applications/gqrx/receiver.cpp
Outdated
@@ -194,7 +205,7 @@ void receiver::set_input_device(const std::string device) | |||
{ | |||
tb->stop(); | |||
tb->wait(); | |||
} | |||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the semicolon here have a purpose? C++ is not my strong suit but I don't think this semicolon is adding any value, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 060e0af.
@@ -206,7 +217,13 @@ void receiver::set_input_device(const std::string device) | |||
tb->disconnect(src, 0, iq_swap, 0); | |||
} | |||
|
|||
src.reset(); | |||
//temporarily connect dummy source to ensure that previous device is closed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the helpful comment explaining the purpose of the dummy device connect 👍
Workaround gnuradio blocks state corruption after device change by recreating dc_corr (fixes white waterfall and no sound) and resetting the demod (fixes corrupted sound). It looks like sometimes demodulators are not happy with bad samles too. We should recreate the graph, temporarily switching out current demodulator to prevent bad behavior. Now in case of demodulator internal state corruption, it can be resolved by switching from nbrx to wbfm and back from GUI or vise versa.
060e0af
to
9ab8b29
Compare
Workaround gnuradio blocks state corruption after device change by recreating dc_corr (fixes white waterfall and no sound) and resetting the demod (fixes corrupted sound). Pure hack. It is better to find a way to prevent corruption than fix it this way...
The underlying bug leading to #1003 (and #757) was already fixed in GNU Radio 3.8.1+: gnuradio/gnuradio#3184 As a result, I think any changes to |
Or perhaps |
Workaround gnuradio blocks state corruption after device change by recreating dc_corr (fixes white waterfall and no sound) and resetting the demod (fixes corrupted sound). It looks like sometimes demodulators are not happy with bad samles too. We should recreate the graph, temporarily switching out current demodulator to prevent bad behavior. Now in case of demodulator internal state corruption, it can be resolved by switching from nbrx to wbfm and back from GUI or vise versa.
Partially reverting 8b4c2ef and fixing DSP restart failure in MainWindow::on_actionIoConfig_triggered allows to select different device/change sample rate/bandwidth/or other device options without DSP freeze and device open failure. Work around GNU Radio bug #3184 Resetting shared_ptr is not enough to close the device. We have to switch to some other dummy osmosdr source, start the top_block, then stop it and disconnect dummy source to really close the device. This may fix some hackrf glitches (at least switching bias tee on the fly) too. Fix white waterfall and no sound after playing back bad IQ file. Workaround gnuradio blocks state corruption after device change by recreating dc_corr (fixes white waterfall and no sound) and resetting the demod (fixes corrupted sound). It looks like sometimes demodulators are not happy with bad samles too. We should recreate the graph, temporarily switching out current demodulator to prevent bad behavior.
804f5b8
to
4e61d1b
Compare
Thanks for suggestion. |
Partially reverting 8b4c2ef and fixing DSP restart failure in MainWindow::on_actionIoConfig_triggered allows to select different device/change sample rate/bandwidth/or other device options without DSP freeze and device open failure. Work around GNU Radio bug #3184 Resetting shared_ptr is not enough to close the device. We have to switch to some other dummy osmosdr source, start the top_block, then stop it and disconnect dummy source to really close the device. This may fix some hackrf glitches (at least switching bias tee on the fly) too. Fix white waterfall and no sound after playing back bad IQ file. Workaround gnuradio blocks state corruption after device change by recreating dc_corr (fixes white waterfall and no sound) and resetting the demod (fixes corrupted sound). It looks like sometimes demodulators are not happy with bad samles too. We should recreate the graph, temporarily switching out current demodulator to prevent bad behavior.
4e61d1b
to
1a9c247
Compare
This change seems unrelated to the first one. Could you please split it off into its own pull request so that it can be reviewed separately? |
src/applications/gqrx/receiver.cpp
Outdated
std::string error = ""; | ||
|
||
if (device.empty()) | ||
return; | ||
if (input_devstr.compare(device) == 0) | ||
{ | ||
#ifndef QT_NO_DEBUG_OUTPUT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is #ifndef QT_NO_DEBUG_OUTPUT
needed? Doesn't setting that disable qDebug()
automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know where did I took this from. No useful information in case, the input device did not change. So, reverted to previous state and added a check for changed device string as it was done before, but removed later for some unknown purpose.
Why should we always reopen a device even if it did not change? If we have to work around some buggy device, then it is better to check for it's specific device string and reopen if it matches.
Moved this to #1021.
Partially reverting 8b4c2ef and fixing DSP restart failure in MainWindow::on_actionIoConfig_triggered allows to select different device/change sample rate/bandwidth/or other device options without DSP freeze and device open failure. Work around GNU Radio bug #3184 Resetting shared_ptr is not enough to close the device. We have to switch to some other dummy osmosdr source, start the top_block, then stop it and disconnect dummy source to really close the device. This may fix some hackrf glitches (at least switching bias tee on the fly) too.
1a9c247
to
368a7f1
Compare
Thanks for splitting those out! At a glance the change looks good. I'll merge once I've verified that things work well with an older GNU Radio version. |
Partially reverting 8b4c2ef and fixing DSP restart failure in MainWindow::on_actionIoConfig_triggered allows to select different device/change sample rate/bandwidth/or other device options without DSP freeze and device open failure. Work around GNU Radio bug #3184 Resetting shared_ptr is not enough to close the device. We have to switch to some other dummy osmosdr source, start the top_block, then stop it and disconnect dummy source to really close the device. This may fix some hackrf glitches (at least switching bias tee on the fly) too.
368a7f1
to
0c21c59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on Ubuntu 18.04, and this works well. I'll merge once CI passes.
Fix #1003.
Switching input devices works even on the fly without DSP freeze/open errors.
Changing device options like direct sampling/bias tee works on the fly too.