[FFmpeg-cvslog] avformat/rtsp: reuse POLLING_TIME and remove POLL_TIMEOUT_MS

Limin Wang git at videolan.org
Thu Oct 22 17:21:19 EEST 2020


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Sat Oct 10 21:50:08 2020 +0800| [784ce1c294cefdba25ee4eaf98f625de442e1682] | committer: Limin Wang

avformat/rtsp: reuse POLLING_TIME and remove POLL_TIMEOUT_MS

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=784ce1c294cefdba25ee4eaf98f625de442e1682
---

 libavformat/rtsp.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 4ecd702780..49c2d52375 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -51,9 +51,7 @@
 #include "rtpenc.h"
 #include "mpegts.h"
 
-/* Timeout values for socket poll, in ms,
- * and read_packet(), in seconds  */
-#define POLL_TIMEOUT_MS 100
+/* Default timeout values for read packet in seconds  */
 #define READ_PACKET_TIMEOUT_S 10
 #define SDP_MAX_SIZE 16384
 #define RECVBUF_SIZE 10 * RTP_MAX_PACKET_LENGTH
@@ -1990,7 +1988,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
     int n, i, ret;
     struct pollfd *p = rt->p;
     int *fds = NULL, fdsnum, fdsidx;
-    int runs = rt->initial_timeout * 1000LL / POLL_TIMEOUT_MS;
+    int runs = rt->initial_timeout * 1000LL / POLLING_TIME;
 
     if (!p) {
         p = rt->p = av_malloc_array(2 * rt->nb_rtsp_streams + 1, sizeof(struct pollfd));
@@ -2028,7 +2026,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
             return AVERROR_EXIT;
         if (wait_end && wait_end - av_gettime_relative() < 0)
             return AVERROR(EAGAIN);
-        n = poll(p, rt->max_p, POLL_TIMEOUT_MS);
+        n = poll(p, rt->max_p, POLLING_TIME);
         if (n > 0) {
             int j = rt->rtsp_hd ? 1 : 0;
             for (i = 0; i < rt->nb_rtsp_streams; i++) {



More information about the ffmpeg-cvslog mailing list