[libvirt PATCH 1/2] conf: add support for timer period audio setting

Daniel P. Berrangé berrange at redhat.com
Thu Jun 3 08:18:42 UTC 2021


Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 docs/formatdomain.rst         | 6 +++++-
 docs/schemas/domaincommon.rng | 5 +++++
 src/conf/domain_conf.c        | 7 +++++++
 src/conf/domain_conf.h        | 2 ++
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index aa7bb8da14..afee69ac97 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -6924,6 +6924,10 @@ to the guest sound device.
 ``id``
    Integer id of the audio device. Must be greater than 0.
 
+``timerPeriod``
+   Timer period in microseconds. Must be greater than 0. If omitted,
+   the lowest possible period is used.
+
 All the backends support child element for configuring input and
 output properties
 
@@ -6931,7 +6935,7 @@ output properties
 
    ...
    <devices>
-     <audio id='1' type='pulseaudio'>
+     <audio id='1' type='pulseaudio' timerPeriod='40'>
        <input mixingEngine='yes' fixedSettings='yes' voices='1' bufferLength='100'>
          <settings frequency='44100' channels='2' format='s16'/>
        </input>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 38f9d3f599..233805cb66 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4774,6 +4774,11 @@
       <attribute name="id">
         <ref name="uint8"/>
       </attribute>
+      <optional>
+        <attribute name="timerPeriod">
+          <ref name="uint32"/>
+        </attribute>
+      </optional>
       <choice>
         <group>
           <attribute name="type">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f424ed731f..7b9de2e92d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13193,6 +13193,10 @@ virDomainAudioDefParseXML(virDomainXMLOption *xmlopt G_GNUC_UNUSED,
                        &def->id) < 0)
         goto error;
 
+    if (virXMLPropUInt(node, "timerPeriod", 10, VIR_XML_PROP_NONZERO,
+                       &def->timerPeriod) < 0)
+        goto error;
+
     inputNode = virXPathNode("./input", ctxt);
     outputNode = virXPathNode("./output", ctxt);
 
@@ -25461,6 +25465,9 @@ virDomainAudioDefFormat(virBuffer *buf,
 
     virBufferAsprintf(buf, "<audio id='%d' type='%s'", def->id, type);
 
+    if (def->timerPeriod)
+        virBufferAsprintf(buf, " timerPeriod='%u'", def->timerPeriod);
+
     switch (def->type) {
     case VIR_DOMAIN_AUDIO_TYPE_NONE:
         break;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 99f18c13bc..f706c498ff 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1559,6 +1559,8 @@ struct _virDomainAudioDef {
 
     unsigned int id;
 
+    unsigned int timerPeriod;
+
     virDomainAudioIOCommon input;
     virDomainAudioIOCommon output;
     union {
-- 
2.31.1




More information about the libvir-list mailing list