PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.37k stars 286 forks source link

Pulseaudio: Make start-stop work again by unifying close and stop #914

Closed illuusio closed 2 weeks ago

illuusio commented 1 month ago

PR fixes start and stop by unifying closing, stop and abort. Also by unifying handling process waiting by macro. Fixes also last part of bug #895 as it tries to prevent glitches at the end of stream.

tatsuki-makino commented 1 month ago

I have experimented with the combination of 2edc379 and audacity-3.5.1 on FreeBSD (but FreeBSD is still 12.4-STABLE).

The behavior of having to manually stop the playback of audio after the entire track or the end of a selection is reached has been suppressed.

As far as the modifications to c420938 are concerned, the stream that has been used up will always pass through the cleanup process. This was kind of a fart on my part, so I don't know where this is working :) If the used-by count in the result of pacmd list-sinks drops to 0, does that mean that this problem is not occurring?

illuusio commented 1 month ago

I have experimented with the combination of 2edc379 and audacity-3.5.1 on FreeBSD (but FreeBSD is still 12.4-STABLE).

The behavior of having to manually stop the playback of audio after the entire track or the end of a selection is reached has been suppressed.

There is still some unwanted artifacts? Thanks for sharing how to produce them I can test now. Pity that Audacity is so slow to start. I have to kind of find test that also produces same effect. Does patest_buffer do the same?

illuusio commented 1 month ago

As far as the modifications to c420938 are concerned, the stream that has been used up will always pass through the cleanup process. This was kind of a fart on my part, so I don't know where this is working :) If the used-by count in the result of pacmd list-sinks drops to 0, does that mean that this problem is not occurring?

Shouldn't stream be always be cleaned us this is client side and it should clean up us you said. When ref drops to zero then all allocated resources should be released on client side. Of course if server does not let us go or somehow hangs (again you are playing on remote machine which is shutdown when you are disconnecting for example) we can't do anything about the server side. Portaudio can just keep own nest clean. But please share if you have more though about this as this is just me trying to improve this and having just own opinion.

illuusio commented 1 month ago

I've splitted that macro thing to own #924 PR as I like get that in as it makes my life easier.

illuusio commented 1 month ago

I have experimented with the combination of 2edc379 and audacity-3.5.1 on FreeBSD (but FreeBSD is still 12.4-STABLE).

The behavior of having to manually stop the playback of audio after the entire track or the end of a selection is reached has been suppressed.

As far as the modifications to c420938 are concerned, the stream that has been used up will always pass through the cleanup process. This was kind of a fart on my part, so I don't know where this is working :) If the used-by count in the result of pacmd list-sinks drops to 0, does that mean that this problem is not occurring?

I've tested with ALSA and Jack there is also small click at then end of stream with Audacity which can be heared with headphones. Is just closing of headphone or something else inside Audacity or feature of Portaudio I can't say.