gqrx-sdr / gqrx

Software defined radio receiver powered by GNU Radio and Qt.
http://gqrx.dk
GNU General Public License v3.0
3.08k stars 543 forks source link

S-meter oscillation #994

Closed LongnoseRob closed 2 years ago

LongnoseRob commented 2 years ago

As mentioned in the matrix channel, I observe regularrly, that after 10h or more of continious operation the S-meter indication seems to start pulsing/oscilalting. Switching the decoder to another mode and back solves this issue (NFM->AM-->NFM). Audio-decoding does not seem to be affected. Running gqrx 2.14.5 built from sources.

Will try to get some video or still-pictures of this happening in the next days.

argilo commented 2 years ago

Yep, the meter is definitely broken. I was able to reproduce the problem by using a large buffer size with an RTL-SDR (device string rtl=0,buflen=524288).

The meter updates every 100ms, and when it does, it clears out the rolling average, setting the level to 0.0 dBFS: https://github.com/gqrx-sdr/gqrx/blob/2172ef1a96d33a81675678033dc5e81f2761fe1e/src/dsp/rx_meter.cpp#L149-L155 https://github.com/gqrx-sdr/gqrx/blob/2172ef1a96d33a81675678033dc5e81f2761fe1e/src/dsp/rx_meter.cpp#L167-L175

If no samples arrive over the following 100ms, then the level will remain at 0.0 dBFS and the meter will jump.

I think the code should be changed so that the average is computed over a fixed number of samples, rather than the number of samples that happen to have arrived and made it through the scheduler since the previous measurement. (This number varies randomly, and can be zero!)

argilo commented 2 years ago

It occurred to me that we may want to take a similar approach to what was done in #728, allowing samples to accumulate in a circular buffer in case they happen to arrive in bursts larger than the meter update time of 100ms. This would also help keep the meter in sync with the FFT and waterfall.

I see that @szpajder also noticed the meter oscillations at the time: https://github.com/gqrx-sdr/gqrx/pull/728#issuecomment-581585981.

LongnoseRob commented 2 years ago

The problem also occurs when running a file-source and using big FFT numbers and high refresh-rates.

argilo commented 2 years ago

Closing, since #1006 should fix this.