Martin Storsjö <[email protected]> added the comment: The issue as I can see, is that resetup_tcp() undoes the UDP setup, and then fails to set up TCP, leaving some data structures wiped after the ff_rtsp_undo_setup. This call to av_read_frame() returns with a failure code, as it should, but if av_read_frame() is called again, it will try to read a packet, with the UDP setup undone.
However, in my tests, this doesn't crash in udp_read_packet, since udp_read_packet checks rtsp_st->rtp_handle everywhere before using it. rtsp_st->transport_priv is also wiped by ff_rtsp_undo_setup, but I don't really see where it could crash. I think the general issue would be fixed by not trying to read packets at all, if the resetup failed. One crude way of doing that without adding new flags to RTSPState would be e.g. to set rt->nb_byes = rt->nb_rtsp_streams; if the resetup codepath failed - this would block ff_rtsp_fetch_packet from retrying. But I guess a separate flag for this case would be better, e.g. setting rt->initialized = 0; if the resetup failed, and exit early in rtsp_read_packet for that case. ________________________________________________ FFmpeg issue tracker <[email protected]> <https://roundup.ffmpeg.org/issue2612> ________________________________________________
