kopia lustrzana https://github.com/windytan/slowrx
don't just crash on buffer overrun, but show a warning icon
rodzic
5dcf05d142
commit
bb6fad1bc9
2
common.c
2
common.c
|
@ -23,6 +23,7 @@ int SNRdBthresh[10] = {30, 15, 10, 5, 3, 0, -3, -5, -10, -15};
|
|||
bool Adaptive = true;
|
||||
bool ManualActivated = false;
|
||||
bool Abort = false;
|
||||
bool BufferDrop = false;
|
||||
|
||||
pthread_t thread1;
|
||||
|
||||
|
@ -84,6 +85,7 @@ void changeDevices() {
|
|||
|
||||
int status;
|
||||
|
||||
BufferDrop = false;
|
||||
Abort = true;
|
||||
|
||||
pthread_join(thread1, NULL);
|
||||
|
|
1
common.h
1
common.h
|
@ -18,6 +18,7 @@ extern gshort HedrShift;
|
|||
extern bool Adaptive;
|
||||
extern bool ManualActivated;
|
||||
extern bool Abort;
|
||||
extern bool BufferDrop;
|
||||
extern bool *HasSync;
|
||||
|
||||
extern pthread_t thread1;
|
||||
|
|
14
pcm.c
14
pcm.c
|
@ -25,12 +25,22 @@ void readPcm(gint numsamples) {
|
|||
samplesread = snd_pcm_readi(pcm_handle, tmp, (PcmPointer == 0 ? BUFLEN : numsamples));
|
||||
|
||||
if (samplesread < numsamples) {
|
||||
|
||||
if (samplesread == -EPIPE) printf("ALSA: buffer overrun\n");
|
||||
else if (samplesread == -EBADFD) printf("ALSA: PCM is not in the right state\n");
|
||||
else if (samplesread == -ESTRPIPE) printf("ALSA: a suspend event occurred\n");
|
||||
else if (samplesread < 0) printf("ALSA error %d\n", samplesread);
|
||||
else printf("Can't read %d samples\n", numsamples);
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
// On first appearance of error, update the status icon
|
||||
if (!BufferDrop) {
|
||||
gdk_threads_enter();
|
||||
gtk_image_set_from_stock(GTK_IMAGE(gui.devstatusicon),GTK_STOCK_DIALOG_WARNING,GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
gtk_widget_set_tooltip_text(gui.devstatusicon, "Device is dropping samples");
|
||||
gdk_threads_leave();
|
||||
BufferDrop = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (PcmPointer == 0) {
|
||||
|
@ -99,6 +109,8 @@ int initPcmDevice(char *wanteddevname) {
|
|||
bool found;
|
||||
char *cardname;
|
||||
|
||||
BufferDrop = false;
|
||||
|
||||
snd_pcm_hw_params_alloca(&hwparams);
|
||||
|
||||
card = -1;
|
||||
|
|
2
vis.c
2
vis.c
|
@ -92,8 +92,6 @@ guchar GetVIS () {
|
|||
(tone[14*3+i] > tone[0+j] - 725 && tone[14*3+i] < tone[0+j] - 675) // 1200 Hz stop bit
|
||||
) {
|
||||
|
||||
printf("Possible header @ %+.0f Hz\n",tone[0+j]-1900);
|
||||
|
||||
// Attempt to read VIS
|
||||
|
||||
gotvis = true;
|
||||
|
|
Ładowanie…
Reference in New Issue