vlc | branch: master | Rémi Denis-Courmont <r...@remlab.net> | Fri Oct 26 
21:34:44 2012 +0300| [40d4d0fdf1269e28095e778e2486d9184c1733f1] | committer: 
Rémi Denis-Courmont

PulseAudio: log buffer attribute changes

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=40d4d0fdf1269e28095e778e2486d9184c1733f1
---

 modules/audio_output/pulse.c |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 9c5c619..0e8e8b0 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -370,6 +370,16 @@ static void stream_state_cb(pa_stream *s, void *userdata)
     }
 }
 
+static void stream_buffer_attr_cb(pa_stream *s, void *userdata)
+{
+    audio_output_t *aout = userdata;
+    const pa_buffer_attr *pba = pa_stream_get_buffer_attr(s);
+
+    msg_Dbg(aout, "changed buffer metrics: maxlength=%u, tlength=%u, "
+            "prebuf=%u, minreq=%u",
+            pba->maxlength, pba->tlength, pba->prebuf, pba->minreq);
+}
+
 static void stream_event_cb(pa_stream *s, const char *name, pa_proplist *pl,
                             void *userdata)
 {
@@ -922,6 +932,7 @@ static int Open(vlc_object_t *obj)
     }
     sys->stream = s;
     pa_stream_set_state_callback(s, stream_state_cb, sys->mainloop);
+    pa_stream_set_buffer_attr_callback(s, stream_buffer_attr_cb, aout);
     pa_stream_set_event_callback(s, stream_event_cb, aout);
     pa_stream_set_latency_update_callback(s, stream_latency_cb, aout);
     pa_stream_set_moved_callback(s, stream_moved_cb, aout);
@@ -950,11 +961,7 @@ static int Open(vlc_object_t *obj)
         }
     }
 #endif
-
-    const struct pa_buffer_attr *pba = pa_stream_get_buffer_attr(s);
-    msg_Dbg(aout, "using buffer metrics: maxlength=%u, tlength=%u, "
-            "prebuf=%u, minreq=%u",
-            pba->maxlength, pba->tlength, pba->prebuf, pba->minreq);
+    stream_buffer_attr_cb(s, aout);
 
     var_Create(aout, "audio-device", VLC_VAR_INTEGER|VLC_VAR_HASCHOICE);
     var_Change(aout, "audio-device", VLC_VAR_SETTEXT,
@@ -1012,6 +1019,7 @@ static void Close (vlc_object_t *obj)
 
         /* Clear all callbacks */
         pa_stream_set_state_callback(s, NULL, NULL);
+        pa_stream_set_buffer_attr_callback(s, NULL, NULL);
         pa_stream_set_event_callback(s, NULL, NULL);
         pa_stream_set_latency_update_callback(s, NULL, NULL);
         pa_stream_set_moved_callback(s, NULL, NULL);

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to