The issue is plaguing me for days now, and I haven't been able to find solution. Crackling worsens as the video is switched to fullscreen.
My setup overview is: Pulseaudio (custom asoundrc and daemon settings) --> Pulseeffects --> Optical Out --> DAC --> Studio Monitors.
Seemingly, firefox defaults to 48000 hz playback rate in youtube, that could be a contribution in crackling, as I tried same videos in Brave browser, and it runs on 44100 hz (global setting in daemon.conf) and doesn't have any crackling issues in any scenario. Rest of the application do run @ 44100 hz playback rate as well, with no crackling, but somehow, firefox doesn't.
I am not sure if the issue is related to playback rate or something else, but I haven't been able to switch firefox to 44100 hz, and neither fix the crackling sound.