Opened 8 years ago

Closed 8 years ago

#10086 closed Bug Report - General (Works for me)

2->6 channel upmix results in buffer underruns

Reported by: jpoet Owned by: JYA
Priority: minor Milestone: unknown
Component: MythTV - Audio Output Version: Unspecified
Severity: medium Keywords: audio upmixer underrun
Cc: Ticket locked: no

Description

Watching a show with DD2.0 and timestretch enabled results in a log full of

AudioOutputBase audio/audiooutputalsa.cpp:546 (WriteAudio) - ALSA: WriteAudio: buffer underrun

Shows with native DD5.1 do not have this problem.

Turning off the 2.0 -> 5.1 upmixer fixes the problem.

I am guessing the problem is with the ALSA parameters being chosen, but I don't know what needs tweaked.

With a 2.0 -> 5.1 upmixer enabled, I see

CoreContext audio/audiooutputbase.cpp:744 (Reconfigure) - AO: Opening audio device 'hdmi:CARD=NVidia,DEV=3' ch 6(2) sr 48000 sf signed 32 bit reenc 1
CoreContext audio/audiooutputalsa.cpp:139 (TryOpenDevice) - ALSA: OpenDevice hdmi:CARD=NVidia,DEV=3
CoreContext audio/audiooutputalsa.cpp:634 (SetParameters) - ALSA: SetParameters(format=10, channels=6, rate=48000, buffer_time=500000, period_time=4)
CoreContext audio/audiooutputalsa.cpp:692 (SetParameters) - ALSA: Buffer size range from 32 to 1398096
CoreContext audio/audiooutputalsa.cpp:695 (SetParameters) - ALSA: Period size range from 16 to 699040
CoreContext audio/audiooutputalsa.cpp:712 (SetParameters) - ALSA: Buffer time = 500000 us
CoreContext audio/audiooutputalsa.cpp:718 (SetParameters) - ALSA: Period time = 4 periods
CoreContext audio/audiooutputalsa.cpp:727 (SetParameters) - ALSA: Buffer size = 24000 | Period size = 6000
CoreContext audio/audiooutputbase.cpp:761 (Reconfigure) - AO: Audio fragment size: 72000

With 2.0 audio, but the upmixer disabled, I see:

CoreContext audio/audiooutputbase.cpp:744 (Reconfigure) - AO: Opening audio device 'hdmi:CARD=NVidia,DEV=3' ch 2(2) sr 48000 sf signed 16 bit reenc 1
CoreContext audio/audiooutputalsa.cpp:139 (TryOpenDevice) - ALSA: OpenDevice hdmi:CARD=NVidia,DEV=3
CoreContext audio/audiooutputalsa.cpp:634 (SetParameters) - ALSA: SetParameters(format=2, channels=2, rate=48000, buffer_time=500000, period_time=4)
CoreContext audio/audiooutputalsa.cpp:692 (SetParameters) - ALSA: Buffer size range from 64 to 8388608
CoreContext audio/audiooutputalsa.cpp:695 (SetParameters) - ALSA: Period size range from 32 to 4194304
CoreContext audio/audiooutputalsa.cpp:712 (SetParameters) - ALSA: Buffer time = 500000 us
CoreContext audio/audiooutputalsa.cpp:718 (SetParameters) - ALSA: Period time = 5 periods
CoreContext audio/audiooutputalsa.cpp:727 (SetParameters) - ALSA: Buffer size = 24000 | Period size = 4800
CoreContext audio/audiooutputbase.cpp:761 (Reconfigure) - AO: Audio fragment size: 9600

With native DD5.1, I see:

