[pulseaudio-commits] r2457 - in /trunk/src/pulsecore: sink.c sink.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sat May 17 02:14:48 PDT 2008


Author: lennart
Date: Sat May 17 11:14:47 2008
New Revision: 2457

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2457&root=pulseaudio&view=rev
Log:
link latency of monitor source to sink

Modified:
    trunk/src/pulsecore/sink.c
    trunk/src/pulsecore/sink.h

Modified: trunk/src/pulsecore/sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/sink.c?rev=2457&root=pulseaudio&r1=2456&r2=2457&view=diff
==============================================================================
--- trunk/src/pulsecore/sink.c (original)
+++ trunk/src/pulsecore/sink.c Sat May 17 11:14:47 2008
@@ -247,6 +247,9 @@
         pa_sink_unref(s);
         return NULL;
     }
+
+    s->monitor_source->min_latency = s->min_latency;
+    s->monitor_source->max_latency = s->max_latency;
 
     s->monitor_source->monitor_of = s;
     pa_source_set_max_rewind(s->monitor_source, s->thread_info.max_rewind);
@@ -1228,6 +1231,7 @@
     pa_usec_t result = (pa_usec_t) -1;
     pa_sink_input *i;
     void *state = NULL;
+    pa_usec_t monitor_latency;
 
     pa_sink_assert_ref(s);
 
@@ -1240,6 +1244,12 @@
             (result == (pa_usec_t) -1 || result > i->thread_info.requested_sink_latency))
             result = i->thread_info.requested_sink_latency;
 
+    monitor_latency = pa_source_get_requested_latency_within_thread(s->monitor_source);
+
+    if (monitor_latency != (pa_usec_t) -1 &&
+        (result == (pa_usec_t) -1 || result > monitor_latency))
+        result = monitor_latency;
+
     if (result != (pa_usec_t) -1) {
         if (s->max_latency > 0 && result > s->max_latency)
             result = s->max_latency;
@@ -1300,3 +1310,27 @@
     if (s->update_requested_latency)
         s->update_requested_latency(s);
 }
+
+void pa_sink_set_latency_range(pa_sink *s, pa_usec_t min_latency, pa_usec_t max_latency) {
+    pa_sink_assert_ref(s);
+
+    /* min_latency == 0:           no limit
+     * min_latency == (size_t) -1: default limit
+     * min_latency anything else:  specified limit
+     *
+     * Similar for max_latency */
+
+    if (min_latency == (pa_usec_t) -1)
+        min_latency = DEFAULT_MIN_LATENCY;
+
+    if (max_latency == (pa_usec_t) -1)
+        max_latency = min_latency;
+
+    pa_assert(!min_latency || !max_latency ||
+              min_latency <= max_latency);
+
+    s->min_latency = min_latency;
+    s->max_latency = max_latency;
+
+    pa_source_set_latency_range(s->monitor_source, min_latency, max_latency);
+}

Modified: trunk/src/pulsecore/sink.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/sink.h?rev=2457&root=pulseaudio&r1=2456&r2=2457&view=diff
==============================================================================
--- trunk/src/pulsecore/sink.h (original)
+++ trunk/src/pulsecore/sink.h Sat May 17 11:14:47 2008
@@ -209,6 +209,8 @@
 void pa_sink_set_asyncmsgq(pa_sink *s, pa_asyncmsgq *q);
 void pa_sink_set_rtpoll(pa_sink *s, pa_rtpoll *p);
 
+void pa_sink_set_latency_range(pa_sink *s, pa_usec_t min_latency, pa_usec_t max_latency);
+
 void pa_sink_detach(pa_sink *s);
 void pa_sink_attach(pa_sink *s);
 




More information about the pulseaudio-commits mailing list