mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-08 06:09:50 +00:00
rtsp: punch holes again after pause
When a client behind a NAT issues a pause command, and stay paused for a long time, the router may stop the RTP/RTCP port redirection. Resend the hole punching packets before each PLAY command to cause the router to restart the port redirection in that case. Move the existing code for sending the packets from the SETUP phase to the PLAY phase. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
parent
061c489895
commit
cdcc370293
2 changed files with 12 additions and 7 deletions
|
|
@ -504,6 +504,18 @@ static int rtsp_read_play(AVFormatContext *s)
|
|||
av_log(s, AV_LOG_DEBUG, "hello state=%d\n", rt->state);
|
||||
rt->nb_byes = 0;
|
||||
|
||||
if (rt->lower_transport == RTSP_LOWER_TRANSPORT_UDP) {
|
||||
for (i = 0; i < rt->nb_rtsp_streams; i++) {
|
||||
RTSPStream *rtsp_st = rt->rtsp_streams[i];
|
||||
/* Try to initialize the connection state in a
|
||||
* potential NAT router by sending dummy packets.
|
||||
* RTP/RTCP dummy packets are used for RDT, too.
|
||||
*/
|
||||
if (rtsp_st->rtp_handle &&
|
||||
!(rt->server_type == RTSP_SERVER_WMS && i > 1))
|
||||
ff_rtp_send_punch_packets(rtsp_st->rtp_handle);
|
||||
}
|
||||
}
|
||||
if (!(rt->server_type == RTSP_SERVER_REAL && rt->need_subscription)) {
|
||||
if (rt->transport == RTSP_TRANSPORT_RTP) {
|
||||
for (i = 0; i < rt->nb_rtsp_streams; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue