Dolby Digital in XBMC

Hope someone can help.  If I turn Dolby Digital on in the native ATV2 settings, I can get Dolby Digital out of my receiver via optical.  However, when playing the same movie in XBMC, it stutters.  The video is very choppy.  If I turn Dolby Digital back to Auto in the ATV2 settings, Movie plays fine in XBMC (but no 5.1 to receiver, only stereo), but Apple TV won’t play the video at all.