[pulseaudio-commits] r1581 - /branches/lennart/src/pulsecore/protocol-native.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Mon Aug 6 09:13:33 PDT 2007
Author: lennart
Date: Mon Aug 6 18:13:32 2007
New Revision: 1581
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=3D1581&root=3Dpulseaudio&vi=
ew=3Drev
Log:
fix playback over native protocol
Modified:
branches/lennart/src/pulsecore/protocol-native.c
Modified: branches/lennart/src/pulsecore/protocol-native.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/=
protocol-native.c?rev=3D1581&root=3Dpulseaudio&r1=3D1580&r2=3D1581&view=3Dd=
iff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- branches/lennart/src/pulsecore/protocol-native.c (original)
+++ branches/lennart/src/pulsecore/protocol-native.c Mon Aug 6 18:13:32 20=
07
@@ -321,8 +321,8 @@
return;
=
pa_assert_se(pa_idxset_remove_by_data(s->connection->output_streams, s=
, NULL) =3D=3D s);
+ s->connection =3D NULL;
upload_stream_unref(s);
- s->connection =3D NULL;
}
=
static void upload_stream_free(pa_object *o) {
@@ -379,8 +379,8 @@
}
=
pa_assert_se(pa_idxset_remove_by_data(s->connection->record_streams, s=
, NULL) =3D=3D s);
+ s->connection =3D NULL;
record_stream_unref(s); =
- s->connection =3D NULL;
}
=
static void record_stream_free(pa_object *o) {
@@ -496,8 +496,8 @@
pa_pstream_send_error(s->connection->pstream, s->drain_tag, PA_ERR=
_NOENTITY);
=
pa_assert_se(pa_idxset_remove_by_data(s->connection->output_streams, s=
, NULL) =3D=3D s);
+ s->connection =3D NULL;
playback_stream_unref(s); =
- s->connection =3D NULL;
}
=
static void playback_stream_free(pa_object* o) {
@@ -531,7 +531,7 @@
pa_tagstruct_putu32(t, l);
pa_pstream_send_tagstruct(s->connection->pstream, t);
=
- /* pa_log("Requesting %u bytes", l); */
+/* pa_log("Requesting %u bytes", l); */
break;
}
=
@@ -729,15 +729,21 @@
static void request_bytes(playback_stream *s) {
size_t new_missing, delta, previous_missing;
=
+
+/* pa_log("request_bytes()"); */
playback_stream_assert_ref(s);
=
new_missing =3D pa_memblockq_missing(s->memblockq);
-
- if (new_missing <=3D s->last_missing)
- return;
+ =
+ if (new_missing <=3D s->last_missing) {
+ s->last_missing =3D new_missing;
+ return;
+ }
=
delta =3D new_missing - s->last_missing;
s->last_missing =3D new_missing;
+
+/* pa_log("request_bytes(%u)", delta); */
=
previous_missing =3D pa_atomic_add(&s->missing, delta);
if (previous_missing < pa_memblockq_get_minreq(s->memblockq) && previo=
us_missing+delta >=3D pa_memblockq_get_minreq(s->memblockq))
@@ -812,6 +818,7 @@
=
case SINK_INPUT_MESSAGE_SEEK: =
pa_memblockq_seek(s->memblockq, offset, PA_PTR_TO_UINT(userdat=
a));
+ request_bytes(s);
return 0;
=
case SINK_INPUT_MESSAGE_POST_DATA: {
@@ -823,6 +830,8 @@
pa_asyncmsgq_post(s->connection->protocol->core->asyncmsgq=
, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_OVERFLOW, NULL, 0, NULL, NULL);
pa_memblockq_seek(s->memblockq, chunk->length, PA_SEEK_REL=
ATIVE);
}
+
+ request_bytes(s);
=
s->underrun =3D 0;
return 0;
@@ -838,6 +847,7 @@
s->drain_tag =3D PA_PTR_TO_UINT(userdata);
s->drain_request =3D 1;
}
+ request_bytes(s);
=
return 0;
}
@@ -891,6 +901,7 @@
case PA_SINK_INPUT_MESSAGE_SET_STATE:
=
pa_memblockq_prebuf_force(s->memblockq);
+ request_bytes(s);
break;
=
case PA_SINK_INPUT_MESSAGE_GET_LATENCY: {
@@ -921,11 +932,13 @@
}
=
if (pa_memblockq_peek(s->memblockq, chunk) < 0) {
-/* pa_log("peek: failure"); */
+/* pa_log("peek: failure"); */
return -1;
}
=
-/* pa_log("peek: %u", chunk->length); */
+/* pa_log("peek: %u", chunk->length); */
+
+ request_bytes(s);
=
return 0;
}
@@ -1083,6 +1096,8 @@
pa_tagstruct_putu32(reply, s->sink_input->index);
pa_tagstruct_putu32(reply, missing);
=
+/* pa_log("initial request is %u", missing); */
+ =
if (c->version >=3D 9) {
/* Since 0.9 we support sending the buffer metrics back to the cli=
ent */
=
@@ -2158,11 +2173,11 @@
break;
=
case PA_COMMAND_PREBUF_PLAYBACK_STREAM:
+ pa_asyncmsgq_send(s->sink_input->sink->asyncmsgq, PA_MSGOBJECT=
(s->sink_input), SINK_INPUT_MESSAGE_PREBUF_FORCE, NULL, 0, NULL);
+ break;
+
+ case PA_COMMAND_TRIGGER_PLAYBACK_STREAM:
pa_asyncmsgq_send(s->sink_input->sink->asyncmsgq, PA_MSGOBJECT=
(s->sink_input), SINK_INPUT_MESSAGE_TRIGGER, NULL, 0, NULL);
- break;
-
- case PA_COMMAND_TRIGGER_PLAYBACK_STREAM:
- pa_asyncmsgq_send(s->sink_input->sink->asyncmsgq, PA_MSGOBJECT=
(s->sink_input), SINK_INPUT_MESSAGE_PREBUF_FORCE, NULL, 0, NULL);
break;
=
default:
More information about the pulseaudio-commits
mailing list