A couple more comments... On Tue, 2015-12-29 at 09:03 +0530, arun at accosted.net wrote: > +int pa_stream_set_volume(pa_stream *s, pa_cvolume *v, pa_stream_success_cb_t cb, void *userdata) { > +Â Â Â Â pa_operation *o; > +Â Â Â Â pa_tagstruct *t; > +Â Â Â Â uint32_t tag; > + > +Â Â Â Â pa_assert(s); > +Â Â Â Â pa_assert(v); > +Â Â Â Â pa_assert(PA_REFCNT_VALUE(s) >= 1); > + > +Â Â Â Â PA_CHECK_VALIDITY(s->context, !pa_detect_fork(), PA_ERR_FORKED); > +Â Â Â Â PA_CHECK_VALIDITY(s->context, s->state != PA_STREAM_FAILED && s->state != PA_STREAM_TERMINATED, PA_ERR_BADSTATE); s->state has to be PA_STREAM_READY, because the function depends on having s->sample_spec and s->stream_index initialized. > +Â Â Â Â PA_CHECK_VALIDITY(s->context, userdata == NULL || cb != NULL, PA_ERR_INVALID); > +Â Â Â Â PA_CHECK_VALIDITY(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_INVALID); /* TODO: do we want to support this? */ > +Â Â Â Â PA_CHECK_VALIDITY(s->context, pa_cvolume_valid(v), PA_ERR_INVALID); > +Â Â Â Â PA_CHECK_VALIDITY(s->context, pa_cvolume_compatible(v, &s->sample_spec), PA_ERR_INVALID); If the volume has only one channel, it should be always accepted. It would be also good to document this in the header. -- Tanu