aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtspenc.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-10-30 19:12:45 +0200
committerMartin Storsjö <martin@martin.st>2013-11-01 09:57:06 +0200
commit50aef03b24d949249b020226dffa3a78077f1056 (patch)
tree99f576b21f7c68ff57ef8d6c717b567306bdc86d /libavformat/rtspenc.c
parent9ceed7af377cea6a430d63a2f5d5cf1afe0d4f05 (diff)
downloadffmpeg-50aef03b24d949249b020226dffa3a78077f1056.tar.gz
rtspenc: Make sure BYE packets are sent before TEARDOWN
Also make sure the BYE packets are sent at all when using TCP interleaved transport. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtspenc.c')
-rw-r--r--libavformat/rtspenc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index d8e5b0e212..8a334ec49b 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -136,7 +136,7 @@ static int rtsp_write_header(AVFormatContext *s)
return 0;
}
-static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
+int ff_rtsp_tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
{
RTSPState *rt = s->priv_data;
AVFormatContext *rtpctx = rtsp_st->transport_priv;
@@ -217,7 +217,7 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt)
* packets, so we need to send them out on the TCP connection separately.
*/
if (!ret && rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP)
- ret = tcp_write_packet(s, rtsp_st);
+ ret = ff_rtsp_tcp_write_packet(s, rtsp_st);
return ret;
}
@@ -225,6 +225,11 @@ static int rtsp_write_close(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
+ // If we want to send RTCP_BYE packets, these are sent by av_write_trailer.
+ // Thus call this on all streams before doing the teardown. This is
+ // done within ff_rtsp_undo_setup.
+ ff_rtsp_undo_setup(s, 1);
+
ff_rtsp_send_cmd_async(s, "TEARDOWN", rt->control_uri, NULL);
ff_rtsp_close_streams(s);