diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-10-24 23:31:17 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-10-25 00:42:37 -0400 |
commit | e7a492ef55df87bd7873a176a76a9a524da3f2ce (patch) | |
tree | 3342d448aa7bb66b892c3910af971b40bb1d44ba | |
parent | ec2a34b3217bfb469cac4697d9949b4591370ebc (diff) | |
download | rockbox-e7a492ef55df87bd7873a176a76a9a524da3f2ce.tar.gz rockbox-e7a492ef55df87bd7873a176a76a9a524da3f2ce.zip |
hosted: alsa: Fix two bugs when recording
Change-Id: Ib97857874676ea4aa8f04d44e048de8465a4da4f
-rw-r--r-- | firmware/target/hosted/pcm-alsa.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/firmware/target/hosted/pcm-alsa.c b/firmware/target/hosted/pcm-alsa.c index 14f5160e24..b55c891db8 100644 --- a/firmware/target/hosted/pcm-alsa.c +++ b/firmware/target/hosted/pcm-alsa.c | |||
@@ -475,7 +475,7 @@ static void async_callback(snd_async_handler_t *ahandler) | |||
475 | err = snd_pcm_start(handle); | 475 | err = snd_pcm_start(handle); |
476 | if (err < 0) { | 476 | if (err < 0) { |
477 | logf("cb start error: %s", snd_strerror(err)); | 477 | logf("cb start error: %s", snd_strerror(err)); |
478 | goto abort; | 478 | /* Depending on the error we might be SOL */ |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
@@ -532,7 +532,7 @@ static void open_hwdev(const char *device, snd_pcm_stream_t mode) | |||
532 | /* Close old handle */ | 532 | /* Close old handle */ |
533 | close_hwdev(); | 533 | close_hwdev(); |
534 | 534 | ||
535 | if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) | 535 | if ((err = snd_pcm_open(&handle, device, mode, 0)) < 0) |
536 | { | 536 | { |
537 | panicf("%s(): Cannot open device %s: %s", __func__, device, snd_strerror(err)); | 537 | panicf("%s(): Cannot open device %s: %s", __func__, device, snd_strerror(err)); |
538 | } | 538 | } |
@@ -687,7 +687,7 @@ void pcm_play_dma_start(const void *addr, size_t size) | |||
687 | return; | 687 | return; |
688 | case SND_PCM_STATE_XRUN: | 688 | case SND_PCM_STATE_XRUN: |
689 | { | 689 | { |
690 | logf("Trying to recover from error"); | 690 | logf("Trying to recover from underrun"); |
691 | int err = snd_pcm_recover(handle, -EPIPE, 0); | 691 | int err = snd_pcm_recover(handle, -EPIPE, 0); |
692 | if (err < 0) | 692 | if (err < 0) |
693 | logf("Recovery failed: %s", snd_strerror(err)); | 693 | logf("Recovery failed: %s", snd_strerror(err)); |
@@ -735,6 +735,7 @@ void pcm_play_dma_start(const void *addr, size_t size) | |||
735 | err = snd_pcm_start(handle); | 735 | err = snd_pcm_start(handle); |
736 | if (err < 0) { | 736 | if (err < 0) { |
737 | logf("start error: %s", snd_strerror(err)); | 737 | logf("start error: %s", snd_strerror(err)); |
738 | /* We will recover on the next iteration */ | ||
738 | } | 739 | } |
739 | 740 | ||
740 | break; | 741 | break; |
@@ -806,7 +807,8 @@ void pcm_rec_dma_init(void) | |||
806 | void pcm_rec_dma_close(void) | 807 | void pcm_rec_dma_close(void) |
807 | { | 808 | { |
808 | logf("Rec DMA Close"); | 809 | logf("Rec DMA Close"); |
809 | close_hwdev(); | 810 | // close_hwdev(); |
811 | open_hwdev(playback_dev, SND_PCM_STREAM_PLAYBACK; | ||
810 | } | 812 | } |
811 | 813 | ||
812 | void pcm_rec_dma_start(void *start, size_t size) | 814 | void pcm_rec_dma_start(void *start, size_t size) |