[pulseaudio-discuss] [PATCH/RFC 1/1] sink-input: always validate sample specs
eero.nurkkala at offcode.fi
eero.nurkkala at offcode.fi
Fri Jun 1 02:52:28 PDT 2012
From: Eero Nurkkala <eero.nurkkala at offcode.fi>
It's not guaranteed 'ss' has a valid set of data in itself. Occasionally
it may contain data that makes the pulseaudio not usable at all. In that
particular scenario, pulseaudio rejects all requests into it. If the
data isn't valid, it better not be used:
I [pulseaudio] protocol-native.c: Client authenticated anonymously.
D [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Client added for object /org/pulseaudio/core1/client2
D [pulseaudio] protocol-native.c: Protocol version: remote 23, local 23
D [pulseaudio] protocol-native.c: SHM possible: no
D [pulseaudio] protocol-native.c: Negotiated SHM: no
D [pulseaudio] sink-input.c: Assertion 'pa_sample_spec_valid(&data->sample_spec)' failed at pulsecore/sink-input.c:312, function pa_sink_input_new.
Signed-off-by: Eero Nurkkala <eero.nurkkala at offcode.fi>
---
Note: This has been tested on version 1.1 only, but looks like the logic
hasn't changed. Could be I'm doing something wrong, but things appears to
work better with the patch.
src/pulsecore/sink-input.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index f6f7324..d134056 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -293,7 +293,8 @@ int pa_sink_input_new(
/* Now populate the sample spec and format according to the final
* format that we've negotiated */
pa_return_val_if_fail(pa_format_info_to_sample_spec(data->format, &ss, &map) == 0, -PA_ERR_INVALID);
- pa_sink_input_new_data_set_sample_spec(data, &ss);
+ if (pa_sample_spec_valid(&ss))
+ pa_sink_input_new_data_set_sample_spec(data, &ss);
if (pa_format_info_is_pcm(data->format) && pa_channel_map_valid(&map))
pa_sink_input_new_data_set_channel_map(data, &map);
--
1.7.4.1
More information about the pulseaudio-discuss
mailing list