Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#8239 closed defect (fixed)

upconvert audio to 5.1 crashes mythfrontend

Reported by: daniel.armbrust.list@… Owned by: JYA
Priority: major Milestone: unknown
Component: MythTV - Audio Output Version: head
Severity: medium Keywords: audio sound
Cc: Ticket locked: no

Description

My configuration:

My asound.conf file consists of:

pcm.!default {

type plug slave.pcm "spdif"

}

In my Myth frontend, I have:

Audio Output - ALSA:Default Speakers - 5.1

Digital Output Device - ALSA:lec958 {AESO 0x02}

I also have the boxes checked for "Dolby" and "DTS"

If I try to watch a show recorded by an analog tuner (actually, live tv in this log), and I check the box for "upconvert", myth tv crashes like so:

2010-03-28 10:36:42.363 ProgramInfo?(): Updated pathname : -> '2104_20100328103642.mpg' 2010-03-28 10:36:43.789 AFD: Opened codec 0xa89d8d0, id(MPEG2VIDEO) type(Video) 2010-03-28 10:36:43.789 AFD: codec MP2 has 2 channels 2010-03-28 10:36:43.789 AFD: Opened codec 0xa89e5e0, id(MP2) type(Audio) 2010-03-28 10:36:43.845 AO: Using resampler. From: 32000 to 192000 2010-03-28 10:36:43.847 DEnc, Error: Could not open codec, invalid bitrate or samplerate 2010-03-28 10:36:43.847 Opening audio device 'default'. ch 2(2) sr 192000 (reenc 0) 2010-03-28 10:36:43.847 Opening ALSA audio device 'iec958:{ AES0 0x02 }'. 2010-03-28 10:36:43.878 mixer unable to find control Master 1 2010-03-28 10:36:43.890 AO: Using resampler. From: 32000 to 192000 2010-03-28 10:36:43.891 DEnc, Error: Could not open codec, invalid bitrate or samplerate 2010-03-28 10:36:43.891 Opening audio device 'default'. ch 2(2) sr 192000 (reenc 0) 2010-03-28 10:36:43.892 Opening ALSA audio device 'iec958:{ AES0 0x02 }'. 2010-03-28 10:36:43.928 mixer unable to find control Master 1 2010-03-28 10:36:43.946 AO: Using resampler. From: 32000 to 192000 2010-03-28 10:36:43.947 DEnc, Error: Could not open codec, invalid bitrate or samplerate 2010-03-28 10:36:43.947 Opening audio device 'default'. ch 2(2) sr 192000 (reenc 0) 2010-03-28 10:36:43.948 Opening ALSA audio device 'iec958:{ AES0 0x02 }'. 2010-03-28 10:36:43.982 mixer unable to find control Master 1 2010-03-28 10:36:44.035 ProgramInfo?(): Updated pathname : -> '2104_20100328103642.mpg' 2010-03-28 10:36:44.062 VDPAU: Created 2 output surfaces. 2010-03-28 10:36:44.062 VDPAU: Created VDPAU render device 1280x720 2010-03-28 10:36:44.078 NVP(1): Forcing decode extra audio option on (Video method requires it). 2010-03-28 10:36:44.078 FilterManager?: Failed to load filter 'colorspace', no such filter exists 2010-03-28 10:36:44.078 OSD Theme Dimensions W: 1280 H: 720 2010-03-28 10:36:44.097 ProgramInfo?(): Updated pathname : -> '2104_20100328103642.mpg' 2010-03-28 10:36:44.134 Realtime priority would require SUID as root. 2010-03-28 10:36:44.136 ProgramInfo?(): Updated pathname : -> '2104_20100328103642.mpg' 2010-03-28 10:36:44.148 LiveTVChain(live-myth-2010-03-28T10:36:18): SwitchTo?() not switching to current 2010-03-28 10:36:44.152 [mpegvideo_vdpau @ 0x431cc40]warning: first frame is no keyframe 2010-03-28 10:36:44.163 OpenGLVideoSync() 2010-03-28 10:36:44.192 [mpegvideo_vdpau @ 0x431cc40]warning: first frame is no keyframe 2010-03-28 10:36:44.231 Video timing method: SGI OpenGL 2010-03-28 10:36:44.259 VDPAU: Added 2 output surfaces (total 4, max 4) 2010-03-28 10:36:44.623 WriteAudio?: buffer underrun Segmentation fault

