Skip to content
  • Igor Kovalenko's avatar
    memblockq: Adjust tail chunk offset into memblock after split · 06ccfbb9
    Igor Kovalenko authored and PulseAudio Marge Bot's avatar PulseAudio Marge Bot committed
    If pa_memblockq_push needs to write into the middle of a chunk, target chunk
    is split into head and tail sharing the same memblock. Size of head and
    tail chunks is adjusted correctly, head chunk pointer into memblock remains
    unchanged from target chunk.
    
    The problem is with tail chunk offset into memblock which should be advanced
    past write region of memblock, but currently it is left as 0.
    
    This is causing an issue where seeking a few frames back into the middle of
    memblock and writing a frame there ends up with tail chunk referencing frames
    from very beginning of memblock causing corrupted output from memblockq.
    
    Fix this by adjusting tail chunk offset into memblock past write region and
    add a test case.
    
    Fixes #3789
    
    Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/798>
    06ccfbb9