SPDIF from TV works fine for cable TV, but motorboats w/ YouTube, Amazon streaming, etc

Has anyone experienced this?  My signal chain is as follows:

Wall cable connection via coaxial cable --> Xfinity cable box via HDMI --> Samsung TV via S/PDIF w/ TosLink connections --> Lyngdorf TDAI 2200 digital int amp --> speakers

I've changed the TV audio settings to output only the digital audio (and disabled the internal TV speakers).  For viewing cable TV, the audio output works fine, but if I switch to something like Amazon Prime streaming video the audio motorboats.  I've tried using the internal TV speakers with the same media and that works fine.  Can anybody help point me the right way?

Don't know if this will solve the problem, but definitely worth looking at.

Digital audio out on TV's will usually have 3 options in the menu, bitstream, PCM, or auto. If it is set to auto, try setting it to PCM. Bitstream is for multichannel and it appears you are 2 channel, so it will likely not work at all. PCM is the correct digital signal for amp's input.

Also consider the quality. The bitrate on youtube and amazon can be very low. Sometimes its way less than 128kbps. If you have a smart TV, transcode a song to MP-3 at different bit rates, and put them on a USB stick. Listen to the song starting with the highest bit rate (start with 192 or 160 kbps. No reason to go any higher that because if this turns out to be your issue, it should be below 128.) As you keep lowering the bit rate, listen for your issue. If you get to a point where your file on the usb stick sounds like youtube or amazon, that's your problem.
Thanks to both of you for your response.  tls49, you win the prize.  My TV was trying to output Dolby DTS.  Setting that to PCM solved the problem.  Thank you very much!