FYI - the mixer errors in this log don't seem to matter - I got rid of those by turning off the mixer in the myth configuration, that gets rid of the mixer errors. But myth still crashes if I check the box for upconvert.

If I don't check the box for upconvert, I simply get no sound from an audio stream like this:

2010-03-28 10:36:43.789 AFD: Opened codec 0xa89d8d0, id(MPEG2VIDEO) type(Video) 2010-03-28 10:36:43.789 AFD: codec MP2 has 2 channels 2010-03-28 10:36:43.789 AFD: Opened codec 0xa89e5e0, id(MP2) type(Audio) 2010-03-28 10:36:43.845 AO: Using resampler. From: 32000 to 192000

This used to work fine in myth .22.

Attachments (1)

ac3_48k.diff (1.7 KB) - added by foobum <foobum@…> 14 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 14 years ago by anonymous

Sorry, don't know why the line breaks got eaten above. try again:

2010-03-28 10:36:42.363 ProgramInfo(): Updated pathname '':'' ->'2104_20100328103642.mpg'
2010-03-28 10:36:43.789 AFD: Opened codec 0xa89d8d0, id(MPEG2VIDEO) type(Video)
2010-03-28 10:36:43.789 AFD: codec MP2 has 2 channels
2010-03-28 10:36:43.789 AFD: Opened codec 0xa89e5e0, id(MP2) type(Audio)
2010-03-28 10:36:43.845 AO: Using resampler. From: 32000 to 192000
2010-03-28 10:36:43.847 DEnc, Error: Could not open codec, invalid
bitrate or samplerate
2010-03-28 10:36:43.847 Opening audio device 'default'. ch 2(2) sr
192000 (reenc 0)
2010-03-28 10:36:43.847 Opening ALSA audio device 'iec958:{ AES0 0x02 }'.
2010-03-28 10:36:43.878 mixer unable to find control Master 1
2010-03-28 10:36:43.890 AO: Using resampler. From: 32000 to 192000
2010-03-28 10:36:43.891 DEnc, Error: Could not open codec, invalid
bitrate or samplerate
2010-03-28 10:36:43.891 Opening audio device 'default'. ch 2(2) sr
192000 (reenc 0)
2010-03-28 10:36:43.892 Opening ALSA audio device 'iec958:{ AES0 0x02 }'.
2010-03-28 10:36:43.928 mixer unable to find control Master 1
2010-03-28 10:36:43.946 AO: Using resampler. From: 32000 to 192000
2010-03-28 10:36:43.947 DEnc, Error: Could not open codec, invalid
bitrate or samplerate
2010-03-28 10:36:43.947 Opening audio device 'default'. ch 2(2) sr
192000 (reenc 0)
2010-03-28 10:36:43.948 Opening ALSA audio device 'iec958:{ AES0 0x02 }'.
2010-03-28 10:36:43.982 mixer unable to find control Master 1
2010-03-28 10:36:44.035 ProgramInfo(): Updated pathname '':'' ->
'2104_20100328103642.mpg'
2010-03-28 10:36:44.062 VDPAU: Created 2 output surfaces.
2010-03-28 10:36:44.062 VDPAU: Created VDPAU render device 1280x720
2010-03-28 10:36:44.078 NVP(1): Forcing decode extra audio option on
(Video method requires it).
2010-03-28 10:36:44.078 FilterManager: Failed to load filter
'colorspace', no such filter exists
2010-03-28 10:36:44.078 OSD Theme Dimensions W: 1280 H: 720
2010-03-28 10:36:44.097 ProgramInfo(): Updated pathname '':'' ->
'2104_20100328103642.mpg'
2010-03-28 10:36:44.134 Realtime priority would require SUID as root.
2010-03-28 10:36:44.136 ProgramInfo(): Updated pathname '':'' ->
'2104_20100328103642.mpg'
2010-03-28 10:36:44.148 LiveTVChain(live-myth-2010-03-28T10:36:18):
SwitchTo() not switching to current
2010-03-28 10:36:44.152 [mpegvideo_vdpau @ 0x431cc40]warning: first
frame is no keyframe
2010-03-28 10:36:44.163 OpenGLVideoSync()
2010-03-28 10:36:44.192 [mpegvideo_vdpau @ 0x431cc40]warning: first
frame is no keyframe
2010-03-28 10:36:44.231 Video timing method: SGI OpenGL
2010-03-28 10:36:44.259 VDPAU: Added 2 output surfaces (total 4, max 4)
2010-03-28 10:36:44.623 WriteAudio: buffer underrun
Segmentation fault

