If a client leaves the sink/source for a stream unspecified by passing NULL as

sink/source name sink/source we should pass NULL to
pa_sink_input_new()/pa_source_output_new() as too. This allows
hooks to change the sink/source device only if it is left unspecified by the client



git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1303 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2006-08-19 23:06:45 +00:00
parent bf62e77f71
commit bffde5da05
2 changed files with 31 additions and 24 deletions

View file

@ -327,7 +327,7 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t
int32_t format, rate;
pa_sample_spec ss;
size_t l;
pa_sink *sink;
pa_sink *sink = NULL;
pa_sink_input_new_data sdata;
assert(c && length == (sizeof(int32_t)*2+ESD_NAME_MAX));
@ -344,8 +344,11 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t
format_esd2native(format, c->swap_byte_order, &ss);
CHECK_VALIDITY(pa_sample_spec_valid(&ss), "Invalid sample specification");
sink = pa_namereg_get(c->protocol->core, c->protocol->sink_name, PA_NAMEREG_SINK, 1);
CHECK_VALIDITY(sink, "No such sink");
if (c->protocol->sink_name) {
sink = pa_namereg_get(c->protocol->core, c->protocol->sink_name, PA_NAMEREG_SINK, 1);
CHECK_VALIDITY(sink, "No such sink");
}
strncpy(name, data, sizeof(name));
name[sizeof(name)-1] = 0;
@ -397,7 +400,7 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t
static int esd_proto_stream_record(struct connection *c, esd_proto_t request, const void *data, size_t length) {
char name[ESD_NAME_MAX], *utf8_name;
int32_t format, rate;
pa_source *source;
pa_source *source = NULL;
pa_sample_spec ss;
size_t l;
pa_source_output_new_data sdata;
@ -431,10 +434,12 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co
}
} else {
assert(request == ESD_PROTO_STREAM_REC);
if (!(source = pa_namereg_get(c->protocol->core, c->protocol->source_name, PA_NAMEREG_SOURCE, 1))) {
pa_log("no such source.");
return -1;
if (c->protocol->source_name) {
if (!(source = pa_namereg_get(c->protocol->core, c->protocol->source_name, PA_NAMEREG_SOURCE, 1))) {
pa_log("no such source.");
return -1;
}
}
}