Skip to content

Commit

Permalink
Fixed alsa dev read pcm bug
Browse files Browse the repository at this point in the history
  • Loading branch information
freeforf committed Dec 10, 2024
1 parent 9030274 commit 6c329bb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pjmedia/src/pjmedia-audiodev/alsa_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,20 @@ static int ca_thread_func (void *arg)

while (!stream->quit) {
pjmedia_frame frame;


snd_pcm_state_t state;
state = snd_pcm_state(pcm);
if (state == SND_PCM_STATE_PREPARED) {
snd_pcm_start(pcm);
contine;
} else if (state == SND_PCM_STATE_RUNNING) {
snd_pcm_uframes_t avail;
avail = snd_pcm_avail(pcm);
if (avail >= 0 && avail < nframes) {
pj_thread_sleep(5);
continue;
}
}
pj_bzero (buf, size);
result = snd_pcm_readi (pcm, buf, nframes);
if (result == -EPIPE) {
Expand Down

0 comments on commit 6c329bb

Please sign in to comment.