irtspparse: doesn't handle multiple frames in a single packet
Hi, I'm trying to dump video stream from PCAP dump of RTSP+RTP over TCP. Here's cmd line:
gst-launch-1.0.exe -v filesrc location=cam_full.pcap ! pcapparse src-ip=xxx src-port=554 dst-ip=xxx dst-port=50056 ! irtspparse channel_id=0 ! application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)99 ! rtph264depay ! h264parse ! mp4mux ! filesink location=a.mp4
And it creates just a trash video. I leave only pcapparse ! irtspparse part and found that it handles frames incorrectly. I'm not familiar with gst code and its internal architecture, but at first glance it looks like gst_irtsp_parse_handle_frame() works in wrong way: it assumes that only one and complete iterleaved frame is possible in one TCP packet. In my TCP dump there's 1 complete + part of another frame in the first payload packet. It should parse frames within current TCP packet, and preserve that parsing state between them.
Also I propose to change the policy of frames detection, now it searches for the 0x24[target channel id] pattern, it doesn't use any knowledge about previous frames. I think it should hold parsing state and use the first 0x24 byte as a start of interleaved frames data. If user pass pcap dump without RTSP handshake data, it's up to him to handle that, and maybe edit pcap so that it starts from a valid frame.