Re: [pulseaudio-discuss] [PATCH v2] pipe-source: suspend source when no writers connected to fifo

2018-02-14 Thread Raman Shishniou


On 02/13/2018 06:41 PM, Georg Chini wrote:
> On 13.02.2018 11:27, Raman Shishniou wrote:
>> On 02/13/2018 11:58 AM, Georg Chini wrote:
>>> On 12.02.2018 17:23, Tanu Kaskinen wrote:
 On Sat, 2018-02-10 at 23:08 +0100, Georg Chini wrote:
> On 10.02.2018 23:04, Raman Shishniou wrote:
>> On 02/11/2018 12:43 AM, Georg Chini wrote:
>>> On 10.02.2018 22:25, Raman Shuishniou wrote:
 10.02.2018 23:59, Georg Chini пишет:
> On 08.02.2018 17:58, Raman Shyshniou wrote:
>> Make pipe-source suspended if all writers closed fifo.
>> Source will be automatically unsuspended if any data will
>> be written to pipe and suspended again when last writer
>> closed fifo.
>> ---
>>  src/modules/module-pipe-source.c | 114 
>> +--
>>  1 file changed, 109 insertions(+), 5 deletions(-)
>>
> What is the motivation/use case for the patch? Normally, if there
> are no writers, the source should deliver silence like any other
> source without input signal.
 pipe-source module can't generate silence if no writers connected
 because it has no clock. Aactually incoming data has some clock, but
 not pipe-source itself. Use the system clock to generate silence
 is a bad idea because it may differ from incoming data clock.
>>> Take a look at the recent patches for pipe-sink that introduced using
>>> system-clock timing. I guess something similar should be possible
>>> for the pipe-source. Why would it be a problem, if the timing of the
>>> silence is slightly different from that of the writer? Different writers
>>> may have different timing anyway, so if one writer disconnects
>>> and another connects, timing may change.
>>> module-loopback is able to deal with sample rate changes on the
>>> input side and will adapt the sample rate of the output side so that
>>> it matches the incoming rate to keep a constant latency.
>>>
>> I seen the last patches for pipe-sink module. I think there is no
>> reason to generate silence in pipe-source module with system clock.
>> The source outputs will do read zeros (resample, convert) - just a
>> waste of cpu time.
>> 
> I see your point. The reason for generating silence would
> be to have consistent behavior for all sources. I'll ask Tanu
> for his opinion.
 My opinion: it would be nice to generate silence by default if someone
 is willing to implement that, but suspending is better than the current
 behaviour, if the current behaviour is to have the source state as
 RUNNING while not producing any data.

>>> Raman, are you willing to implement generating silence? This
>>> could also cover the case where a writer stays connected but
>>> does not provide any data.
>>>
>>> If not, I will proceed reviewing your patch.
>>>
>> Ok. I'll implement silence generator, but I want to leave an autosuspend 
>> option.
>>
> Fine for me to keep the autosuspend option. I guess the "silence generator"
> will then be another patch on top of this patch?
> 

No. I make a new patch with both silence generator and autosuspend options.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] pipe-source: suspend source when no writers connected to fifo

2018-02-13 Thread Georg Chini

On 13.02.2018 11:27, Raman Shishniou wrote:

On 02/13/2018 11:58 AM, Georg Chini wrote:

On 12.02.2018 17:23, Tanu Kaskinen wrote:

On Sat, 2018-02-10 at 23:08 +0100, Georg Chini wrote:

On 10.02.2018 23:04, Raman Shishniou wrote:

On 02/11/2018 12:43 AM, Georg Chini wrote:

On 10.02.2018 22:25, Raman Shuishniou wrote:

10.02.2018 23:59, Georg Chini пишет:

On 08.02.2018 17:58, Raman Shyshniou wrote:

Make pipe-source suspended if all writers closed fifo.
Source will be automatically unsuspended if any data will
be written to pipe and suspended again when last writer
closed fifo.
---
 src/modules/module-pipe-source.c | 114 
+--
 1 file changed, 109 insertions(+), 5 deletions(-)


