Break delay reading out into a separate function instead of mixing it with the frame decoding.