<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Tanu,
<div class="moz-forward-container">
<pre>
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.
</pre>
</div>
</body>
</html>