On Tue, 2015-12-29 at 09:03 +0530, arun at accosted.net wrote: > @@ -1286,14 +1287,19 @@ static int create_stream( > Â Â Â Â Â Â Â Â Â Â Â Â Â PA_TAG_BOOLEAN, s->corked, > Â Â Â Â Â Â Â Â Â Â Â Â Â PA_TAG_INVALID); > Â > -Â Â Â Â if (!volume) { > +Â Â Â Â if (volume) { > +Â Â Â Â Â Â Â Â s->volume = *volume; > +Â Â Â Â Â Â Â Â s->volume_set = true; > +Â Â Â Â } I'd prefer not to save the initial volume. I don't see the need for it, and it means that s->volume has different semantics depending on the stream state: at one point it's the client's requested volume, and at another point it's the server-assigned volume. If we do allow calling pa_stream_set_volume() before connecting the stream and save the initial requested volume in s->volume, it should be documented what happens in this sequence: pa_stream_set_volume(); pa_stream_connect_playback(volume=NULL); Currently the documentation says that giving NULL volume to pa_stream_connect_playback() results in the default volume being assigned for the stream, but this patch changes that. > +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); > +Â Â Â Â 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? */ No, I don't think it makes sense to support setting volume for sample uploads. -- Tanu