2023-08-30 01:50:06 +00:00
# usage:
# - start a DM with a rando via
# - '+' -> 'start conversation'
# - add a user to your roster via
# - '+' -> 'start conversation' -> '+' (opens the "add contact" dialog)
# - this triggers a popup on the remote side asking them for confirmation
# - after the remote's confirmation there will be a local popup for you to allow them to add you to their roster
# - to make a call:
# - ensure the other party is in your roster
# - open a DM with the party
# - click the phone icon at top (only visible if other party is in your roster)
2023-09-21 19:40:12 +00:00
#
# dino can be autostarted on login -- useful to ensure that i always receive calls and notifications --
# but at present it has no "start in tray" type of option: it must render a window.
2023-10-07 00:58:11 +00:00
#
# outstanding bugs:
# - mic is sometimes disabled at call start despite presenting as enabled
# - fix is to toggle it off -> on in the Dino UI
2023-10-07 08:27:35 +00:00
# - default mic gain is WAY TOO MUCH (heavily distorted)
# - TODO: dino should have more optimal niceness/priority to ensure it can process its buffers
2023-10-11 05:40:19 +00:00
# - possibly this is solved by enabling RealtimeKit (rtkit)
# - TODO: see if Dino calls work better with `echo full > /sys/kernel/debug/sched/preempt`
2023-10-07 08:27:35 +00:00
#
# probably fixed:
2023-10-07 00:58:11 +00:00
# - once per 1-2 minutes dino will temporarily drop mic input:
# - `rtp-WRNING: plugin.vala:148: Warning in pipeline: Can't record audio fast enough
# - this was *partially* fixed by bumping the pipewire mic buffer to 2048 samples (from ~512)
2023-10-07 08:27:35 +00:00
# - this was further fixed by setting PULSE_LATENCY_MSEC=20.
# - possibly Dino should be updated internally: `info.rate / 100` -> `info.rate / 50`.
# - i think that affects the batching for echo cancellation, adaptive gain control, etc.
2023-10-07 01:30:45 +00:00
#
2023-09-21 19:40:12 +00:00
{ config , lib , . . . }:
let
cfg = config . sane . programs . dino ;
in
2023-08-28 08:48:35 +00:00
{
2023-09-21 19:40:12 +00:00
sane . programs . dino = {
configOption = with lib ; mkOption {
default = { } ;
type = types . submodule {
options . autostart = mkOption {
type = types . bool ;
default = false ;
} ;
} ;
} ;
persist . private = [ " . l o c a l / s h a r e / d i n o " ] ;
services . dino = {
description = " a u t o - s t a r t a n d m a i n t a i n d i n o X M P P c o n n e c t i o n " ;
wantedBy = lib . mkIf cfg . config . autostart [ " d e f a u l t . t a r g e t " ] ;
serviceConfig = {
ExecStart = " ${ cfg . package } / b i n / d i n o " ;
Type = " s i m p l e " ;
Restart = " a l w a y s " ;
RestartSec = " 2 0 s " ;
} ;
2023-10-07 08:09:50 +00:00
# audio buffering; see: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#pipewire-buffering-explained>
# dino defaults to 10ms mic buffer, which causes underruns, which Dino handles *very* poorly
# as in, the other end of the call will just not receive sound from us for a couple seconds.
# pipewire uses power-of-two buffering for the mic itself. that would put us at 21.33 ms, but this env var supports only whole numbers (21ms ends up not power-of-two).
# also, Dino's likely still doing things in 10ms batches internally anyway.
environment . PULSE_LATENCY_MSEC = " 2 0 " ;
2023-10-07 00:58:11 +00:00
# note that debug logging during calls produces so much journal spam that it pegs the CPU and causes dropped audio
# environment.G_MESSAGES_DEBUG = "all";
2023-09-21 19:40:12 +00:00
} ;
} ;
2023-08-28 08:48:35 +00:00
}