mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-31 22:25:33 -04:00
introspect: Fix a bug in sink/source info protocol handling related to ports.
Previously the active_profile was extracted from the tagstruct regardless of the protocol version which caused errors while speaking to older version servers.
This commit is contained in:
parent
a007d4740f
commit
59376b039e
1 changed files with 62 additions and 58 deletions
|
|
@ -201,42 +201,44 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
|
|||
goto finish;
|
||||
}
|
||||
|
||||
if (i.n_ports > 0) {
|
||||
i.ports = pa_xnew(pa_sink_port_info*, i.n_ports+1);
|
||||
i.ports[0] = pa_xnew(pa_sink_port_info, i.n_ports);
|
||||
if (o->context->version >= 16) {
|
||||
if (i.n_ports > 0) {
|
||||
i.ports = pa_xnew(pa_sink_port_info*, i.n_ports+1);
|
||||
i.ports[0] = pa_xnew(pa_sink_port_info, i.n_ports);
|
||||
|
||||
for (j = 0; j < i.n_ports; j++) {
|
||||
if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
|
||||
pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
|
||||
for (j = 0; j < i.n_ports; j++) {
|
||||
if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
|
||||
pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
|
||||
|
||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||
pa_xfree(i.ports);
|
||||
pa_xfree(i.ports[0]);
|
||||
pa_proplist_free(i.proplist);
|
||||
goto finish;
|
||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||
pa_xfree(i.ports);
|
||||
pa_xfree(i.ports[0]);
|
||||
pa_proplist_free(i.proplist);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
i.ports[j] = &i.ports[0][j];
|
||||
}
|
||||
|
||||
i.ports[j] = &i.ports[0][j];
|
||||
i.ports[j] = NULL;
|
||||
}
|
||||
|
||||
i.ports[j] = NULL;
|
||||
}
|
||||
if (pa_tagstruct_gets(t, &ap) < 0) {
|
||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||
pa_xfree(i.ports[0]);
|
||||
pa_xfree(i.ports);
|
||||
pa_proplist_free(i.proplist);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (pa_tagstruct_gets(t, &ap) < 0) {
|
||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||
pa_xfree(i.ports[0]);
|
||||
pa_xfree(i.ports);
|
||||
pa_proplist_free(i.proplist);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (ap) {
|
||||
for (j = 0; j < i.n_ports; j++)
|
||||
if (pa_streq(i.ports[j]->name, ap)) {
|
||||
i.active_port = i.ports[j];
|
||||
break;
|
||||
}
|
||||
if (ap) {
|
||||
for (j = 0; j < i.n_ports; j++)
|
||||
if (pa_streq(i.ports[j]->name, ap)) {
|
||||
i.active_port = i.ports[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i.mute = (int) mute;
|
||||
|
|
@ -428,42 +430,44 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
|
|||
goto finish;
|
||||
}
|
||||
|
||||
if (i.n_ports > 0) {
|
||||
i.ports = pa_xnew(pa_source_port_info*, i.n_ports+1);
|
||||
i.ports[0] = pa_xnew(pa_source_port_info, i.n_ports);
|
||||
if (o->context->version >= 16) {
|
||||
if (i.n_ports > 0) {
|
||||
i.ports = pa_xnew(pa_source_port_info*, i.n_ports+1);
|
||||
i.ports[0] = pa_xnew(pa_source_port_info, i.n_ports);
|
||||
|
||||
for (j = 0; j < i.n_ports; j++) {
|
||||
if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
|
||||
pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
|
||||
for (j = 0; j < i.n_ports; j++) {
|
||||
if (pa_tagstruct_gets(t, &i.ports[0][j].name) < 0 ||
|
||||
pa_tagstruct_gets(t, &i.ports[0][j].description) < 0 ||
|
||||
pa_tagstruct_getu32(t, &i.ports[0][j].priority) < 0) {
|
||||
|
||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||
pa_xfree(i.ports[0]);
|
||||
pa_xfree(i.ports);
|
||||
pa_proplist_free(i.proplist);
|
||||
goto finish;
|
||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||
pa_xfree(i.ports[0]);
|
||||
pa_xfree(i.ports);
|
||||
pa_proplist_free(i.proplist);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
i.ports[j] = &i.ports[0][j];
|
||||
}
|
||||
|
||||
i.ports[j] = &i.ports[0][j];
|
||||
i.ports[j] = NULL;
|
||||
}
|
||||
|
||||
i.ports[j] = NULL;
|
||||
}
|
||||
if (pa_tagstruct_gets(t, &ap) < 0) {
|
||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||
pa_xfree(i.ports[0]);
|
||||
pa_xfree(i.ports);
|
||||
pa_proplist_free(i.proplist);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (pa_tagstruct_gets(t, &ap) < 0) {
|
||||
pa_context_fail(o->context, PA_ERR_PROTOCOL);
|
||||
pa_xfree(i.ports[0]);
|
||||
pa_xfree(i.ports);
|
||||
pa_proplist_free(i.proplist);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (ap) {
|
||||
for (j = 0; j < i.n_ports; j++)
|
||||
if (pa_streq(i.ports[j]->name, ap)) {
|
||||
i.active_port = i.ports[j];
|
||||
break;
|
||||
}
|
||||
if (ap) {
|
||||
for (j = 0; j < i.n_ports; j++)
|
||||
if (pa_streq(i.ports[j]->name, ap)) {
|
||||
i.active_port = i.ports[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i.mute = (int) mute;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue