Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#7496 closed enhancement (fixed)

pulseaudio A/V sync

Reported by: Alan Calvert <cal@…> Owned by: JYA
Priority: minor Milestone: unknown
Component: MythTV - Audio Output Version: head
Severity: low Keywords:
Cc: Ticket locked: no

Description

As requested by danielk (ref #5473), a ticket to focus efforts to improve pulseaudio sync/latency.

Ref <http://pulseaudio.org/wiki/LatencyControl>

So far the approach to buffer setup has been to choose params that seem comfortable for myth, then try to persuade pulseadio to conform. Pulseadio has some wonderful attributes, but "accommodating" is not necessarily one of them. Patch pulse-latency-001.patch goes the other way - try to set pulseaudio latency to what's required, and have myth's fragment_size & soundcard_buffer_size conform to pulseaudio's ultimate choice of buffer metrics.

PA_STREAM_ADJUST_LATENCY has limited utility in myth's quest for "out of the box" performance. It depends on having tsched=1 in the load-module module-alsa-sink params, which according to the above reference "... is the default for most modern distributions, with the infamous exception of Ubuntu" . Since ubuntu is possibly the main reason for even bothering with pulseaudio in myth, that's inconvenient. I've tried this with both tsched=1 and tsched=0, and sync does seem to be a little tighter in both cases. The experience of others would be interesting.

Attachments (1)

pulse-latency-001.patch (3.1 KB) - added by Alan Calvert <cal@…> 10 years ago.
trunk @ 22716

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by Alan Calvert <cal@…>

Attachment: pulse-latency-001.patch added

trunk @ 22716

comment:1 Changed 10 years ago by Colin Guthrie <mythtv@…>

I wouldn't worry too much about tsched=0 on Ubuntu. I've no idea why they've set this as pretty much all the alsa problems have been ironed out now, but even with this in mind, one more release cycle should see Ubuntu towing the line and enabling glitch-free like everyone else (we've been using it for the last six months in Mandriva without any significant problems - although we do provide a GUI to tweak it). As this patch is on trunk and it will be ~6months until 0.23 is out (unless I'm mistaken) I suspect this will be targeting mainly 10.04 of Ubuntu. So hopefully tsched=1 will be on all the distros by then.

comment:2 Changed 10 years ago by robertm

Milestone: 0.23unknown

comment:3 Changed 10 years ago by geoffp@…

I just tried out the new Pulseaudio support in 0.23 trunk on Ubuntu 10.04b. Thanks a lot for making that happen; I have a need to be able to route network audio to my Myth box, and Pulse lets me do that.

And that works great, but the audio latency when using Myth's native Pulseaudio driver is much higher than with ALSA -> Pulseaudio. It's unwatchable, unfortunately.

I wonder why it is that latency isn't an issue when using ALSA -> Pulseaudio, but is when using Pulse's native API...

I don't know if Ubuntu has moved to glitch-free yet, I can't find any reference to tsched in it's Pulse config files.

comment:4 Changed 10 years ago by stuartm

Ticket locked: set

comment:5 Changed 9 years ago by JYA

Resolution: fixed
Status: newclosed
Ticket locked: unset

PulseAudio? support was rewritten and reports so far confirm that A/V sync issues have greatly reduced.

Re-open ticket if you see any more issues

comment:6 Changed 9 years ago by anonymous

Is the new PA driver in the -fixes branch or trunk?

Note: See TracTickets for help on using tickets.