diff options
author | Martin Storsjö <martin@martin.st> | 2010-03-15 16:36:20 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2010-03-15 16:36:20 +0000 |
commit | ad2ae6dbafe262f8755026e23015488a8b23d7ca (patch) | |
tree | bd5a616430b3612d526186f062092ae6b98ef220 /libavformat/rtspenc.c | |
parent | ec55edba312199245d7b830284b861673d27e999 (diff) | |
download | ffmpeg-ad2ae6dbafe262f8755026e23015488a8b23d7ca.tar.gz |
Don't let ff_rtsp_read_reply skip interleaved RTP/TCP packets in rtsp_write_packet.
Skip interleaved packets manually and recheck if there's more to be read.
Originally committed as revision 22548 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rtspenc.c')
-rw-r--r-- | libavformat/rtspenc.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index 22db85809f..052c5c868b 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -72,20 +72,30 @@ static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt) struct timeval tv; AVFormatContext *rtpctx; AVPacket local_pkt; + int ret; - FD_ZERO(&rfds); tcp_fd = url_get_file_handle(rt->rtsp_hd); - FD_SET(tcp_fd, &rfds); + while (1) { + FD_ZERO(&rfds); + FD_SET(tcp_fd, &rfds); tv.tv_sec = 0; tv.tv_usec = 0; n = select(tcp_fd + 1, &rfds, NULL, NULL, &tv); - if (n > 0) { + if (n <= 0) + break; if (FD_ISSET(tcp_fd, &rfds)) { RTSPMessageHeader reply; - if (ff_rtsp_read_reply(s, &reply, NULL, 0) < 0) + /* Don't let ff_rtsp_read_reply handle interleaved packets, + * since it would block and wait for an RTSP reply on the socket + * (which may not be coming any time soon) if it handles + * interleaved packets internally. */ + ret = ff_rtsp_read_reply(s, &reply, NULL, 1); + if (ret < 0) return AVERROR(EPIPE); + if (ret == 1) + ff_rtsp_skip_packet(s); /* XXX: parse message */ if (rt->state != RTSP_STATE_STREAMING) return AVERROR(EPIPE); |