[pulseaudio-discuss] Resampler rewinding

Georg Chini georg at chini.tk
Sun Jun 30 20:24:25 UTC 2019


Hi Tanu,

Here a new picture:

DIAGRAM FOR HARDWARE SINK 1 BEFORE STARTING THE MOVE (OR BEFORE STARTING A REWIND)

+---------------------------------------------------------------------------------+-----
|           client stream memblockq                                               |
+---------------------------------------------------------------------------------+-----
                                                                                   ^ read index
                                                                                  
                                                    +------------------------------+
                                                    | data in the client resampler |
                                                    +------------------------------+

+--------------------------------------------------+
|  client render_memblockq  |     queue length     |
+--------------------------------------------------+
                             ^ read index           ^ write index

+---------------------------+---------------------------------+-------------------+-----
|  client history_queue     | length equal to resampler data  |   queue length    |
+---------------------------+---------------------------------+-------------------+-----
                                                               ^ read index        ^write index
----------------------------+
    |      dma buffer        |
----------------------------+
    ^ hardware playback position,
      can't rewind beyond this point


What you can see in this picture is, that the difference between the render memblockq
read index and the history queue read index will always equal the amount of data in the
resampler, even if that amount is varying. So rewinding the history queue by the same
amount as the render memblockq plus the resampler delay ensures, that after the rewind
the read index of both queues is equal.
The render memblockq plus resampler data and the history queue data are completely
equivalent, just in different sample specs. Read and write index of the history
queue are both ahead of the render queue by the amount of data in the resampler.
The equivalence ensures that an operation done on one queue can be mirrored to the
other queue.

Meanwhile I changed the SOXR resampler to use variable rate. This makes it behave like
all the other resamplers do. Probably I could try your approach again, but I still think
my solution is more elegant than trying to force the queue into the audio flow somehow.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20190630/3c3f3b32/attachment.html>


More information about the pulseaudio-discuss mailing list