mirror of
https://github.com/linux-speakup/espeakup.git
synced 2026-08-09 09:19:09 +02:00
make sure that snd_pcm_drop is successful.
This was suggested by Kirk Reiser and Chris Brannon.
This commit is contained in:
parent
4889572ad1
commit
87ab6c6ea8
1 changed files with 8 additions and 1 deletions
9
alsa.c
9
alsa.c
|
|
@ -58,13 +58,20 @@ static int alsa_callback(short *audio, int numsamples, espeak_EVENT * events)
|
|||
int samples_written = 0;
|
||||
int avail;
|
||||
int to_write;
|
||||
int rc;
|
||||
snd_pcm_state_t state;
|
||||
int user_data_new;
|
||||
|
||||
pthread_mutex_lock(&audio_mutex);
|
||||
user_data_new = *(int *) events->user_data;
|
||||
if (stop_requested) {
|
||||
snd_pcm_drop(handle);
|
||||
rc = snd_pcm_drop(handle);
|
||||
while(rc < 0) {
|
||||
fprintf(stderr, "Negative return from snd_pcm_drop!\n");
|
||||
/* Try to reset stream. */
|
||||
snd_pcm_prepare(handle);
|
||||
rc = snd_pcm_drop(handle);
|
||||
}
|
||||
stop_requested = 0;
|
||||
discarding_packets = 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue