reports wrong read index and playing-for time to pulseaudio clients after 6:45:48 of playback
I noticed that after 6:45:48 of continuous playback in rhythmbox (using GStreamer and pulsesink), the reported playback position was both nonsense and not changing. This does not happen when using the pulseaudio server, only with pipewire. After enabling the debug output in the pulseaudio libraries, I saw the times fed in to the time smoother go a bit nuts, then restart from 0:
0x7f75a80062b0, put(211240665305 | 24341404744) = 24341376004
0x7f75a80062b0, put(211242166150 | 24342905589) = 24342911991
0x7f75a80062b0, put(211243667248 | 24344406687) = 24344448000
0x7f75a80062b0, put(211245167799 | 24345907238) = 24345898657
0x7f75a80062b0, put(211246668670 | 24347408109) = 24347434667
0x7f75a80062b0, put(211247164631 | 24347904070) = 48648219859
0x7f75a80062b0, put(211247175164 | 24347914603) = 48648219859
0x7f75a80062b0, put(211247195696 | 24347935135) = 48648219859
0x7f75a80062b0, put(211247236219 | 24347975658) = 48648219859
0x7f75a80062b0, put(211247317027 | 24348056466) = 48648305188
0x7f75a80062b0, put(211247477557 | 24348216996) = 48648475868
0x7f75a80062b0, put(211247797888 | 24348537327) = 48648817184
0x7f75a80062b0, put(211248438363 | 24349177802) = 48649414530
0x7f75a80062b0, put(211249719227 | 24350458666) = 48650694530
0x7f75a80062b0, put(211251220254 | 24351959693) = 48652230517
0x7f75a80062b0, put(211252721310 | 24353460749) = 48653766526
0x7f75a80062b0, put(211254221366 | 24354960805) = 48655217184
0x7f75a80062b0, put(211255721803 | 24356461242) = 48656753193
0x7f75a80062b0, put(211257222523 | 24357961962) = 48658203850
0x7f75a80062b0, put(211258723459 | 24359462898) = 48659739859
0x7f75a80062b0, put(211260223607 | 24360963046) = 48661275868
0x7f75a80062b0, put(211261724366 | 24362463805) = 48662726526
0x7f75a80062b0, put(211263225270 | 24363964709) = 48664262535
0x7f75a80062b0, put(211264726052 | 24365465491) = 48665713193
0x7f75a80062b0, put(211266227070 | 24366966509) = 48667249202
0x7f75a80062b0, put(211267727820 | 24368467259) = 48668699859
0x7f75a80062b0, put(211269228804 | 24369968243) = 48670235868
0x7f75a80062b0, put(211270729512 | 24371468951) = 48671771855
0x7f75a80062b0, put(211272230504 | 24372969943) = 48673222535
0x7f75a80062b0, put(211273731457 | 24374470896) = 48674758521
0x7f75a80062b0, put(211275232164 | 24375971603) = 48676209202
0x7f75a80062b0, put(211276733071 | 24377472510) = 48677745188
0x7f75a80062b0, put(211278233971 | 24378973410) = 48679281197
0x7f75a80062b0, put(211279734780 | 24380474219) = 48680731855
0x7f75a80062b0, put(211281235724 | 24381975163) = 48682267864
0x7f75a80062b0, put(211282736340 | 24383475779) = 48683718521
0x7f75a80062b0, put(211284237377 | 24384976816) = 48685254530
0x7f75a80062b0, put(211285738366 | 24386477805) = 48686790517
0x7f75a80062b0, put(211287239061 | 24387978500) = 48688241197
0x7f75a80062b0, put(211288740196 | 24389479635) = 48689777184
0x7f75a80062b0, put(211290240693 | 24390980132) = 48691227864
0x7f75a80062b0, put(211291741795 | 24392481234) = 48692763850
0x7f75a80062b0, put(211293242276 | 24393981715) = 48694214530
0x7f75a80062b0, put(211294695097 | 24395434536) = 0
0x7f75a80062b0, put(211294705645 | 24395445084) = 0
0x7f75a80062b0, put(211294726296 | 24395465735) = 0
0x7f75a80062b0, put(211294766921 | 24395506360) = 0
0x7f75a80062b0, put(211294847573 | 24395587012) = 61537
0x7f75a80062b0, put(211295008250 | 24395747689) = 232195
0x7f75a80062b0, put(211295328665 | 24396068104) = 573533
which causes the time provided by the time smoother go backwards, so pa_stream_get_time() ignores it and returns the last good time.
Next I made the client library report the read index and playing-for times it received from the server. The read index does roughly the same as the calculated time above - after it reaches 2147450494 (a bit less than 0x80000000) it doubles for a bit, then wraps to 0. The playing-for time just wraps at 0x80000000.
I had a quick look at how the pipewire server manages these, and it seems to be using 32 bit values for some of these, including struct spa_ringbuffer, which I suppose is why things get messed up at 0x80000000. This seems to be part of the pipewire API so I guess fixing this isn't as simple as just s/uint32/uint64/g..