diff options
Diffstat (limited to 'libavformat/udp.c')
-rw-r--r-- | libavformat/udp.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libavformat/udp.c b/libavformat/udp.c index 021f529d64..78077e6595 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -35,7 +35,11 @@ #include "network.h" #include "os_support.h" #include "url.h" + +#if HAVE_PTHREADS #include <pthread.h> +#endif + #include <sys/time.h> #ifndef IPV6_ADD_MEMBERSHIP @@ -57,9 +61,10 @@ typedef struct { /* Circular Buffer variables for use in UDP receive code */ int circular_buffer_size; AVFifoBuffer *fifo; - int circular_buffer_available_max; int circular_buffer_error; +#if HAVE_PTHREADS pthread_t circular_buffer_thread; +#endif } UDPContext; #define UDP_TX_BUF_SIZE 32768 @@ -509,6 +514,7 @@ static int udp_open(URLContext *h, const char *uri, int flags) s->udp_fd = udp_fd; +#if HAVE_PTHREADS if (!is_output && s->circular_buffer_size) { /* start the task going */ s->fifo = av_fifo_alloc(s->circular_buffer_size); @@ -517,12 +523,13 @@ static int udp_open(URLContext *h, const char *uri, int flags) goto fail; } } +#endif return 0; fail: if (udp_fd >= 0) closesocket(udp_fd); - av_fifo_free(s->fifo); + av_fifo_free(s->fifo); av_free(s); return AVERROR(EIO); } @@ -532,7 +539,6 @@ static int udp_read(URLContext *h, uint8_t *buf, int size) UDPContext *s = h->priv_data; int ret; int avail; - int left; fd_set rfds; struct timeval tv; @@ -597,7 +603,6 @@ static int udp_close(URLContext *h) if (s->is_multicast && !(h->flags & AVIO_WRONLY)) udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr); closesocket(s->udp_fd); - av_log( h, AV_LOG_INFO, "circular_buffer_info max:%d%%\r\n", (s->circular_buffer_available_max*100)/s->circular_buffer_size); av_fifo_free(s->fifo); av_free(s); return 0; |