Accepting request 85033 from home:tiwai:branches:multimedia:libs

- backport upstream fixes: fix noresample hw_params rule and a few
  fixes for missing free()

OBS-URL: https://build.opensuse.org/request/show/85033
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=95
This commit is contained in:
Ismail Dönmez 2011-09-27 11:08:17 +00:00 committed by Git OBS Bridge
parent 153c4db3ed
commit b35a2527db
7 changed files with 257 additions and 0 deletions

View File

@ -0,0 +1,52 @@
From 6dab1a91cbbd40d2f52a0c5a1bd961a1db7bb319 Mon Sep 17 00:00:00 2001
From: Clemens Ladisch <clemens@ladisch.de>
Date: Wed, 21 Sep 2011 08:30:20 +0200
Subject: [PATCH 1/5] pcm: recalculate all rules after changing hw_params
flags
The rules engine avoids recalculating rules that do not depend on
any changed parameter, but there is no mechanism to record changed
flags. So when we change a flag, we have to ensure that all rules
depending on that flag are recalculated; the only method to do this
is to force recalculation of all rules.
So far, there have been no kernel drivers with rules depending
on flags, but rules to disable hardware SRCs by setting
SND_PCM_HW_PARAMS_NORESAMPLE are being introduced now.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
---
src/pcm/pcm.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 12f8cd0..bc5c6e4 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -4200,6 +4200,7 @@ int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *par
params->flags |= SND_PCM_HW_PARAMS_NORESAMPLE;
else
params->flags &= ~SND_PCM_HW_PARAMS_NORESAMPLE;
+ params->rmask = ~0;
return snd_pcm_hw_refine(pcm, params);
}
@@ -4231,6 +4232,7 @@ int snd_pcm_hw_params_set_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *par
params->flags |= SND_PCM_HW_PARAMS_EXPORT_BUFFER;
else
params->flags &= ~SND_PCM_HW_PARAMS_EXPORT_BUFFER;
+ params->rmask = ~0;
return snd_pcm_hw_refine(pcm, params);
}
@@ -4280,6 +4282,7 @@ int snd_pcm_hw_params_set_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *par
params->flags |= SND_PCM_HW_PARAMS_NO_PERIOD_WAKEUP;
} else
params->flags &= ~SND_PCM_HW_PARAMS_NO_PERIOD_WAKEUP;
+ params->rmask = ~0;
return snd_pcm_hw_refine(pcm, params);
}
--
1.7.6.1

View File

@ -0,0 +1,52 @@
From 2a7f653b7f3bea6c8f0895f1921c2d706f40684f Mon Sep 17 00:00:00 2001
From: Julia Lawall <julia@diku.dk>
Date: Sun, 18 Sep 2011 22:04:34 +0200
Subject: [PATCH 2/5] src/pcm/pcm_rate.c: add missing free
Something that is allocated using calloc is not freed on one
or more error paths.
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Suman Saha <sumsaha@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_rate.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
index 70e30e5..eb35e4a 100644
--- a/src/pcm/pcm_rate.c
+++ b/src/pcm/pcm_rate.c
@@ -1392,11 +1392,13 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
} else {
SNDERR("Invalid type for rate converter");
snd_pcm_close(pcm);
+ free(rate);
return -EINVAL;
}
if (err < 0) {
SNDERR("Cannot find rate converter");
snd_pcm_close(pcm);
+ free(rate);
return -ENOENT;
}
#else
@@ -1405,6 +1407,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
err = open_func(SND_PCM_RATE_PLUGIN_VERSION, &rate->obj, &rate->ops);
if (err < 0) {
snd_pcm_close(pcm);
+ free(rate);
return err;
}
#endif
@@ -1413,6 +1416,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
! rate->ops.input_frames || ! rate->ops.output_frames) {
SNDERR("Inproper rate plugin %s initialization", type);
snd_pcm_close(pcm);
+ free(rate);
return err;
}
--
1.7.6.1

View File

