Opened 14 years ago
Closed 14 years ago
#8365 closed defect (duplicate)
[BUG FIX] White noise on PulseAudio frontend output
Reported by: | Owned by: | Janne Grunau | |
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | MythTV - Video Playback | Version: | Master Head |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
Problem: When watching LiveTV audio plays for a bit then turns to white noise (like a out-of-tune TV set). Cause: Line 558 of file libs/libmyth/audiooutputpulse.cpp reads as :
fragment_size = (float)sample_rate * 0.020f * // 20msec (float)(audio_bits / 8 * audio_channels);
For whatever reason GCC compiles this and with values sample_rate=48000, audio_bits=16 and audio_channels=2 the computed result is 3839 (should be 3840). The result is not divisible by (audio_bits / 8 * audio_channels) so on buffer resets the audio stream will get 'out of phase', playing white noise instead.
Fix: Change line 558 to :
fragment_size = (sample_rate * 20 * // 20 msec x 1000 (audio_bits / 8) * audio_channels) / 1000; // base on msec ( div 1000 )
Since this is a two-liner and I'm still tracking other issues I didn't write a proper patch. If that's a problem let me know.
This fix apparently also solves the problem of playing just a fraction of a second of audio on LiveTV, then going silent.