[pulseaudio-discuss] [PATCH 3/4] core: no rewinding on volume change if the sink does not support it.

Colin Guthrie gmane at colin.guthr.ie
Fri Apr 8 08:16:44 PDT 2011


'Twas brillig, and oku at iki.fi at 08/04/11 15:18 did gyre and gimble:
> From: Jyri Sarha <jyri.sarha at nokia.com>
> 
> No volume is applied to a stream before pa_sink_render or some
> it's siblings is called. Because of this there is no use to
> rewind on volume change if the sink does not support it. It is
> just a waste of CPU.
> ---
>  src/pulsecore/sink-input.c |    6 ++++--
>  src/pulsecore/sink.c       |    3 ++-
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
> index 46f26f9..28d083d 100644
> --- a/src/pulsecore/sink-input.c
> +++ b/src/pulsecore/sink-input.c
> @@ -1648,14 +1648,16 @@ int pa_sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int64_t
>          case PA_SINK_INPUT_MESSAGE_SET_SOFT_VOLUME:
>              if (!pa_cvolume_equal(&i->thread_info.soft_volume, &i->soft_volume)) {
>                  i->thread_info.soft_volume = i->soft_volume;
> -                pa_sink_input_request_rewind(i, 0, TRUE, FALSE, FALSE);
> +                if (i->sink && i->sink->thread_info.max_rewind > 0)
> +                    pa_sink_input_request_rewind(i, 0, TRUE, FALSE, FALSE);
>              }
>              return 0;
>  
>          case PA_SINK_INPUT_MESSAGE_SET_SOFT_MUTE:
>              if (i->thread_info.muted != i->muted) {
>                  i->thread_info.muted = i->muted;
> -                pa_sink_input_request_rewind(i, 0, TRUE, FALSE, FALSE);
> +                if (i->sink && i->sink->thread_info.max_rewind > 0)
> +                    pa_sink_input_request_rewind(i, 0, TRUE, FALSE, FALSE);
>              }
>              return 0;
>  
> diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
> index 839b7d4..ebe4c7b 100644
> --- a/src/pulsecore/sink.c
> +++ b/src/pulsecore/sink.c
> @@ -2060,7 +2060,8 @@ static void sync_input_volumes_within_thread(pa_sink *s) {
>              continue;
>  
>          i->thread_info.soft_volume = i->soft_volume;
> -        pa_sink_input_request_rewind(i, 0, TRUE, FALSE, FALSE);
> +        if (s->thread_info.max_rewind > 0)
> +            pa_sink_input_request_rewind(i, 0, TRUE, FALSE, FALSE);
>      }
>  }
>  

Would it not be possible to move this check into the function itself and
just make it a noop?

I appreciate there would be FCO but it would reduce the likelihood of
this check being missed on some other calls... unless that is desirable
sometimes?

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