Re: pulseaudio 0.9.15 for F10?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Roberto Ragusa wrote:
> After applying this patch, mplayer does not get stuck, it is just the usual
> latency/skips/underruns...

Wrongly pasted the patch. Corrected one follows:

diff -urN pulseaudio-0.9.14/src/pulsecore/memblockq.c pulseaudio-0.9.14-fix440/src/pulsecore/memblockq.c
--- pulseaudio-0.9.14/src/pulsecore/memblockq.c 2009-01-13 00:10:34.000000000 +0100
+++ pulseaudio-0.9.14-fix440/src/pulsecore/memblockq.c  2009-08-08 18:42:28.000000000 +0200
@@ -90,8 +90,8 @@

     pa_memblockq_set_maxlength(bq, maxlength);
     pa_memblockq_set_tlength(bq, tlength);
-    pa_memblockq_set_prebuf(bq, prebuf);
     pa_memblockq_set_minreq(bq, minreq);
+    pa_memblockq_set_prebuf(bq, prebuf);
     pa_memblockq_set_maxrewind(bq, maxrewind);

     pa_log_debug("memblockq sanitized: maxlength=%lu, tlength=%lu, base=%lu, prebuf=%lu, minreq=%lu maxrewind=%lu",
@@ -782,16 +782,13 @@

     if (bq->tlength > bq->maxlength)
         pa_memblockq_set_tlength(bq, bq->maxlength);
-
-    if (bq->prebuf > bq->maxlength)
-        pa_memblockq_set_prebuf(bq, bq->maxlength);
 }

 void pa_memblockq_set_tlength(pa_memblockq *bq, size_t tlength) {
     size_t old_tlength;
     pa_assert(bq);

-    if (tlength <= 0)
+    if (tlength <= 0 || tlength == (size_t) -1)
         tlength = bq->maxlength;

     old_tlength = bq->tlength;
@@ -800,49 +797,46 @@
     if (bq->tlength > bq->maxlength)
         bq->tlength = bq->maxlength;

-    if (bq->prebuf > bq->tlength)
-        pa_memblockq_set_prebuf(bq, bq->tlength);
-
     if (bq->minreq > bq->tlength)
         pa_memblockq_set_minreq(bq, bq->tlength);

+    if (bq->prebuf > bq->tlength+bq->base-bq->minreq)
+        pa_memblockq_set_prebuf(bq, bq->tlength+bq->base-bq->minreq);
+
     bq->missing += (int64_t) bq->tlength - (int64_t) old_tlength;
 }

+void pa_memblockq_set_minreq(pa_memblockq *bq, size_t minreq) {
+    pa_assert(bq);
+
+    bq->minreq = (minreq/bq->base)*bq->base;
+
+    if (bq->minreq > bq->tlength)
+        bq->minreq = bq->tlength;
+
+    if (bq->minreq < bq->base)
+        bq->minreq = bq->base;
+
+    if (bq->prebuf > bq->tlength+bq->base-bq->minreq)
+        pa_memblockq_set_prebuf(bq, bq->tlength+bq->base-bq->minreq);
+}
+
 void pa_memblockq_set_prebuf(pa_memblockq *bq, size_t prebuf) {
     pa_assert(bq);

     if (prebuf == (size_t) -1)
-        prebuf = bq->tlength;
+        prebuf = bq->tlength+bq->base-bq->minreq;

     bq->prebuf = ((prebuf+bq->base-1)/bq->base)*bq->base;

     if (prebuf > 0 && bq->prebuf < bq->base)
         bq->prebuf = bq->base;

-    if (bq->prebuf > bq->tlength)
-        bq->prebuf = bq->tlength;
+    if (bq->prebuf > bq->tlength+bq->base-bq->minreq)
+        bq->prebuf = bq->tlength+bq->base-bq->minreq;

     if (bq->prebuf <= 0 || pa_memblockq_get_length(bq) >= bq->prebuf)
         bq->in_prebuf = FALSE;
-
-    if (bq->minreq > bq->prebuf)
-        pa_memblockq_set_minreq(bq, bq->prebuf);
-}
-
-void pa_memblockq_set_minreq(pa_memblockq *bq, size_t minreq) {
-    pa_assert(bq);
-
-    bq->minreq = (minreq/bq->base)*bq->base;
-
-    if (bq->minreq > bq->tlength)
-        bq->minreq = bq->tlength;
-
-    if (bq->minreq > bq->prebuf)
-        bq->minreq = bq->prebuf;
-
-    if (bq->minreq < bq->base)
-        bq->minreq = bq->base;
 }

 void pa_memblockq_set_maxrewind(pa_memblockq *bq, size_t maxrewind) {
diff -urN pulseaudio-0.9.14/src/pulsecore/protocol-native.c pulseaudio-0.9.14-fix440/src/pulsecore/protocol-native.c
--- pulseaudio-0.9.14/src/pulsecore/protocol-native.c   2009-01-13 00:11:38.000000000 +0100
+++ pulseaudio-0.9.14-fix440/src/pulsecore/protocol-native.c    2009-08-08 18:46:34.000000000 +0200
@@ -797,7 +797,7 @@
         uint32_t* prebuf,
         uint32_t* minreq) {

-    size_t frame_size;
+    size_t frame_size, max_prebuf;
     pa_usec_t orig_tlength_usec, tlength_usec, orig_minreq_usec, minreq_usec, sink_usec;

     pa_assert(s);
@@ -923,8 +923,10 @@
     if (*tlength <= *minreq)
         *tlength = *minreq*2 + (uint32_t) frame_size;

-    if (*prebuf == (uint32_t) -1 || *prebuf > *tlength)
-        *prebuf = *tlength;
+    max_prebuf = *tlength + (uint32_t) frame_size - *minreq;
+    if (*prebuf == (uint32_t) -1 ||
+        *prebuf > max_prebuf)
+        *prebuf = max_prebuf;
 }

 static void fix_playback_buffer_attr_post(


-- 
   Roberto Ragusa    mail at robertoragusa.it

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux