(Thanks for forwarding to the right mailing list; I sent to player-dev subconsciously.)

Committed to 150Cay.

I'll merge this and the following old commit to HEAD and 310Atlas after testing them.
http://lists.helixcommunity.org/pipermail/audio-dev/2006-October/000775.html

--
Daniel Yek.



Greg Wright wrote:
Looks good.
Also make the change to HEAD and 310Atlas.

--greg.


Daniel Yek wrote:

Modified by: [EMAIL PROTECTED]
Date: 5/7/2008
Project: Helix Player
Bug: https://bugs.helixcommunity.org/show_bug.cgi?id=7375&link=0

Synopsis: Fix playback problem when PulseAudio is enabled.

Overview:
On Fedora 8, if all PulseAudio packages (x86_64 and i586) are installed
(caused conflicts with a few configuration files) and PulseAudio
enabled, the player crashed with the following error on playing back
a clip:
 pcm_params.c:2351: sndrv_pcm_hw_params: Assertion `err >= 0' failed.

The above error message is the side effect of a bad control flow caused
by the change of return value of snd_pcm_hw_params_any().

We used to get 0 as success from snd_pcm_hw_params_any(),
but in this case (with PulseAudio replacing dmix), we are getting 1
causing wrong control flow in Helix audio device code.
That in turn resulted in garbage values, such as
period = 4,156,004,404 usec, being passed to snd_pcm_hw_params(),
which then asserted.

The fix is to reset the error variable to 0 as long as it is not
negative (error) so that the rest of blocks that check for the error
variable being 0 are executed.

Details:
audio/device/platform/unix/audlinux_alsa.cpp:
 CAudioOutLinuxAlsa::_SetDeviceConfig()
 {
   ...
   err = snd_pcm_hw_params_any();
   // err = 1, not 0 as expected by the code.
   // So, garbage is passed to the following function.

   snd_pcm_hw_params();
 }

alsa-lib-1.0.15/src/pcm/pcm.c:
 snd_pcm_hw_params_any()
 {
   ...
   return snd_pcm_hw_refine();
 }

alsa-lib-1.0.15/src/pcm/pcm.c:
 snd_pcm_hw_refine()
 {
   ...
   res = pcm->ops->hw_refine(pcm->op_arg, params);
   return res;
 }

pcm->ops->hw_refine() appears to map to snd_ext_parm_mask_refine().

alsa-lib-1.0.15/src/pcm/pcm_extplug.c:
 snd_ext_parm_mask_refine()
 {
   ...
   return snd_mask_refine();
 }

alsa-lib-1.0.15/src/pcm/mask_inline.h:
 snd_mask_refine()
 {
   ...
   // This appears to be the return value of snd_pcm_hw_params_any().
   return !snd_mask_eq(mask, &old);
 }



Files Modified:
audio/device/platform/unix/audlinux_alsa.cpp

Image Size and Heap Use impact (Client -Only):
None.

Platforms and Profiles Affected:
Linux

Distribution Libraries Affected:
None.

Distribution library impact and planned action:
None.

Platforms and Profiles Build Verified:
Profile: helix_client_all_define
Platform: Fedora

Platforms and Profiles Functionality verified:
Profile: helix_client_all_define
Platform: Fedora

Branch: 150Cay

Copyright assignment: I am a RealNetworks employee.


------------------------------------------------------------------------

_______________________________________________
Player-dev mailing list
[EMAIL PROTECTED]
http://lists.helixcommunity.org/mailman/listinfo/player-dev


_______________________________________________
Audio-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/audio-dev

Reply via email to