diff options
author | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2011-03-02 11:16:07 +0530 |
---|---|---|
committer | Arun Raghavan <arun.raghavan@collabora.co.uk> | 2011-05-02 11:54:48 +0530 |
commit | 13229fb39e7b8cff3f114c98f8236d9123442243 (patch) | |
tree | c411d776fabb3abb1c6a42dd83af69144f58c653 /src/pulsecore/sink-input.c | |
parent | 8ec0548f5f4c7ce3213e4639722d9cb78fc13b90 (diff) |
sink-input: Don't assert on bad formats
Handles bad format input more gracefully and returns an error instead.
Diffstat (limited to 'src/pulsecore/sink-input.c')
-rw-r--r-- | src/pulsecore/sink-input.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; |