Videotestsrc takes several minutes to send the first frame

When I use a custom appsrc, the client receives a sample quickly. But when videotestsrc is used, it takes several minutes. I wonder what the cause could be.

Server

    pipeline_str = g_strdup_printf("videotestsrc ! " //
                                   "queue ! " //
                                   "videoconvert ! " //
                                   "video/x-raw,format=NV12 ! " //
                                   "queue ! " //
                                   "x264enc tune=zerolatency ! " //
                                   "video/x-h264,profile=baseline ! " //
                                   "queue ! " //
                                   "h264parse ! " //
                                   "rtph264pay config-interval=1 ! " //
                                   "application/x-rtp,payload=96 ! " //
                                   "tee name=%s allow-not-linked=true",
                                   WEBRTC_TEE_NAME);

    // No webrtc bin yet until later!

Client

        ws_state.pipeline = gst_parse_launch(
            "webrtcbin name=webrtc bundle-policy=max-bundle ! "
            "rtph264depay ! "
            "h264parse ! "
            "avdec_h264 ! " // sudo apt install gstreamer1.0-libav
            "autovideosink",
            &error);

If anyone is interested, here’s the repos:

Thanks in advance!

You may try setting x264enc property key-int-max for it to make a key frame at shorter intervals, such as:

... ! x264enc key-int-max=30 ...

for a key frame each 30 frames.

Unfortunately this doesn’t work. If I add

"tee name=tp tp. ! queue! autovideosink tp. ! "

after videotestsrc to show the test video on the server side, the client side will pop up the video window soon. This is weird.

Does the issue happen even if the server has been up a couple of minutes before running the client?
I’m wondering if the issue is due to problems with the videotestsrc doing the PREROLL correctly.

Yes, it still happens. And when I use filesrc instead of videotestsrc, there’s no video at all and the pipeline is kind of broken.

The pipeline for videotestsrc is as follows.

And again, if I add the beforementioned autovideosink, filesrc does work.

The delay would be gone if I don’t use dynamic pipeline. webrtcbin is really a mess

Have you tried is-live=true on videotestsrc?

1 Like

is-live=true definitely works! I wonder what this means