From 13229fb39e7b8cff3f114c98f8236d9123442243 Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Wed, 2 Mar 2011 11:16:07 +0530 Subject: sink-input: Don't assert on bad formats Handles bad format input more gracefully and returns an error instead. --- src/pulsecore/sink-input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pulsecore') diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 1706a7fb..a4659558 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -281,12 +281,12 @@ int pa_sink_input_new( /* Now populate the sample spec and format according to the final * format that we've negotiated */ if (PA_LIKELY(data->format->encoding == PA_ENCODING_PCM)) { - pa_format_info_to_sample_spec(data->format, &ss, &map); + pa_return_val_if_fail(pa_format_info_to_sample_spec(data->format, &ss, &map), -PA_ERR_INVALID); pa_sink_input_new_data_set_sample_spec(data, &ss); if (pa_channel_map_valid(&map)) pa_sink_input_new_data_set_channel_map(data, &map); } else { - pa_format_info_to_sample_spec_fake(data->format, &ss); + pa_return_val_if_fail(pa_format_info_to_sample_spec_fake(data->format, &ss), -PA_ERR_INVALID); pa_sink_input_new_data_set_sample_spec(data, &ss); /* XXX: this is redundant - we can just check the encoding */ data->flags |= PA_SINK_INPUT_PASSTHROUGH; -- cgit