mp4mux fails due to missing PTS
I'm trying to record multiple H.264 and Opus streams to a MP4 file. However, there is apparently some sort of race condition going on, because in roughly 8 out of 10 attempts, the pipeline fails with the following error and an EOS:
gst-stream-error-quark: Could not multiplex stream. (10): ../gst/isomp4/gstqtmux.c(5402): gst_qt_mux_add_buffer (): /GstPipeline:pipeline0/GstBin:bin_file_sink/GstMP4Mux:mux: Buffer has no PTS.
In the other 20% of cases, the pipeline starts and the resulting MP4 file contains all the streams, correctly synchronized and playable. I also tried with qtmux instead of mp4mux, but got the same results.
I'm attaching the dot graph for the failure case mp4mux-buffer-no-pts.dot; the dot graph for a successful run looks exactly identical, with the only difference being that the filesink doesn't flag EOS.
This is currently running on GStreamer 1.20.3. I will try to also test with 1.22, and try to create a minimal reproducing example, but since this is a dynamically created pipeline, that may be difficult (note that the error never appears, e.g., when GST_DEBUG=4).