[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] tunnel-sink-new: log buffer events

Georg Chini gitlab at gitlab.freedesktop.org
Wed Dec 9 12:06:56 UTC 2020



Georg Chini pushed to branch master at PulseAudio / pulseaudio


Commits:
a8cb4edf by Pierre Ossman at 2020-12-09T11:54:37+00:00
tunnel-sink-new: log buffer events

Aids in tracking down exactly where in the chain underruns are
happening.

Signed-off-by: Pierre Ossman <ossman at cendio.se>

- - - - -


1 changed file:

- src/modules/module-tunnel-sink-new.c


Changes:

=====================================
src/modules/module-tunnel-sink-new.c
=====================================
@@ -280,6 +280,9 @@ static void stream_changed_buffer_attr_cb(pa_stream *stream, void *userdata) {
 
     bufferattr = pa_stream_get_buffer_attr(u->stream);
     pa_sink_set_max_request_within_thread(u->sink, bufferattr->tlength);
+
+    pa_log_debug("Server reports buffer attrs changed. tlength now at %lu.",
+                 (unsigned long) bufferattr->tlength);
 }
 
 /* called after we requested a change of the stream buffer_attr */
@@ -287,6 +290,16 @@ static void stream_set_buffer_attr_cb(pa_stream *stream, int success, void *user
     stream_changed_buffer_attr_cb(stream, userdata);
 }
 
+/* called when the server experiences an underrun of our buffer */
+static void stream_underflow_callback(pa_stream *stream, void *userdata) {
+    pa_log_info("Server signalled buffer underrun.");
+}
+
+/* called when the server experiences an overrun of our buffer */
+static void stream_overflow_callback(pa_stream *stream, void *userdata) {
+    pa_log_info("Server signalled buffer overrun.");
+}
+
 static void context_state_cb(pa_context *c, void *userdata) {
     struct userdata *u = userdata;
     pa_assert(u);
@@ -333,8 +346,12 @@ static void context_state_cb(pa_context *c, void *userdata) {
             reset_bufferattr(&bufferattr);
             bufferattr.tlength = pa_usec_to_bytes(requested_latency, &u->sink->sample_spec);
 
+            pa_log_debug("tlength requested at %lu.", (unsigned long) bufferattr.tlength);
+
             pa_stream_set_state_callback(u->stream, stream_state_cb, userdata);
             pa_stream_set_buffer_attr_callback(u->stream, stream_changed_buffer_attr_cb, userdata);
+            pa_stream_set_underflow_callback(u->stream, stream_underflow_callback, userdata);
+            pa_stream_set_overflow_callback(u->stream, stream_overflow_callback, userdata);
             if (pa_stream_connect_playback(u->stream,
                                            u->remote_sink_name,
                                            &bufferattr,
@@ -383,6 +400,9 @@ static void sink_update_requested_latency_cb(pa_sink *s) {
                 if (pa_stream_get_buffer_attr(u->stream)->tlength == nbytes)
                     break;
 
+                pa_log_debug("Requesting new buffer attrs. tlength requested at %lu.",
+                             (unsigned long) nbytes);
+
                 reset_bufferattr(&bufferattr);
                 bufferattr.tlength = nbytes;
                 if ((operation = pa_stream_set_buffer_attr(u->stream, &bufferattr, stream_set_buffer_attr_cb, u)))



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/a8cb4edf7591bf3038769ea1cd2eae264c67ea51

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/a8cb4edf7591bf3038769ea1cd2eae264c67ea51
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20201209/d5e071be/attachment-0001.htm>


More information about the pulseaudio-commits mailing list