CoreContext audio/audiooutputbase.cpp:744 (Reconfigure) - AO: Opening audio device 'hdmi:CARD=NVidia,DEV=3' ch 6(6) sr 48000 sf signed 16 bit reenc 1
CoreContext audio/audiooutputalsa.cpp:139 (TryOpenDevice) - ALSA: OpenDevice hdmi:CARD=NVidia,DEV=3
CoreContext audio/audiooutputalsa.cpp:634 (SetParameters) - ALSA: SetParameters(format=2, channels=6, rate=48000, buffer_time=500000, period_time=4)
CoreContext audio/audiooutputalsa.cpp:692 (SetParameters) - ALSA: Buffer size range from 64 to 2796192
CoreContext audio/audiooutputalsa.cpp:695 (SetParameters) - ALSA: Period size range from 32 to 1398080
CoreContext audio/audiooutputalsa.cpp:712 (SetParameters) - ALSA: Buffer time = 500000 us
CoreContext audio/audiooutputalsa.cpp:718 (SetParameters) - ALSA: Period time = 5 periods
CoreContext audio/audiooutputalsa.cpp:727 (SetParameters) - ALSA: Buffer size = 24000 | Period size = 4800
CoreContext audio/audiooutputbase.cpp:761 (Reconfigure) - AO: Audio fragment size: 28800

Another thing I noticed -- When the upmixer is turned off, or the show is native DD5.1, it looks like timestretch is invoking a "Reconfigure", which I don't see when upmix is enabled.

I am attaching three logs -- one with upmixer enabled, another with it disabled, and one for a native DD5.1 show.

Attachments (6)

mythfrontend-upmix.log (23.1 KB) - added by jpoet 8 years ago.
upmix enabled
mythfrontend-no-upmix.log (26.7 KB) - added by jpoet 8 years ago.
upmix disabled
mythfrontend-dd51.log (23.1 KB) - added by jpoet 8 years ago.
DD5.1
mythfrontend-upmix.2.log (23.6 KB) - added by jpoet 8 years ago.
upmix log from version 263c05a5f98af117ef04cce326e17e3563709776
outputupmix-ts.log (4.6 KB) - added by JYA 8 years ago.
output.log (8.3 KB) - added by JYA 8 years ago.

Download all attachments as: .zip

Change History (10)

Changed 8 years ago by jpoet

Attachment: mythfrontend-upmix.log added

upmix enabled

Changed 8 years ago by jpoet

Attachment: mythfrontend-no-upmix.log added

upmix disabled

Changed 8 years ago by jpoet

Attachment: mythfrontend-dd51.log added

DD5.1

Changed 8 years ago by jpoet

Attachment: mythfrontend-upmix.2.log added

Changed 8 years ago by JYA

Attachment: outputupmix-ts.log added

comment:1 Changed 8 years ago by JYA

I just can't reproduce the problem. I too have a GT430, 1920x1080 video with stereo AC3 can be upmixed + time stretch without problem.

I find it very surprising some of the reports by your cards in terms of the memory available (it's like 10 times mine for audio buffer size, (I use 4MB alsa hardware audio buffer size))

Your card reports that it supports channels 1,2,3,4,5,6,7,8 when hdmi doesn't support any odd number of channels.

It looks to be an issue with your config somehow, and I just can't reproduce it

comment:2 Changed 8 years ago by JYA

Ok, I have the same alsa output when I use 32MB (the maximum) for the hardware buffer... still no issue however

Changed 8 years ago by JYA

Attachment: output.log added

comment:3 Changed 8 years ago by JYA

This is the output playing file 2269_20110910180000.mpg.

Note how AC3 is for me detected as 2 channels, and immediately after as 6 channels (so it does passthrough). Activating timestretch and it goes back to being 2 channels audio. Something is wrong in AVD determining the number of audio channels of the stream. The file plays fine for me however, though without timestretch, as it's seen as 6 channels AC3 by default upmixing isn't active.

I have noticed once that it keeps pausing/resuming audio. Pause/Resume? is sent from AVFD/MythPlayer, someone needs to check why those are happening. Nothing to do with the audio framework.

comment:4 Changed 8 years ago by JYA

Resolution: Works for me
Status: newclosed
Note: See TracTickets for help on using tickets.