问题
I tried streaming on Google nexus S (2.3.7), HTC Desire (2.3.3), and Samsung Galaxy (3.2). And only Google Nexus has RTSP session timeout issue.
I read up on some threads about this problem. It seems like I'll have to send RTCP request every second to keep the session alive, or I'll just send RTSP "OPTION" request which will basically do nothing but keep alive for my app. Could anyone give me a head start on how to generate that request? I have no experience dealing with RTCP before.
回答1:
There are two ways to keep your RTSP connection alive.
Use RTCP protocol, it should send a package within seconds.
Use RTSP "OPTION" request, send this request every 50-60 seconds to keep alive.
I suggest you read some source code of RTSP library, such as "libnemesi"(implemented by C), it gives a good example for your problem.
https://github.com/syhou/Libnemesi-reborn
来源:https://stackoverflow.com/questions/9880998/how-to-keep-rtsp-session-alive