summaryrefslogtreecommitdiffstats
path: root/meta-pipewire/recipes-multimedia/pipewire/pipewire/0006-gst-pwaudiosink-set-the-default-latency-time-buffer-.patch
blob: 1f56b1c4c42009c27081cf1442b31a829084c56e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 30622ed39774d3a2d3133effbc73caac5fb12596 Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Thu, 11 Jul 2019 17:07:15 +0300
Subject: [PATCH] gst/pwaudiosink: set the default latency time (buffer size)
 to be 21.3ms

This is to solve underrun issues that seem to appear with the default
10ms latency that GstBaseAudioSink has.
Hopefully in the future we will have a better mechanism to pick
the appropriate latency instead of hardcoding it here.

Upstream-Status: Submitted [https://github.com/PipeWire/pipewire/pull/140]
---
 src/gst/gstpwaudiosink.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gst/gstpwaudiosink.c b/src/gst/gstpwaudiosink.c
index 6cb71385..069996c3 100644
--- a/src/gst/gstpwaudiosink.c
+++ b/src/gst/gstpwaudiosink.c
@@ -57,6 +57,13 @@ static void
 gst_pw_audio_sink_init (GstPwAudioSink * self)
 {
   self->props.fd = -1;
+
+  /* Bump the default buffer size up to 21.3 ms, which is the default on most
+   * sound cards, in hope to match the alsa buffer size on the pipewire server.
+   * This may not always happen, but it still sounds better than the 10ms
+   * default latency. This is temporary until we have a better mechanism to
+   * select the appropriate latency */
+  GST_AUDIO_BASE_SINK (self)->latency_time = 21333;
 }
 
 static void
-- 
2.23.0