alsa/0023-pcm-initialize-pcm_dmix-monotonic-field.patch
Takashi Iwai 62cc03c4bc Accepting request 225572 from home:tiwai:branches:multimedia:libs
- Update alsa-info.sh to match dmesg with snd_
- Run spec-cleaner
- Add missing Loopback.conf manually
- Upstream fixes: minor clean ups, 2.1 PCM channel config support,
  portability improvements, PCM float format conversion fix,
  fix for ioplug 32bit hwptr wrap, etc.
  0020-minor-malloc-changes.patch
  0021-alsa-lib-minor-typo-in-pcm-doc.patch
  0022-control_hw-fix-potential-memory-leak.patch
  0023-pcm-initialize-pcm_dmix-monotonic-field.patch
  0024-pcm-initialize-monotonic-field-for-dshare-and-dsnoop.patch
  0025-pcm-use-CLOCK_REALTIME-for-non-monotonic-ts.patch
  0026-alsa-lib-heavy-pcm-atomics-cleanup.patch
  0027-conf-Add-basic-infrastructure-for-2.1-surround-sound.patch
  0028-conf-Add-surround-2.1-support-to-all-cards.patch
  0029-Portability-fix-look-for-sys-endian.h-as-well-as-end.patch
  0030-autotools-update-style.patch
  0031-pcm-Insert-linear-to-float-conversion-when-rate-or-c.patch
  0032-pcm-route-Allow-chmap-syntax-for-slave-channels-in-t.patch
  0033-pcm-route-Select-slave-chmap-based-on-ttable-informa.patch
  0034-conf-Allow-2.1-surround-to-use-different-number-of-c.patch
  0035-pcm-Wrap-hw_ptr-to-boundary-in-pcm_ioplug.patch
  0036-src-conf-cards-Add-missing-entry-for-Loopback.conf.patch

OBS-URL: https://build.opensuse.org/request/show/225572
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=152
2014-03-11 11:08:29 +00:00

79 lines
2.4 KiB
Diff

From e51cd448971c472d75dd700b0000988f6197b4da Mon Sep 17 00:00:00 2001
From: Olivier Langlois <olivier@trillion01.com>
Date: Wed, 22 Jan 2014 19:04:45 -0500
Subject: [PATCH] pcm: initialize pcm_dmix monotonic field
not doing so, leaves the pcm object in an inconsistent state since
'info' field is copied from the slave which is then used when
snd_pcm_hw_params_is_monotonic() is called.
For instance, when using dmix with aplay and an underrun is occuring, the following
info is returned:
underrun!!! (at least 1248687948.256 ms long)
Status:
state : XRUN
trigger_time: 1390347762.628483000
tstamp : 1390347766.184350000
delay : -635
avail : 15687
avail_max : 15675
now is computed from CLOCK_MONOTONIC while pcm status tstamps are from gettimeofday().
After the fix, underruns are still occuring on my setup but at least the displayed info
is correct:
underrun!!! (at least 7630.409 ms long)
Status:
state : XRUN
trigger_time: 7652.739201431
tstamp : 7660.369600636
delay : -624
avail : 15676
avail_max : 15664
Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_direct.c | 2 ++
src/pcm/pcm_dmix.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c
index 899c250401df..5416cf71674c 100644
--- a/src/pcm/pcm_direct.c
+++ b/src/pcm/pcm_direct.c
@@ -857,6 +857,7 @@ static void save_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
COPY_SLAVE(buffer_time);
COPY_SLAVE(sample_bits);
COPY_SLAVE(frame_bits);
+ COPY_SLAVE(monotonic);
}
#undef COPY_SLAVE
@@ -1220,6 +1221,7 @@ static void copy_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
COPY_SLAVE(buffer_time);
COPY_SLAVE(sample_bits);
COPY_SLAVE(frame_bits);
+ COPY_SLAVE(monotonic);
spcm->info &= ~SND_PCM_INFO_PAUSE;
spcm->boundary = recalc_boundary_size(dmix->shmptr->s.boundary, spcm->buffer_size);
diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c
index 2bd5d398d280..4aa6d4eab4a2 100644
--- a/src/pcm/pcm_dmix.c
+++ b/src/pcm/pcm_dmix.c
@@ -1104,7 +1104,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
pcm->poll_fd = dmix->poll_fd;
pcm->poll_events = POLLIN; /* it's different than other plugins */
-
+ pcm->monotonic = spcm->monotonic;
pcm->mmap_rw = 1;
snd_pcm_set_hw_ptr(pcm, &dmix->hw_ptr, -1, 0);
snd_pcm_set_appl_ptr(pcm, &dmix->appl_ptr, -1, 0);
--
1.9.0