Fix RTL Source Audio Monitoring Bug;

This commit is contained in:
lwvmobile
2023-08-09 03:37:54 -04:00
parent 14b4af8b33
commit e9262f18db
2 changed files with 4 additions and 17 deletions

View File

@@ -1209,7 +1209,6 @@ usage ()
printf (" -7 <dir> Create/Use Custom directory for Per Call decoded .wav file saving.\n"); printf (" -7 <dir> Create/Use Custom directory for Per Call decoded .wav file saving.\n");
printf (" (Single Nested Directory Only! Use Before the -P option!)\n"); printf (" (Single Nested Directory Only! Use Before the -P option!)\n");
printf (" -8 Enable Experimental Source Audio Monitor (Pulse Audio Output Only!)\n"); printf (" -8 Enable Experimental Source Audio Monitor (Pulse Audio Output Only!)\n");
printf (" (Caution! May Cause High CPU usage or break when using RTL input!)\n");
printf (" (Its recommended to use Squelch in SDR++ or GQRX, etc, if monitoring mixed analog/digital)\n"); printf (" (Its recommended to use Squelch in SDR++ or GQRX, etc, if monitoring mixed analog/digital)\n");
printf (" -P Enable Per Call WAV file saving in AUTO and NXDN decoding classes\n"); printf (" -P Enable Per Call WAV file saving in AUTO and NXDN decoding classes\n");
printf (" (Per Call can only be used in Ncurses Terminal!)\n"); printf (" (Per Call can only be used in Ncurses Terminal!)\n");
@@ -1360,8 +1359,6 @@ liveScanner (dsd_opts * opts, dsd_state * state)
{ {
open_rtlsdr_stream(opts); open_rtlsdr_stream(opts);
opts->rtl_started = 1; //set here so ncurses terminal doesn't attempt to open it again opts->rtl_started = 1; //set here so ncurses terminal doesn't attempt to open it again
//safety disable due to HIGH CPU usage this causes when using RTL input
if (opts->monitor_input_audio == 1) opts->monitor_input_audio = 0;
} }
#endif #endif
@@ -1565,7 +1562,6 @@ main (int argc, char **argv)
case '8': case '8':
opts.monitor_input_audio = 1; opts.monitor_input_audio = 1;
fprintf (stderr,"Experimental Raw Analog Source Monitoring Enabled (Pulse Audio Only!)\n"); fprintf (stderr,"Experimental Raw Analog Source Monitoring Enabled (Pulse Audio Only!)\n");
fprintf (stderr,"WARNING! May Cause HIGH CPU Usage and/or break when using RTL Input\n");
break; break;
//rc4 enforcement on DMR (due to missing the PI header) //rc4 enforcement on DMR (due to missing the PI header)

View File

@@ -151,17 +151,10 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
else if (opts->audio_in_type == 3) else if (opts->audio_in_type == 3)
{ {
#ifdef USE_RTLSDR #ifdef USE_RTLSDR
// TODO: need to read demodulated stream here // Read demodulated stream here
// get_rtlsdr_sample(&sample);
if (get_rtlsdr_sample(&sample, opts, state) < 0) if (get_rtlsdr_sample(&sample, opts, state) < 0)
{
cleanupAndExit(opts, state); cleanupAndExit(opts, state);
} //update root means square power level
if (opts->monitor_input_audio == 1 && state->lastsynctype == -1 && sample < 32767 && sample > -32767)
{
state->pulse_raw_out_buffer = sample; //steal raw out buffer sample here?
pa_simple_write(opts->pulse_raw_dev_out, (void*)&state->pulse_raw_out_buffer, 2, NULL);
}
opts->rtl_rms = rtl_return_rms(); opts->rtl_rms = rtl_return_rms();
#endif #endif
@@ -271,10 +264,8 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
} }
//LM server reports massive 'Q overrun, queueing locally' and CPU usage spikes to over 40% on pulse audio daemon //Fixed the RTL monitoring bug, it was left active up above (very old and jank test code),
//main issue appears to be using this with rtl input -- issues due to threading, or sampling rate? or just rtl_fm doing its thing and causing issues? //so it was constantly spamming pulse audio server with very small samples, then coming here as well.
//works fine when using SDR++ as input on the remote and NOT when using rtl direct input
//Went back and tested EDACS analog calls with RTL input, and it doesn't even flinch there or cause any HIGH CPU usage, so no idea why it does so here
if (have_sync == 0 && opts->monitor_input_audio == 1) if (have_sync == 0 && opts->monitor_input_audio == 1)
{ {
//sanity check to prevent an overflow //sanity check to prevent an overflow