- if (!c->authorized) {
- pa_pstream_send_error(c->pstream, tag, PA_ERR_ACCESS);
- return;
- }
-
- if (!(s = pa_idxset_get_by_index(c->output_streams, idx)) || s->type != PLAYBACK_STREAM) {
- pa_pstream_send_error(c->pstream, tag, PA_ERR_NOENTITY);
- return;
- }
-
- fprintf(stderr, "Corking %i\n", b);
+ CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS);
+ CHECK_VALIDITY(c->pstream, idx != PA_INVALID_INDEX, tag, PA_ERR_INVALID);
+ s = pa_idxset_get_by_index(c->output_streams, idx);
+ CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY);
+ CHECK_VALIDITY(c->pstream, s->type == PLAYBACK_STREAM, tag, PA_ERR_NOENTITY);