media: check state
media: check state

Make sure we are in the right state when collecting the position and duration.
Only make ourselves PREPARED when we were previously PREPARING.

Lachann/gst-rtsp-server,barisdemiray/gst-rtsp-server,barisdemiray/gst-rtsp-server,surround-io/gst-rtsp-server,surround-io/gst-rtsp-server,hsteinhaus/gst-rtsp-server,hsteinhaus/gst-rtsp-server,surround-io/gst-rtsp-server,Lachann/gst-rtsp-server,hsteinhaus/gst-rtsp-server,thaytan/gst-rtsp-server,barisdemiray/gst-rtsp-server,thaytan/gst-rtsp-server,thaytan/gst-rtsp-server,Lachann/gst-rtsp-server