uridecodebin3 randomly hangs while switching uris
Describe your issue
uridecodebin3 randomly hangs while switching uris with instant-uri=true. Sometimes it crashes too. I wrote a test program that simply switched uris between two files, waiting a few seconds. The playback hung up randomly after a switch, usually before the 10th switch.
Expected Behavior
uridecodebin3 should switch uris and play smoothly, no matter how many switches.
Observed Behavior
Playback hanged after a few switches. I would Ctrl+C and retry. Sometimes it crashed.
Setup
- Operating System:
- Windows 11
- GStreamer Version:
- 1.22.10 (update: also 1.23.90 / pre-1.24 git main)
Steps to reproduce the bug
I built and ran the following program. I can upload the video files, but the exact files don't seem to be significant. Playback would hang usually under 10 iterations.
#include <iostream>
#include <gst/gst.h>
const char* files[] =
{
"file:///d:/data/test1920x1080x60_h264.mp4",
"file:///d:/data/test1920x1080x60_h265.mp4"
};
int main()
{
gst_init(NULL, NULL);
GstElement* pipeline = gst_parse_launch("uridecodebin3 name=decodebin instant-uri=true uri=file:///d:/data/test1920x1080x60_h264.mp4 ! autovideosink", nullptr);
GstElement* decodebin = gst_bin_get_by_name(GST_BIN(pipeline), "decodebin");
gst_element_set_state(pipeline, GST_STATE_PLAYING);
for (int i = 0; i < 10000; i++)
{
g_usleep(5000000);
g_object_set(decodebin, "uri", files[(i + 1) & 1]);
printf("%d\n", i);
}
gst_element_set_state(pipeline, GST_STATE_NULL);
gst_object_unref(decodebin);
gst_object_unref(pipeline);
gst_deinit();
}
How reproducible is the bug?
It always hangs, although the number of iterations required varies. It crashes intermittently.
Screenshots if relevant!
Source and call stack for crash: bug