What is the motivation/use case for the patch? Normally, if there
are no writers, the source should deliver silence like any other
source without input signal.

pipe-source module can't generate silence if no writers connected
because it has no clock. Aactually incoming data has some clock, but
not pipe-source itself. Use the system clock to generate silence
is a bad idea because it may differ from incoming data clock.

Take a look at the recent patches for pipe-sink that introduced using
system-clock timing. I guess something similar should be possible
for the pipe-source. Why would it be a problem, if the timing of the
silence is slightly different from that of the writer? Different writers
may have different timing anyway, so if one writer disconnects
and another connects, timing may change.
module-loopback is able to deal with sample rate changes on the
input side and will adapt the sample rate of the output side so that
it matches the incoming rate to keep a constant latency.


I seen the last patches for pipe-sink module. I think there is no
reason to generate silence in pipe-source module with system clock.
The source outputs will do read zeros (resample, convert) - just a
waste of cpu time.


I see your point. The reason for generating silence would
be to have consistent behavior for all sources. I'll ask Tanu
for his opinion.

My opinion: it would be nice to generate silence by default if someone
is willing to implement that, but suspending is better than the current
behaviour, if the current behaviour is to have the source state as
RUNNING while not producing any data.


Raman, are you willing to implement generating silence? This
could also cover the case where a writer stays connected but
does not provide any data.

If not, I will proceed reviewing your patch.


Ok. I'll implement silence generator, but I want to leave an autosuspend option.


Fine for me to keep the autosuspend option. I guess the "silence generator"
will then be another patch on top of this patch?

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] pipe-source: suspend source when no writers connected to fifo

2018-02-13 Thread Raman Shishniou
On 02/13/2018 11:58 AM, Georg Chini wrote:
> On 12.02.2018 17:23, Tanu Kaskinen wrote:
>> On Sat, 2018-02-10 at 23:08 +0100, Georg Chini wrote:
>>> On 10.02.2018 23:04, Raman Shishniou wrote:
 On 02/11/2018 12:43 AM, Georg Chini wrote:
> On 10.02.2018 22:25, Raman Shuishniou wrote:
>> 10.02.2018 23:59, Georg Chini пишет:
>>> On 08.02.2018 17:58, Raman Shyshniou wrote:
Make pipe-source suspended if all writers closed fifo.
Source will be automatically unsuspended if any data will
be written to pipe and suspended again when last writer
closed fifo.
 ---
 src/modules/module-pipe-source.c | 114 
 +--
 1 file changed, 109 insertions(+), 5 deletions(-)

>>> What is the motivation/use case for the patch? Normally, if there
>>> are no writers, the source should deliver silence like any other
>>> source without input signal.
>> pipe-source module can't generate silence if no writers connected
>> because it has no clock. Aactually incoming data has some clock, but
>> not pipe-source itself. Use the system clock to generate silence
>> is a bad idea because it may differ from incoming data clock.
> Take a look at the recent patches for pipe-sink that introduced using
> system-clock timing. I guess something similar should be possible
> for the pipe-source. Why would it be a problem, if the timing of the
> silence is slightly different from that of the writer? Different writers
> may have different timing anyway, so if one writer disconnects
> and another connects, timing may change.
> module-loopback is able to deal with sample rate changes on the
> input side and will adapt the sample rate of the output side so that
> it matches the incoming rate to keep a constant latency.
>
 I seen the last patches for pipe-sink module. I think there is no
 reason to generate silence in pipe-source module with system clock.
 The source outputs will do read zeros (resample, convert) - just a
 waste of cpu time.

>>> I see your point. The reason for generating silence would
>>> be to have consistent behavior for all sources. I'll ask Tanu
>>> for his opinion.
>> My opinion: it would be nice to generate silence by default if someone
>> is willing to implement that, but suspending is better than the current
>> behaviour, if the current behaviour is to have the source state as
>> RUNNING while not producing any data.
>>
> Raman, are you willing to implement generating silence? This
> could also cover the case where a writer stays connected but
> does not provide any data.
> 
> If not, I will proceed reviewing your patch.
> 

