I'm writing RTSP streaming server and I need some help. I think I've tried everything and read topics:
Receiving video stream from an IP camera on android
Playing RTSP stream in VLC player
Android local RTSP server (spoof), PVPlayer closes TCP socket after DESCRIBE reply sent
and other similiar to them. I also read many pdfs and RFCs of course.
My story: I wrote rtsp server and problem appears when I am sending resposponse to DESCRIBE header:
responseHeader.append(HeaderStates.OK);
responseHeader.append(CRLF);
responseHeader.append(CSeq);
responseHeader.append(CRLF);
responseHeader.append("session: ");
responseHeader.append(Long.valueOf(sessionID));
responseHeader.append(CRLF);
Date date = new Date();
responseHeader.append("Date: ");
responseHeader.append(date.toGMTString());
responseHeader.append(CRLF);
responseHeader.append("Content-Type: application/sdp");
responseHeader.append(CRLF);
responseHeader.append("Content-Base: ");
responseHeader.append(localAddress.getHostAddress());
responseHeader.append(":");
responseHeader.append(Integer.valueOf(localPort));
responseHeader.append(CRLF);
responseHeader.append(CRLF);
responseHeader.append("v=0");
responseHeader.append(CRLF);
responseHeader.append("o=- ");
responseHeader.append(date.getTime());
responseHeader.append(" ");
responseHeader.append(date.getTime());
responseHeader.append(" IN IP4 ");
responseHeader.append(localAddress.getHostAddress());
responseHeader.append(CRLF);
responseHeader.append("a=control:rtsp://192.168.1.143:55555");
responseHeader.append(CRLF);
responseHeader.append("s=RTSPSession");
responseHeader.append(CRLF);
responseHeader.append("m=video 55555 RTP/AVP 26");
responseHeader.append(CRLF);
responseHeader.append("a=rtpmap:26 JPEG/90000");
responseHeader.append(CRLF);
responseHeader.append("a=mimetype:video/JPEG");
responseHeader.append(CRLF);
//responseHeader.append("a=control:trackID=1");
responseHeader.append(CRLF);
responseHeader.append(CRLF);
where HeaderStates.OK is "200 OK", SessionID is System.currentTimeMillis(), CRLF = "\r\n" and responseHeader starts with "RTSP/1.0 "
then VLC (client on my PC throws unhadled exception and crashes), SMPlayer reads header and shows it in log but don't response.
Sometimes I get in SMPlayer log that says about error in SDP but I think cause of this error is too long debuging.
My question: What I've done wrong? Why there is no SETUP header from client?