comment:2 Changed 14 years ago by JYA

Status: newinfoneeded_new

Please provide a backtrace...

Looks like a bug in ALSA: it reports 192kHz available for your SPDIF connection, when the maximum those supports are 48kHz

comment:3 Changed 14 years ago by anonymous

192 Khz via S/PDIF is a valid sampling rate, just not necessarily supported by all sound cards/receivers. $8 Khz is only the most commonly supported sample rate, not the max.

http://forums.m-audio.com/showthread.php?6252-Can-M-Audio-Audiophile-192-s-pdif-output-24bit-192khz http://www.hardwarebook.info/S/PDIF

Specifically, "IEC 60958-3 specifies up to 768 kHz sampling frequency."

Changed 14 years ago by foobum <foobum@…>

Attachment: ac3_48k.diff added

comment:4 Changed 14 years ago by foobum <foobum@…>

It's AC-3 that only supports <= 48k. Attached (untested) patch should fix. A backtrace would still be useful - it's not immediately clear why we get SEGV if initialisation of the AC3 encoder fails.

comment:5 Changed 14 years ago by daniel.armbrust.list@…

Is this what you need?

https://bugs.launchpad.net/mythbuntu/+bug/550562

If not, I'll need guidance.

Thanks.

comment:6 Changed 14 years ago by superm1@…

When we forward bugs upstream we try to link directly to the backtraces. These traces should hopefully be good: http://launchpadlibrarian.net/42324643/Stacktrace.txt http://launchpadlibrarian.net/42324644/ThreadStacktrace.txt

comment:7 Changed 14 years ago by sphery

Status: infoneeded_newnew

From a quick glance at the backtrace, it looks like AudioOutputBase::SetAudiotime?() calls AudioOutputALSA::GetBufferedOnSoundcard?(), which checks to make sure pcm_handle != NULL, but it seems like some other thread changes pcm_handle to NULL before the call to snd_pcm_delay(pcm_handle, &delay); (line 402), where the crash occurs. In [22432], AudioOutputALSA::GetSupportedRates?() was added and has 2 sections where pcm_handle is set to NULL if there's a failure (re?)opening the device (which may be happening when it tries to open the device at 192kHz?). Perhaps it needs some locking?

comment:8 Changed 14 years ago by foobum <foobum@…>

Nah. The crash occurs in snd_pcm_state(), which gets given a non-NULL but recently trashed pcm_handle. The samplerate should be ok (at least ALSA has told us it is). I guess pcm_handle gets trashed as a result of us giving ALSA 6 channels worth of samples when it's expecting 2. The previously attached patch should fix it.

comment:9 Changed 14 years ago by JYA

Resolution: fixed
Status: newclosed

(In [23844]) Fixed #8239. There were two issues here. 1- If the audio being played had a sample rate of more than 48kHz and the hardware supported it, we wouldn't resample the audio when the AC3 encoder was active. The maximum bitrate supported by AC3 is 48kHz. 2- If for some reasons, the AC3 encoder couldn't be created (like in the case mentioned above) ; we still tried to use it later in the playback code. Fix by "foo bar"

comment:10 Changed 14 years ago by robertm

(In [23848]) Backport r23844 to .23-fixes, refs #8239, needed before an rc2.

comment:11 Changed 14 years ago by daniel.armbrust.list@…

Finally upgraded today. Confirmed fix.

No more crash when I select upconvert, and I get sound, as expected. Receiver reports 5.1 channel stream.

Still have silence when I don't select upconvert - should I be getting stereo in this case? Or is silence expected?

comment:12 Changed 14 years ago by JYA

Can you provide sample and post it somewhere ?

Just the first 50MB is enough

Note: See TracTickets for help on using tickets.