Ok. I'll implement silence generator, but I want to leave an autosuspend option.

-- 
Raman
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] pipe-source: suspend source when no writers connected to fifo

2018-02-13 Thread Georg Chini

On 12.02.2018 17:23, Tanu Kaskinen wrote:

On Sat, 2018-02-10 at 23:08 +0100, Georg Chini wrote:

On 10.02.2018 23:04, Raman Shishniou wrote:

On 02/11/2018 12:43 AM, Georg Chini wrote:

On 10.02.2018 22:25, Raman Shuishniou wrote:

10.02.2018 23:59, Georg Chini пишет:

On 08.02.2018 17:58, Raman Shyshniou wrote:

   Make pipe-source suspended if all writers closed fifo.
   Source will be automatically unsuspended if any data will
   be written to pipe and suspended again when last writer
   closed fifo.
---
src/modules/module-pipe-source.c | 114 
+--
1 file changed, 109 insertions(+), 5 deletions(-)


What is the motivation/use case for the patch? Normally, if there
are no writers, the source should deliver silence like any other
source without input signal.

pipe-source module can't generate silence if no writers connected
because it has no clock. Aactually incoming data has some clock, but
not pipe-source itself. Use the system clock to generate silence
is a bad idea because it may differ from incoming data clock.

Take a look at the recent patches for pipe-sink that introduced using
system-clock timing. I guess something similar should be possible
for the pipe-source. Why would it be a problem, if the timing of the
silence is slightly different from that of the writer? Different writers
may have different timing anyway, so if one writer disconnects
and another connects, timing may change.
module-loopback is able to deal with sample rate changes on the
input side and will adapt the sample rate of the output side so that
it matches the incoming rate to keep a constant latency.


I seen the last patches for pipe-sink module. I think there is no
reason to generate silence in pipe-source module with system clock.
The source outputs will do read zeros (resample, convert) - just a
waste of cpu time.
   

I see your point. The reason for generating silence would
be to have consistent behavior for all sources. I'll ask Tanu
for his opinion.

My opinion: it would be nice to generate silence by default if someone
is willing to implement that, but suspending is better than the current
behaviour, if the current behaviour is to have the source state as
RUNNING while not producing any data.


Raman, are you willing to implement generating silence? This
could also cover the case where a writer stays connected but
does not provide any data.

If not, I will proceed reviewing your patch.

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] pipe-source: suspend source when no writers connected to fifo

2018-02-12 Thread Tanu Kaskinen
On Sat, 2018-02-10 at 23:08 +0100, Georg Chini wrote:
> On 10.02.2018 23:04, Raman Shishniou wrote:
> > On 02/11/2018 12:43 AM, Georg Chini wrote:
> > > On 10.02.2018 22:25, Raman Shuishniou wrote:
> > > > 10.02.2018 23:59, Georg Chini пишет:
> > > > > On 08.02.2018 17:58, Raman Shyshniou wrote:
> > > > > >   Make pipe-source suspended if all writers closed fifo.
> > > > > >   Source will be automatically unsuspended if any data will
> > > > > >   be written to pipe and suspended again when last writer
> > > > > >   closed fifo.
> > > > > > ---
> > > > > >src/modules/module-pipe-source.c | 114 
> > > > > > +--
> > > > > >1 file changed, 109 insertions(+), 5 deletions(-)
> > > > > > 
> > > > > 
> > > > > What is the motivation/use case for the patch? Normally, if there
> > > > > are no writers, the source should deliver silence like any other
> > > > > source without input signal.
> > > > 
> > > > pipe-source module can't generate silence if no writers connected
> > > > because it has no clock. Aactually incoming data has some clock, but
> > > > not pipe-source itself. Use the system clock to generate silence
> > > > is a bad idea because it may differ from incoming data clock.
> > > 
> > > Take a look at the recent patches for pipe-sink that introduced using
> > > system-clock timing. I guess something similar should be possible
> > > for the pipe-source. Why would it be a problem, if the timing of the
> > > silence is slightly different from that of the writer? Different writers
> > > may have different timing anyway, so if one writer disconnects
> > > and another connects, timing may change.
> > > module-loopback is able to deal with sample rate changes on the
> > > input side and will adapt the sample rate of the output side so that
> > > it matches the incoming rate to keep a constant latency.
> > > 
> > 
> > I seen the last patches for pipe-sink module. I think there is no
> > reason to generate silence in pipe-source module with system clock.
> > The source outputs will do read zeros (resample, convert) - just a
> > waste of cpu time.
> >   
> 
> I see your point. The reason for generating silence would
> be to have consistent behavior for all sources. I'll ask Tanu
> for his opinion.

