mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-22 05:33:53 -04:00
For a pipeline like below, we might want to dynamically switch the audio source. gst-launch-1.0 -e pipewiresrc autoconnect=false ! queue ! audioconvert ! autoaudiosink On switching to a different audio source, any one of driver, quantum or clock rate might change which changes the return `result` value of gst_pipewire_clock_get_internal_time. This can result in the basesrc create function incorrectly waiting in gst_clock_id_wait. We post clock lost message to fix this. In the case of gst-launch, it will set the pipeline to PAUSED and then PLAYING to to force a new clock and a new base_time distribution. Without the clock lost message, the following can be seen before re-linking to a different source 0:00:30.887602864 79499 0x7fffe8000d40 DEBUG GST_CLOCK gstsystemclock.c:1158:gst_system_clock_id_wait_jitter_unlocked:<pipewireclock0> entry 0x7fffd803fad0 time 0:00:17.024565416 now 0:00:17.024109144 diff (time-now) 456272 after re-linking to a different source 0:00:45.790843245 79499 0x7fffe8000d40 DEBUG GST_CLOCK gstsystemclock.c:1158:gst_system_clock_id_wait_jitter_unlocked:<pipewireclock0> entry 0x7fffd803fad0 time 0:00:31.927694059 now 0:00:17.066883864 diff (time-now) 14860810195 With the clock lost message, the following can be seen before re-linking to a different source 0:01:09.336533552 89461 0x7fffe8000d40 DEBUG GST_CLOCK gstsystemclock.c:1158:gst_system_clock_id_wait_jitter_unlocked:<pipewireclock0> entry 0x7fffd803fad0 time 0:00:58.198536772 now 0:00:58.197444926 diff (time-now) 1091846 after re-linking to a different source 0:01:21.659827958 89461 0x7fffe8000d40 DEBUG GST_CLOCK gstsystemclock.c:1158:gst_system_clock_id_wait_jitter_unlocked:<pipewireclock0> entry 0x7fffd803fad0 time 0:28:24.853517646 now 0:28:24.853527204 diff (time-now) -9558 Note the difference in `time` and `now` fields of the above log message. This is easy to reproduce by using a pipewiresink as the audio source with a pipeline like below, as one of the sources during switching. gst-launch-1.0 -e audiotestsrc wave=ticks ! audioconvert ! audio/x-raw,format=F32LE,rate=48000,channels=1 ! pipewiresink stream-properties="props,media.class=Audio/Source,node.description=pwsink" client-name=pwsink Applications need to handle the GST_MESSAGE_CLOCK_LOST message in their bus handlers. |
||
|---|---|---|
| .. | ||
| daemon | ||
| examples | ||
| gst | ||
| modules | ||
| pipewire | ||
| tests | ||
| tools | ||
| meson.build | ||