Endoscopy for GSP(4) and the cohomology of siegel modular threefolds