My opinion: it would be nice to generate silence by default if someone
is willing to implement that, but suspending is better than the current
behaviour, if the current behaviour is to have the source state as
RUNNING while not producing any data.

-- 
Tanu

https://liberapay.com/tanuk
https://www.patreon.com/tanuk
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] pipe-source: suspend source when no writers connected to fifo

2018-02-10 Thread Georg Chini

On 10.02.2018 23:04, Raman Shishniou wrote:

On 02/11/2018 12:43 AM, Georg Chini wrote:

On 10.02.2018 22:25, Raman Shuishniou wrote:

10.02.2018 23:59, Georg Chini пишет:

On 08.02.2018 17:58, Raman Shyshniou wrote:

  Make pipe-source suspended if all writers closed fifo.
  Source will be automatically unsuspended if any data will
  be written to pipe and suspended again when last writer
  closed fifo.
---
   src/modules/module-pipe-source.c | 114 
+--
   1 file changed, 109 insertions(+), 5 deletions(-)


What is the motivation/use case for the patch? Normally, if there
are no writers, the source should deliver silence like any other
source without input signal.

pipe-source module can't generate silence if no writers connected
because it has no clock. Aactually incoming data has some clock, but
not pipe-source itself. Use the system clock to generate silence
is a bad idea because it may differ from incoming data clock.

Take a look at the recent patches for pipe-sink that introduced using
system-clock timing. I guess something similar should be possible
for the pipe-source. Why would it be a problem, if the timing of the
silence is slightly different from that of the writer? Different writers
may have different timing anyway, so if one writer disconnects
and another connects, timing may change.
module-loopback is able to deal with sample rate changes on the
input side and will adapt the sample rate of the output side so that
it matches the incoming rate to keep a constant latency.


I seen the last patches for pipe-sink module. I think there is no
reason to generate silence in pipe-source module with system clock.
The source outputs will do read zeros (resample, convert) - just a
waste of cpu time.
  

I see your point. The reason for generating silence would
be to have consistent behavior for all sources. I'll ask Tanu
for his opinion.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] pipe-source: suspend source when no writers connected to fifo

2018-02-10 Thread Raman Shishniou
On 02/11/2018 12:43 AM, Georg Chini wrote:
> On 10.02.2018 22:25, Raman Shuishniou wrote:
>> 10.02.2018 23:59, Georg Chini пишет:
>>> On 08.02.2018 17:58, Raman Shyshniou wrote:
  Make pipe-source suspended if all writers closed fifo.
  Source will be automatically unsuspended if any data will
  be written to pipe and suspended again when last writer
  closed fifo.
 ---
   src/modules/module-pipe-source.c | 114 
 +--
   1 file changed, 109 insertions(+), 5 deletions(-)

>>> What is the motivation/use case for the patch? Normally, if there
>>> are no writers, the source should deliver silence like any other
>>> source without input signal.
>>
>> pipe-source module can't generate silence if no writers connected
>> because it has no clock. Aactually incoming data has some clock, but
>> not pipe-source itself. Use the system clock to generate silence
>> is a bad idea because it may differ from incoming data clock.
> 
> Take a look at the recent patches for pipe-sink that introduced using
> system-clock timing. I guess something similar should be possible
> for the pipe-source. Why would it be a problem, if the timing of the
> silence is slightly different from that of the writer? Different writers
> may have different timing anyway, so if one writer disconnects
> and another connects, timing may change.
> module-loopback is able to deal with sample rate changes on the
> input side and will adapt the sample rate of the output side so that
> it matches the incoming rate to keep a constant latency.
>

