[PATCH] avoid fake rewind in corked state

xingchao xingchao.wang at intel.com
Tue Jun 21 09:13:14 PDT 2011


sink_input_request_rewind() do nothing if in corked state. there's rewind
request need in pa_sink_input_set_state_within_thread(), so mark CORKING
state
after rewinding.
---
 src/pulsecore/sink-input.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index f4f3258..02099ce 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -1755,7 +1755,6 @@ void
pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_input_state
     if (i->state_change)
         i->state_change(i, state);

-    i->thread_info.state = state;

     if (corking) {

@@ -1764,9 +1763,11 @@ void
pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_input_state
         /* 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);
+     i->thread_info.state = state;

     } else if (uncorking) {

+     i->thread_info.state = state;
         i->thread_info.underrun_for = (uint64_t) -1;
         i->thread_info.playing_for = 0;

-- 
1.7.1


--xingchao

2011/6/21 xing wang <wangxingchao2011 at gmail.com>

> Hi ,
>
> Request to rewind due to corking will do nothing because of sink-input's
> threadinfo state changed to "PA_SINK_INPUT_CORKED". So the patch mark new
> state after finished the rewinding. For uncorking, it's right to set
> "PA_SINK_INPUT_RUNNING" state before the rewind happened.
>
> --xingchao
>

--bcaec5015dd585a0a104a9b9f25d
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Hi,</div><div><br></div>Does anyone has comment on this patch?<div><br=
></div><div><div>From 3406e4e6e0ae5146d6214e73c352d2bc670decba Mon Sep 17 0=
0:00:00 2001</div><div>From: xingchao &lt;<a href=3D"mailto:xingchao.wang at i=
ntel.com">xingchao.wang at intel.com</a>&gt;</div>
<div>Date: Tue, 21 Jun 2011 12:13:14 -0400</div><div>Subject: [PATCH] avoid=
 fake rewind in corked state</div><div><br></div><div>sink_input_request_re=
wind() do nothing if in corked state. there&#39;s rewind</div><div>request =
need in pa_sink_input_set_state_within_thread(), so mark CORKING state</div=
>
<div>after rewinding.</div><div>---</div><div>=A0src/pulsecore/sink-input.c=
 | =A0 =A03 ++-</div><div>=A01 files changed, 2 insertions(+), 1 deletions(=
-)</div><div><br></div><div>diff --git a/src/pulsecore/sink-input.c b/src/p=
ulsecore/sink-input.c</div>
<div>index f4f3258..02099ce 100644</div><div>--- a/src/pulsecore/sink-input=
.c</div><div>+++ b/src/pulsecore/sink-input.c</div><div>@@ -1755,7 +1755,6 =
@@ void pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_inp=
ut_state</div>
<div>=A0=A0 =A0 if (i-&gt;state_change)</div><div>=A0=A0 =A0 =A0 =A0 i-&gt;=
state_change(i, state);</div><div>=A0</div><div>- =A0 =A0i-&gt;thread_info.=
state =3D state;</div><div>=A0</div><div>=A0=A0 =A0 if (corking) {</div><di=
v>=A0</div><div>@@ -1764,9 +1763,11 @@ void pa_sink_input_set_state_within_=
thread(pa_sink_input *i, pa_sink_input_state</div>
<div>=A0=A0 =A0 =A0 =A0 /* This will tell the implementing sink input drive=
r to rewind</div><div>=A0=A0 =A0 =A0 =A0 =A0* so that the unplayed already =
mixed data is not lost */</div><div>=A0=A0 =A0 =A0 =A0 pa_sink_input_reques=
t_rewind(i, 0, TRUE, TRUE, FALSE);</div>
<div>+ =A0 =A0<span class=3D"Apple-tab-span" style=3D"white-space:pre">	</s=
pan>i-&gt;thread_info.state =3D state;</div><div>=A0</div><div>=A0=A0 =A0 }=
 else if (uncorking) {</div><div>=A0</div><div>+ =A0 =A0<span class=3D"Appl=
e-tab-span" style=3D"white-space:pre">	</span>i-&gt;thread_info.state =3D s=
tate;</div>
<div>=A0=A0 =A0 =A0 =A0 i-&gt;thread_info.underrun_for =3D (uint64_t) -1;</=
div><div>=A0=A0 =A0 =A0 =A0 i-&gt;thread_info.playing_for =3D 0;</div><div>=
=A0</div><div>--=A0</div><div>1.7.1</div></div><div><br></div><div><br></di=
v><div>--xingchao<br><br>
<div class=3D"gmail_quote">2011/6/21 xing wang <span dir=3D"ltr">&lt;<a hre=
f=3D"mailto:wangxingchao2011 at gmail.com">wangxingchao2011 at gmail.com</a>&gt;<=
/span><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bord=
er-left:1px #ccc solid;padding-left:1ex;">
Hi ,=A0<div><br></div><div>Request to rewind due to corking will do nothing=
 because of sink-input&#39;s threadinfo state changed to &quot;PA_SINK_INPU=
T_CORKED&quot;. So the patch mark new state after finished the rewinding. F=
or uncorking, it&#39;s right to set &quot;PA_SINK_INPUT_RUNNING&quot; state=
 before the rewind happened.</div>

<div><br></div><div>--xingchao</div>
</blockquote></div><br></div>

--bcaec5015dd585a0a104a9b9f25d--


More information about the pulseaudio-discuss mailing list