- Backport upstream fix patches, including the deadlock fix for aplay/arecord (boo#1031525): 0001-ucm-Add-ATTRIBUTE_UNUSED-for-unused-parameters-of-ex.patch 0002-ucm-parser-needs-limits.h.patch 0003-pcm-direct-allow-users-to-configure-different-period.patch 0004-pcm-dshare-enable-silence.patch 0005-pcm-rate-fix-the-hw_ptr-update-until-the-boundary-av.patch 0006-plugin-dynamically-update-avail_min-on-slave.patch 0007-rate-dynamic-update-avail_min-on-slave.patch 0008-topology-fix-unused-const-variable-warning.patch 0009-seq-improve-documentation-about-new-get-pid-card-fun.patch 0010-pcm-direct-returning-semop-error-code-for-semaphore-.patch 0011-pcm-direct-Fix-for-sync-issue-on-xrun-recover.patch 0012-pcm-direct-check-state-before-enter-poll-on-timer.patch 0013-pcm-direct-don-t-return-bogus-buffer-levels-in-xrun-.patch 0014-conf-ucm-broxton-add-broxton-rt298-conf-files.patch 0015-pcm-direct-Fix-deadlock-in-poll_descriptors.patch 0016-ucm-Assure-the-user-input-card-name-not-to-exceed-ma.patch 0017-ucm-Load-device-specific-configuration-file-based-on.patch 0018-ucm-Add-command-get-_file-to-get-the-config-file-nam.patch 0019-topology-Fix-incorrect-license-in-source-comments.patch 0020-conf-cards-add-support-for-pistachio-card.patch 0021-pcm-multi-Drop-the-fixed-slave_map-in-snd_pcm_multi_.patch 0022-conf-Add-card-config-for-Intel-HDMI-DP-LPE-audio.patch 0023-pcm-Avoid-lock-for-snd_pcm_nonblock.patch 0024-pcm-Disable-locking-in-async-mode.patch 0025-pcm-dmix-Allow-disabling-x86-optimizations.patch 0026-pcm-dmix_rewind-corrupts-application-pointer-fix.patch 0027-pcm-direct-fix-race-on-clearing-timer-events.patch 0028-pcm-file-Enable-file-writing-for-capture-path.patch OBS-URL: https://build.opensuse.org/request/show/483406 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=210
78 lines
2.7 KiB
Diff
78 lines
2.7 KiB
Diff
From fe65b00f337dd08f8c14d54b0ce6b516424d78e8 Mon Sep 17 00:00:00 2001
|
|
From: Timo Wischer <twischer@de.adit-jv.com>
|
|
Date: Fri, 17 Feb 2017 12:47:17 +0530
|
|
Subject: [PATCH 28/43] pcm: file: Enable file writing for capture path
|
|
|
|
This commit reverts parts of commit 4081be0b87ab9fa53a8906e66bc240f18a7a9a54,
|
|
because it is realy useful to use the file plugin in a capture path for
|
|
debugging. Also it fixes the truncate issue mentioned in above commit.
|
|
|
|
Additionally following MMAP access issue is considered:
|
|
$ arecord -D teeraw -M -d5 arecord.wav
|
|
Recording WAVE 'arecord.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
|
|
ALSA lib pcm/pcm_file.c:358:(snd_pcm_file_write_bytes)
|
|
write failed: Bad file descriptor
|
|
ALSA lib pcm/pcm_file.c:358:(snd_pcm_file_write_bytes)
|
|
write failed: Bad file descriptor
|
|
arecord: pcm/pcm_file.c:397: snd_pcm_file_add_frames:
|
|
Assertion `file->wbuf_used_bytes < file->wbuf_size_bytes' failed.
|
|
Aborted by signal Aborted...
|
|
|
|
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
|
|
Signed-off-by: Mounesh Sutar <sutar.mounesh@gmail.com>
|
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
|
---
|
|
src/pcm/pcm_file.c | 12 ++++++++++--
|
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
|
|
--- a/src/pcm/pcm_file.c
|
|
+++ b/src/pcm/pcm_file.c
|
|
@@ -544,6 +544,7 @@ static snd_pcm_sframes_t snd_pcm_file_wr
|
|
static snd_pcm_sframes_t snd_pcm_file_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
|
|
{
|
|
snd_pcm_file_t *file = pcm->private_data;
|
|
+ snd_pcm_channel_area_t areas[pcm->channels];
|
|
snd_pcm_sframes_t n;
|
|
|
|
n = _snd_pcm_readi(file->gen.slave, buffer, size);
|
|
@@ -555,8 +556,10 @@ static snd_pcm_sframes_t snd_pcm_file_re
|
|
__snd_pcm_unlock(pcm);
|
|
if (n < 0)
|
|
return n;
|
|
- return n * 8 / pcm->frame_bits;
|
|
+ n = n * 8 / pcm->frame_bits;
|
|
}
|
|
+ snd_pcm_areas_from_buf(pcm, areas, buffer);
|
|
+ snd_pcm_file_add_frames(pcm, areas, 0, n);
|
|
return n;
|
|
}
|
|
|
|
@@ -564,6 +567,7 @@ static snd_pcm_sframes_t snd_pcm_file_re
|
|
static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
|
|
{
|
|
snd_pcm_file_t *file = pcm->private_data;
|
|
+ snd_pcm_channel_area_t areas[pcm->channels];
|
|
snd_pcm_sframes_t n;
|
|
|
|
if (file->ifd >= 0) {
|
|
@@ -572,6 +576,10 @@ static snd_pcm_sframes_t snd_pcm_file_re
|
|
}
|
|
|
|
n = _snd_pcm_readn(file->gen.slave, bufs, size);
|
|
+ if (n > 0) {
|
|
+ snd_pcm_areas_from_bufs(pcm, areas, bufs);
|
|
+ snd_pcm_file_add_frames(pcm, areas, 0, n);
|
|
+ }
|
|
return n;
|
|
}
|
|
|
|
@@ -635,7 +643,7 @@ static int snd_pcm_file_hw_params(snd_pc
|
|
a->first = slave->sample_bits * channel;
|
|
a->step = slave->frame_bits;
|
|
}
|
|
- if ((file->fd < 0) && (pcm->stream == SND_PCM_STREAM_PLAYBACK)) {
|
|
+ if (file->fd < 0) {
|
|
err = snd_pcm_file_open_output_file(file);
|
|
if (err < 0) {
|
|
SYSERR("failed opening output file %s", file->fname);
|