summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@digia.com>2012-03-23 11:01:22 +0200
committerTanu Kaskinen <tanuk@iki.fi>2012-03-28 17:22:44 +0300
commit2f7a586a23a7e8c595c4a0a1d11b75669953d794 (patch)
treeb99b630f5b34eee53a918349d7980d0c4cd51e22
parentc2c5e044cce27a25261d2603cc0a9e72806d3972 (diff)
sample-util: Remove redundant check from pa_volume_memchunk.
Add also an assertion for the sample spec validity. The existing code already does crash in case of an invalid sample spec, but the error would not be as obvious: the crash would happen due to a divide-by-zero operation in pa_frame_aligned().
-rw-r--r--src/pulsecore/sample-util.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c
index f2017aa8..38201b23 100644
--- a/src/pulsecore/sample-util.c
+++ b/src/pulsecore/sample-util.c
@@ -721,6 +721,7 @@ void pa_volume_memchunk(
pa_assert(c);
pa_assert(spec);
+ pa_assert(pa_sample_spec_valid(spec));
pa_assert(pa_frame_aligned(c->length, spec));
pa_assert(volume);
@@ -735,11 +736,6 @@ void pa_volume_memchunk(
return;
}
- if (spec->format < 0 || spec->format >= PA_SAMPLE_MAX) {
- pa_log_warn("Unable to change volume of format");
- return;
- }
-
do_volume = pa_get_volume_func(spec->format);
pa_assert(do_volume);