summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/sink-input.c
diff options
context:
space:
mode:
authorArun Raghavan <arun.raghavan@collabora.co.uk>2011-03-02 10:53:45 +0530
committerArun Raghavan <arun.raghavan@collabora.co.uk>2011-05-02 11:54:48 +0530
commit5d5523604f03ac7d6b8f67569ed4ac6c06c72463 (patch)
tree59360f4654f8b0abfed3ca7019d2ee3c201c9814 /src/pulsecore/sink-input.c
parente64f02ad9ec7d027e0360e3964e88a497d5df02f (diff)
sink-input: Minor cleanups
Removes a couple of warnings and simplifies the assertion logic that verifies format negotiation was successful.
Diffstat (limited to 'src/pulsecore/sink-input.c')
-rw-r--r--src/pulsecore/sink-input.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index b05373f8..92e364f8 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -185,9 +185,6 @@ pa_bool_t pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_id
}
void pa_sink_input_new_data_done(pa_sink_input_new_data *data) {
- pa_format_info *f;
- int i;
-
pa_assert(data);
if (data->req_formats)
@@ -273,11 +270,14 @@ int pa_sink_input_new(
/* Routing's done, we have a sink. Now let's fix the format and set up the
* sample spec */
- pa_return_val_if_fail(data->format || (data->nego_formats && !pa_idxset_isempty(data->nego_formats)), -PA_ERR_INVALID);
+
/* If something didn't pick a format for us, pick the top-most format since
* we assume this is sorted in priority order */
- if (!data->format)
+ if (!data->format && data->nego_formats && !pa_idxset_isempty(data->nego_formats))
data->format = pa_format_info_copy(pa_idxset_first(data->nego_formats, NULL));
+
+ pa_return_val_if_fail(data->format, -PA_ERR_INVALID);
+
/* 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)) {