]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/udp.c
Move AVStream->codec_info_nb_frames increment after try_decode_frame
[ffmpeg] / libavformat / udp.c
index 3037a04fa04f0dbfd4e7caa6330495f331b49e1d..6bd5c9c395b9488260b2c9b57d702e613fa9fb99 100644 (file)
  */
 
 /**
- * @file libavformat/udp.c
+ * @file
  * UDP protocol
  */
 
 #define _BSD_SOURCE     /* Needed for using struct ip_mreq with recent glibc */
 #include "avformat.h"
 #include <unistd.h>
+#include "internal.h"
 #include "network.h"
 #include "os_support.h"
 #if HAVE_SYS_SELECT_H
@@ -255,7 +256,7 @@ static int udp_port(struct sockaddr_storage *addr, int addr_len)
  *         'pkt_size=n'  : set max packet size
  *         'reuse=1'     : enable reusing the socket
  *
- * @param s1 media file context
+ * @param h media file context
  * @param uri of the remote server
  * @return zero if no error.
  */
@@ -265,7 +266,7 @@ int udp_set_remote_url(URLContext *h, const char *uri)
     char hostname[256];
     int port;
 
-    ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
+    av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
 
     /* set the destination address */
     s->dest_addr_len = udp_set_url(&s->dest_addr, hostname, port);
@@ -278,8 +279,8 @@ int udp_set_remote_url(URLContext *h, const char *uri)
 }
 
 /**
- * Return the local port used by the UDP connexion
- * @param s1 media file context
+ * Return the local port used by the UDP connection
+ * @param h media file context
  * @return the local port number
  */
 int udp_get_local_port(URLContext *h)
@@ -346,9 +347,9 @@ static int udp_open(URLContext *h, const char *uri, int flags)
     }
 
     /* fill the dest addr */
-    ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
+    av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
 
-    /* XXX: fix ff_url_split */
+    /* XXX: fix av_url_split */
     if (hostname[0] == '\0' || hostname[0] == '?') {
         /* only accepts null hostname if input */
         if (flags & URL_WRONLY)
@@ -436,8 +437,11 @@ static int udp_read(URLContext *h, uint8_t *buf, int size)
         tv.tv_sec = 0;
         tv.tv_usec = 100 * 1000;
         ret = select(s->udp_fd + 1, &rfds, NULL, NULL, &tv);
-        if (ret < 0)
+        if (ret < 0) {
+            if (ff_neterrno() == FF_NETERROR(EINTR))
+                continue;
             return AVERROR(EIO);
+        }
         if (!(ret > 0 && FD_ISSET(s->udp_fd, &rfds)))
             continue;
         len = recv(s->udp_fd, buf, size, 0);
@@ -452,7 +456,7 @@ static int udp_read(URLContext *h, uint8_t *buf, int size)
     return len;
 }
 
-static int udp_write(URLContext *h, uint8_t *buf, int size)
+static int udp_write(URLContext *h, const uint8_t *buf, int size)
 {
     UDPContext *s = h->priv_data;
     int ret;