udp: fix occasional crash on shutdown
Wait until the thread is down before destroying the fifo Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
54942c2383
commit
f1136b2b10
@ -656,7 +656,6 @@ static int udp_close(URLContext *h)
|
|||||||
if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
|
if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
|
||||||
udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
|
udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
|
||||||
closesocket(s->udp_fd);
|
closesocket(s->udp_fd);
|
||||||
av_fifo_free(s->fifo);
|
|
||||||
#if HAVE_PTHREAD_CANCEL
|
#if HAVE_PTHREAD_CANCEL
|
||||||
if (s->thread_started) {
|
if (s->thread_started) {
|
||||||
pthread_cancel(s->circular_buffer_thread);
|
pthread_cancel(s->circular_buffer_thread);
|
||||||
@ -668,6 +667,7 @@ static int udp_close(URLContext *h)
|
|||||||
pthread_mutex_destroy(&s->mutex);
|
pthread_mutex_destroy(&s->mutex);
|
||||||
pthread_cond_destroy(&s->cond);
|
pthread_cond_destroy(&s->cond);
|
||||||
#endif
|
#endif
|
||||||
|
av_fifo_free(s->fifo);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user