[pulseaudio-discuss] What's the purpose of "rewind" on corking and uncorking?

Colin Guthrie gmane at colin.guthr.ie
Tue Jun 14 09:42:15 PDT 2011


'Twas brillig, and Lin, Mengdong at 14/06/11 16:33 did gyre and gimble:
> Many thanks for the information!
> 
>> When corking, we want that the audio in the stream buffer will be "taken
>> away" from the sink buffer, but we still want to keep the data in the
>> stream buffer. When uncorking, the sink should take back the same stream
>> data that was originally taken away from it.
>>
> 
> But it seems on corking, no data will be "taken away" from the sink buffer. Here is the code:
> 
> void pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_input_state_t state) {
> 	...
>     i->thread_info.state = state;   ---> so the sink input's thread_info.state changed to PA_SINK_INPUT_CORKED. So pa_sink_input_request_rewind() will do nothing. 
> 
>     if (corking) {
> 
>         pa_log_debug("Requesting rewind due to corking");
> 
>         /* This will tell the implementing sink input driver to rewind
>          * so that the unplayed already mixed data is not lost */
>         pa_sink_input_request_rewind(i, 0, TRUE, TRUE, FALSE);
> 
>     }
> 
> void pa_sink_input_request_rewind(
>         pa_sink_input *i,
>         size_t nbytes  /* in our sample spec */,
>         pa_bool_t rewrite,
>         pa_bool_t flush,
>         pa_bool_t dont_rewind_render) {
> ...
>     /* We don't take rewind requests while we are corked */
>     if (i->thread_info.state == PA_SINK_INPUT_CORKED)
>         return; 
> 
> ...
> 
> If I misunderstand something, please correct me.


Hmm, it looks like you are right. I suspect things were shuffled around
at some stage and broke this (or maybe it was always broken?).

Either way it looks like a bug on my very brief look through your examples.

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]



More information about the pulseaudio-discuss mailing list