[polypaudio-commits] r978 - in /trunk/src/polyp: internal.h stream.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Fri May 26 00:24:25 PDT 2006
Author: ossman
Date: Fri May 26 09:24:25 2006
New Revision: 978
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=978&root=polypaudio&view=rev
Log:
Explicitly check version number when determining which fields are in a stream
create response.
Modified:
trunk/src/polyp/internal.h
trunk/src/polyp/stream.c
Modified: trunk/src/polyp/internal.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/internal.h?rev=978&root=polypaudio&r1=977&r2=978&view=diff
==============================================================================
--- trunk/src/polyp/internal.h (original)
+++ trunk/src/polyp/internal.h Fri May 26 09:24:25 2006
@@ -100,7 +100,6 @@
char *name;
pa_buffer_attr buffer_attr;
- int buffer_attr_from_server;
pa_sample_spec sample_spec;
pa_channel_map channel_map;
pa_stream_flags_t flags;
Modified: trunk/src/polyp/stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/stream.c?rev=978&root=polypaudio&r1=977&r2=978&view=diff
==============================================================================
--- trunk/src/polyp/stream.c (original)
+++ trunk/src/polyp/stream.c Fri May 26 09:24:25 2006
@@ -84,7 +84,6 @@
s->requested_bytes = 0;
s->state = PA_STREAM_UNCONNECTED;
memset(&s->buffer_attr, 0, sizeof(s->buffer_attr));
- s->buffer_attr_from_server = 0;
s->peek_memchunk.index = 0;
s->peek_memchunk.length = 0;
@@ -407,36 +406,27 @@
goto finish;
}
- if (!pa_tagstruct_eof(t)) {
-
+ if (pa_context_get_server_protocol_version(s->context) >= 9) {
if (s->direction == PA_STREAM_PLAYBACK) {
-
- /* This is a server 0.9.0 or later */
if (pa_tagstruct_getu32(t, &s->buffer_attr.maxlength) < 0 ||
pa_tagstruct_getu32(t, &s->buffer_attr.tlength) < 0 ||
pa_tagstruct_getu32(t, &s->buffer_attr.prebuf) < 0 ||
- pa_tagstruct_getu32(t, &s->buffer_attr.minreq) < 0 ||
- !pa_tagstruct_eof(t)) {
+ pa_tagstruct_getu32(t, &s->buffer_attr.minreq) < 0) {
pa_context_fail(s->context, PA_ERR_PROTOCOL);
goto finish;
}
-
- s->buffer_attr_from_server = 1;
} else if (s->direction == PA_STREAM_RECORD) {
-
- /* This is a server 0.9.0 or later */
if (pa_tagstruct_getu32(t, &s->buffer_attr.maxlength) < 0 ||
- pa_tagstruct_getu32(t, &s->buffer_attr.fragsize) < 0 ||
- !pa_tagstruct_eof(t)) {
+ pa_tagstruct_getu32(t, &s->buffer_attr.fragsize) < 0) {
pa_context_fail(s->context, PA_ERR_PROTOCOL);
goto finish;
}
-
- s->buffer_attr_from_server = 1;
- } else {
- pa_context_fail(s->context, PA_ERR_PROTOCOL);
- goto finish;
}
+ }
+
+ if (!pa_tagstruct_eof(t)) {
+ pa_context_fail(s->context, PA_ERR_PROTOCOL);
+ goto finish;
}
if (s->direction == PA_STREAM_RECORD) {
@@ -1375,7 +1365,8 @@
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE);
PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE);
- PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->buffer_attr_from_server, PA_ERR_NODATA);
+ PA_CHECK_VALIDITY_RETURN_NULL(s->context,
+ pa_context_get_server_protocol_version(s->context) >= 9, PA_ERR_NODATA);
return &s->buffer_attr;
}
More information about the pulseaudio-commits
mailing list