Opened 10 years ago

Closed 10 years ago

#8365 closed defect (duplicate)

[BUG FIX] White noise on PulseAudio frontend output

Reported by: Carlos Azevedo <geral@…> Owned by: Janne Grunau
Priority: minor Milestone: unknown
Component: MythTV - Video Playback Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no


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.

Change History (2)

comment:1 Changed 10 years ago by Carlos Azevedo <geral@…>

This fix apparently also solves the problem of playing just a fraction of a second of audio on LiveTV, then going silent.

comment:2 Changed 10 years ago by robertm

Resolution: duplicate
Status: newclosed

Dupe of #8237.

Note: See TracTickets for help on using tickets.