MythTV Backend fails to record audio, due to PulseAudio

Bug #633452 reported by Brian Rogers
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
mythtv (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: mythtv

I have my MythTV backend set up to record audio directly from an ALSA device provided by my capture card. Most attempts to record produce the following errors in mythbackend.log:

2010-09-08 11:42:36.208 AudioInALSA(tuner) Error: pcm open failed: Device or resource busy
2010-09-08 11:42:36.401 NVR(/dev/tuner/video) Error: Failed to open audio device ALSA:tuner
2010-09-08 11:42:36.459 NVR(/dev/tuner/video) Error: Failed to init audio input device

I have determined that this is due pulse's support for re-routing ALSA access to the pulseaudio daemon. This behavior doesn't make much sense for the MythTV backend, since pulseaudio is a user-level daemon by default and mythbackend is system-wide and should work even when no users are logged in. Therefore it's best to bypass pulseaudio in mythbackend. The environment variable PULSE_INTERNAL can do that.

If mythbackend is started with PULSE_INTERNAL=1 in its environment, the problem goes away and it records sound successfully every time.

What I'm doing right now is I edited /etc/init/mythtv-backend.conf and replaced
  exec /usr/bin/mythbackend --logfile /var/log/mythtv/mythbackend.log --user mythtv
with
  script
      PULSE_INTERNAL=1 exec /usr/bin/mythbackend --logfile /var/log/mythtv/mythbackend.log --user mythtv
  end script

Revision history for this message
nZain (patrick-stalph) wrote :

bless you! Although I don't really understand what's going on here, I can confirm the problem and the workaround.

You're my hero! I was running MythTV on Ubuntu 10.4 with OSS for 2 years, but did not get the beast to work with ALSA until right now.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in mythtv (Ubuntu):
status: New → Confirmed
Revision history for this message
nZain (patrick-stalph) wrote :

Forgot to mention, my capture card is an SAA7134 based Hauppauge WinTV 1110, which finally works on Ubuntu 12.4 without OSS (/dev/dsp) for sound.

Revision history for this message
David M. (n36078) wrote :

I can confirm that the bug still exists. Late May download of 12.04 and install of MythTV from packages. Card was CA0106 but problem also happened with internal sound card and usb X-Fi. Symptom was no sound on recordings and bad parameter message in mythbackend.log.

Adding PULSE_INTERNAL=1 to startup script fixed it.

Revision history for this message
Cliff (vzmith) wrote :

I'm still running 2:0.27.0+fixes.20140324 (installed in a hardware upgrade 2 years ago) and the backend audio input just suddenly started recording hiss for no reason after working for 2 years. Arecord and aplay still worked fine though. I put PULSE_INTERNAL=1 in the environment in the systemd .service page for the backend and the problem went away.

THANKS!!! :)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.