[vlc-commits] udp: fix locking (fixes #14234) and cancellation
Rémi Denis-Courmont
git at videolan.org
Mon Mar 23 22:32:28 CET 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Mar 23 23:31:53 2015 +0200| [d02407312bd0aee571e9d37f8b2bd0b1e40a4a86] | committer: Rémi Denis-Courmont
udp: fix locking (fixes #14234) and cancellation
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d02407312bd0aee571e9d37f8b2bd0b1e40a4a86
---
modules/access/udp.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/modules/access/udp.c b/modules/access/udp.c
index 0a23317..429c6df 100644
--- a/modules/access/udp.c
+++ b/modules/access/udp.c
@@ -258,9 +258,6 @@ static void* ThreadRead( void *data )
access_t *access = data;
access_sys_t *sys = access->p_sys;
- vlc_fifo_Lock(sys->fifo);
- vlc_fifo_CleanupPush(sys->fifo);
-
for(;;)
{
block_t *pkt = block_Alloc(MTU);
@@ -283,16 +280,21 @@ static void* ThreadRead( void *data )
pkt->i_buffer = len;
+ vlc_fifo_Lock(sys->fifo);
/* Discard old buffers on overflow */
while (vlc_fifo_GetBytes(sys->fifo) + len > sys->fifo_size)
+ {
+ int canc = vlc_savecancel();
block_Release(vlc_fifo_DequeueUnlocked(sys->fifo));
+ vlc_restorecancel(canc);
+ }
vlc_fifo_QueueUnlocked(sys->fifo, pkt);
+ vlc_fifo_Unlock(sys->fifo);
}
sys->running = false;
vlc_fifo_Signal(sys->fifo);
- vlc_cleanup_run();
return NULL;
}
More information about the vlc-commits
mailing list