#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
int circular_buffer_size;
AVFifoBuffer *fifo;
int circular_buffer_error;
+#if HAVE_PTHREADS
pthread_t circular_buffer_thread;
+#endif
} UDPContext;
#define UDP_TX_BUF_SIZE 32768
goto fail;
}
- if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
+ if ((s->is_multicast || !s->local_port) && (h->flags & AVIO_FLAG_READ))
s->local_port = port;
udp_fd = udp_socket_create(s, &my_addr, &len);
if (udp_fd < 0)
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);
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);
}