I seen the last patches for pipe-sink module. I think there is no
reason to generate silence in pipe-source module with system clock.
The source outputs will do read zeros (resample, convert) - just a
waste of cpu time.
 
>>
>> For example the loopback module connected to pipe-source without
>> writers just spams messages like this:
>> [alsa-sink-USB Audio] module-loopback.c: Could not peek into queue
>>
>> I can make autosuspend behaviour optional.
> Making it optional is a good idea in any case.

I'll make a v3 version with option to enable autosuspend behaviour
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] pipe-source: suspend source when no writers connected to fifo

2018-02-10 Thread Georg Chini

On 10.02.2018 22:25, Raman Shuishniou wrote:

10.02.2018 23:59, Georg Chini пишет:

On 08.02.2018 17:58, Raman Shyshniou wrote:

 Make pipe-source suspended if all writers closed fifo.
 Source will be automatically unsuspended if any data will
 be written to pipe and suspended again when last writer
 closed fifo.
---
  src/modules/module-pipe-source.c | 114 
+--

  1 file changed, 109 insertions(+), 5 deletions(-)


What is the motivation/use case for the patch? Normally, if there
are no writers, the source should deliver silence like any other
source without input signal.


pipe-source module can't generate silence if no writers connected
because it has no clock. Aactually incoming data has some clock, but
not pipe-source itself. Use the system clock to generate silence
is a bad idea because it may differ from incoming data clock.


Take a look at the recent patches for pipe-sink that introduced using
system-clock timing. I guess something similar should be possible
for the pipe-source. Why would it be a problem, if the timing of the
silence is slightly different from that of the writer? Different writers
may have different timing anyway, so if one writer disconnects
and another connects, timing may change.
module-loopback is able to deal with sample rate changes on the
input side and will adapt the sample rate of the output side so that
it matches the incoming rate to keep a constant latency.



For example the loopback module connected to pipe-source without
writers just spams messages like this:
[alsa-sink-USB Audio] module-loopback.c: Could not peek into queue

I can make autosuspend behaviour optional.

Making it optional is a good idea in any case.
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] pipe-source: suspend source when no writers connected to fifo

2018-02-10 Thread Raman Shuishniou

10.02.2018 23:59, Georg Chini пишет:

On 08.02.2018 17:58, Raman Shyshniou wrote:

 Make pipe-source suspended if all writers closed fifo.
 Source will be automatically unsuspended if any data will
 be written to pipe and suspended again when last writer
 closed fifo.
---
  src/modules/module-pipe-source.c | 114 
+--

  1 file changed, 109 insertions(+), 5 deletions(-)


What is the motivation/use case for the patch? Normally, if there
are no writers, the source should deliver silence like any other
source without input signal.


pipe-source module can't generate silence if no writers connected
because it has no clock. Aactually incoming data has some clock, but
not pipe-source itself. Use the system clock to generate silence
is a bad idea because it may differ from incoming data clock.

For example the loopback module connected to pipe-source without
writers just spams messages like this:
[alsa-sink-USB Audio] module-loopback.c: Could not peek into queue

I can make autosuspend behaviour optional.



Regards
  Georg


--
Raman
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] [PATCH v2] pipe-source: suspend source when no writers connected to fifo

2018-02-10 Thread Georg Chini

On 08.02.2018 17:58, Raman Shyshniou wrote:

 Make pipe-source suspended if all writers closed fifo.
 Source will be automatically unsuspended if any data will
 be written to pipe and suspended again when last writer
 closed fifo.
---
  src/modules/module-pipe-source.c | 114 +--
  1 file changed, 109 insertions(+), 5 deletions(-)


What is the motivation/use case for the patch? Normally, if there
are no writers, the source should deliver silence like any other
source without input signal.

Regards
 Georg
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss