[FFmpeg-cvslog] avformat/udp: Close the socket after destroying the thread using the socket

Michael Niedermayer git at videolan.org
Wed May 25 01:50:47 CEST 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed May 25 00:59:18 2016 +0200| [9591ca704b0e64af5f52471349f800043ec81199] | committer: Michael Niedermayer

avformat/udp: Close the socket after destroying the thread using the socket

for send() this cannot work and even for recv() it feels very wrong and hackish

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/udp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index 58e7498..648efc2 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -1109,7 +1109,6 @@ static int udp_close(URLContext *h)
 
     if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
         udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr,(struct sockaddr *)&s->local_addr_storage);
-    closesocket(s->udp_fd);
 #if HAVE_PTHREAD_CANCEL
     if (s->thread_started) {
         int ret;
@@ -1123,6 +1122,7 @@ static int udp_close(URLContext *h)
         pthread_cond_destroy(&s->cond);
     }
 #endif
+    closesocket(s->udp_fd);
     av_fifo_freep(&s->fifo);
     return 0;
 }



More information about the ffmpeg-cvslog mailing list