On Sat, 2017-07-22 at 21:02 +0200, Denis Shulyaka wrote: > 2017-07-20 17:06 GMT+02:00 Tanu Kaskinen <tanuk at iki.fi>: > > > No, I don't think there's currently any code to read the status bits > > from the alsa mixer. > > > > But in general, if one wants to passthrow unmodified uncompressed PCM data > from S/PDIF-in to HDMI, shouldn't he know the source sample rate to > correctly open the output device? Yes. > Do I understand it correct that the only way to implement this scenario > with PA is to indirrectly measure the sample rate by comparing the > pa_bytes_to_usec() result against the actual time passed? I'm not sure what you mean by "implement this scenario with PA". Are you talking about modifying PA code itself? If so, it would seem best to modify the alsa source so that it reads the spdif status bits and configures its sample rate accordingly. If you use an external program to record from the spdif source, you might get pretty good results if the program reads the status bits from alsa and then configures the recording stream accordingly. As long as there's just one recording stream connected to the source, the source should change its sample rate depending on the application's stream rate. > If the source is opened with 48000 sample rate, but produces the data at > 44100 rate, will I receive a buffer underflow error on the source? No, I don't think the source will have any complaints. It runs at whatever rate the sound card produces data. It's just that the data will be incorrectly labelled as having 48kHz rate, so it will sound wrong when played back, and if module-loopback is involved, it probably won't work properly if the source is running way too slowly. -- Tanu https://www.patreon.com/tanuk