@ -0,0 +1,70 @@
From 03aa1a57c99460489815bf301e554c4d0a638bf6 Mon Sep 17 00:00:00 2001
From: Julia Lawall <julia@diku.dk>
Date: Sun, 18 Sep 2011 22:04:36 +0200
Subject: [PATCH 3/5] src/pcm/pcm_ladspa.c: add missing free
Something that is allocated using calloc is not freed on some
error paths.
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Suman Saha <sumsaha@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_ladspa.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c
index c413c10..84ebaa5 100644
--- a/src/pcm/pcm_ladspa.c
+++ b/src/pcm/pcm_ladspa.c
@@ -750,8 +750,10 @@ static int snd_pcm_ladspa_allocate_memory(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads
if (instance->input.data == NULL ||
instance->input.m_data == NULL ||
instance->output.data == NULL ||
- instance->output.m_data == NULL)
+ instance->output.m_data == NULL) {
+ free(pchannels);
return -ENOMEM;
+ }
for (idx = 0; idx < instance->input.channels.size; idx++) {
chn = instance->output.channels.array[idx];
if (pchannels[chn] == NULL && chn < ichannels) {
@@ -761,8 +763,10 @@ static int snd_pcm_ladspa_allocate_memory(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads
instance->input.data[idx] = pchannels[chn];
if (instance->input.data[idx] == NULL) {
instance->input.data[idx] = snd_pcm_ladspa_allocate_zero(ladspa, 0);
- if (instance->input.data[idx] == NULL)
+ if (instance->input.data[idx] == NULL) {
+ free(pchannels);
return -ENOMEM;
+ }
}
}
for (idx = 0; idx < instance->output.channels.size; idx++) {
@@ -770,8 +774,10 @@ static int snd_pcm_ladspa_allocate_memory(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads
/* FIXME/OPTIMIZE: check if we can remove double alloc */
/* if LADSPA plugin has no broken inplace */
instance->output.data[idx] = malloc(sizeof(LADSPA_Data) * ladspa->allocated);
- if (instance->output.data[idx] == NULL)
+ if (instance->output.data[idx] == NULL) {
+ free(pchannels);
return -ENOMEM;
+ }
pchannels[chn] = instance->output.m_data[idx] = instance->output.data[idx];
}
}
@@ -793,8 +799,10 @@ static int snd_pcm_ladspa_allocate_memory(snd_pcm_t *pcm, snd_pcm_ladspa_t *lads
instance->output.data[idx] = NULL;
} else {
instance->output.data[idx] = snd_pcm_ladspa_allocate_zero(ladspa, 1);
- if (instance->output.data[idx] == NULL)
+ if (instance->output.data[idx] == NULL) {
+ free(pchannels);
return -ENOMEM;
+ }
}
}
}
--
1.7.6.1

View File

@ -0,0 +1,30 @@
From c36f8c87ffb978d8cabbc4e5c489f14b6b276365 Mon Sep 17 00:00:00 2001
From: Julia Lawall <julia@diku.dk>
Date: Sun, 18 Sep 2011 22:04:37 +0200
Subject: [PATCH 4/5] src/pcm/pcm_multi.c: add missing free
Something that is allocated using calloc is not freed on an error path.
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Suman Saha <sumsaha@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_multi.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c
index 68f2d68..6b39c7a 100644
--- a/src/pcm/pcm_multi.c
+++ b/src/pcm/pcm_multi.c
@@ -886,6 +886,8 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
err = snd_pcm_new(&pcm, SND_PCM_TYPE_MULTI, name, stream,
multi->slaves[0].pcm->mode);
if (err < 0) {
+ free(multi->slaves);
+ free(multi->channels);
free(multi);
return err;
}
--
1.7.6.1

View File

@ -0,0 +1,37 @@
From fef6e6fd580073e0c0696105f808145561990b75 Mon Sep 17 00:00:00 2001
From: Julia Lawall <julia@diku.dk>
Date: Thu, 22 Sep 2011 13:59:31 +0200
Subject: [PATCH 5/5] src/pcm/pcm_mmap.c: add missing free
The mmap_channels and running_areas fields are allocated using calloc, but
are not freed on an error path.
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Suman Saha <sumsaha@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_mmap.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c
index 4621fe6..6b44050 100644
--- a/src/pcm/pcm_mmap.c
+++ b/src/pcm/pcm_mmap.c
@@ -320,8 +320,13 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
snd_pcm_channel_info_t *i = &pcm->mmap_channels[c];
i->channel = c;
err = snd_pcm_channel_info(pcm, i);
- if (err < 0)
+ if (err < 0) {
+ free(pcm->mmap_channels);
+ free(pcm->running_areas);
+ pcm->mmap_channels = NULL;
+ pcm->running_areas = NULL;
return err;
+ }
}
for (c = 0; c < pcm->channels; ++c) {
snd_pcm_channel_info_t *i = &pcm->mmap_channels[c];
--
1.7.6.1

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Sep 27 10:00:09 CEST 2011 - tiwai@suse.de
- backport upstream fixes: fix noresample hw_params rule and a few
fixes for missing free()
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Sep 20 09:45:12 CEST 2011 - tiwai@suse.de Tue Sep 20 09:45:12 CEST 2011 - tiwai@suse.de

View File

@ -79,6 +79,11 @@ Patch27: 0027-ucm-fix-seg-fault-in-execute_cset.patch
Patch28: 0028-ucm-tivial-code-style-fix.patch Patch28: 0028-ucm-tivial-code-style-fix.patch
Patch29: 0029-ucm-add-another-sequence-msleep.patch Patch29: 0029-ucm-add-another-sequence-msleep.patch
Patch30: 0030-conf-Allow-for-a-directory-to-be-given-as-a-config-f.patch Patch30: 0030-conf-Allow-for-a-directory-to-be-given-as-a-config-f.patch
Patch31: 0031-pcm-recalculate-all-rules-after-changing-hw_params-f.patch
Patch32: 0032-src-pcm-pcm_rate.c-add-missing-free.patch
Patch33: 0033-src-pcm-pcm_ladspa.c-add-missing-free.patch
Patch34: 0034-src-pcm-pcm_multi.c-add-missing-free.patch
Patch35: 0035-src-pcm-pcm_mmap.c-add-missing-free.patch
Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff
Url: http://www.alsa-project.org/ Url: http://www.alsa-project.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -156,6 +161,11 @@ Architecture.
%patch28 -p1 %patch28 -p1
%patch29 -p1 %patch29 -p1
%patch30 -p1 %patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%if %suse_version == 1130 %if %suse_version == 1130
%patch99 -p1 %patch99 -p1
%endif %endif