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

Tanu Kaskinen tanuk at iki.fi
Tue Apr 19 11:15:32 UTC 2016


On Mon, 2016-02-29 at 15:46 +0530, arun at accosted.net wrote:
> 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);

Looks good!

-- 
Tanu


More information about the pulseaudio-discuss mailing list