[pulseaudio-discuss] [PATCH 6/8] rtp: Don't release memblock until we stop accessing underlying data

arun at accosted.net arun at accosted.net
Mon Feb 29 10:16:34 UTC 2016


From: Arun Raghavan <git at arunraghavan.net>

---
 src/modules/rtp/rtp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/modules/rtp/rtp.c b/src/modules/rtp/rtp.c
index e372cbd..5a24a03 100644
--- a/src/modules/rtp/rtp.c
+++ b/src/modules/rtp/rtp.c
@@ -256,7 +256,6 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool, uint32_
     m.msg_flags = 0;
 
     r = recvmsg(c->fd, &m, 0);
-    pa_memblock_release(chunk->memblock);
 
     if (r != size) {
         if (r < 0 && errno != EAGAIN && errno != EINTR)
@@ -274,6 +273,8 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool, uint32_
     memcpy(rtp_tstamp, (uint8_t*) iov.iov_base + 4, sizeof(uint32_t));
     memcpy(&ssrc, (uint8_t*) iov.iov_base + 8, sizeof(uint32_t));
 
+    pa_memblock_release(chunk->memblock);
+
     header = ntohl(header);
     *rtp_tstamp = ntohl(*rtp_tstamp);
     ssrc = ntohl(c->ssrc);
-- 
2.5.0



More information about the pulseaudio-discuss mailing list