Playbin and Playbin3 leaks the volume element
Describe your issue
Playbin and Playbin3 both leak the volume element, which in turn leaks the context and the display. This can be reproduced with this sample application:
#include <gst/gst.h>
#ifdef __APPLE__
#include <TargetConditionals.h>
#endif
typedef enum
{
GST_PLAY_FLAG_VIDEO = (1 << 0),
GST_PLAY_FLAG_AUDIO = (1 << 1),
GST_PLAY_FLAG_TEXT = (1 << 2),
GST_PLAY_FLAG_VIS = (1 << 3),
GST_PLAY_FLAG_SOFT_VOLUME = (1 << 4)
} GstPlayFlags;
void run()
{
GstElement *pipeline;
GstElement *volume;
/* Build the pipeline */
pipeline =
gst_parse_launch
("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm",
NULL);
// With software volume disabled the leak does not reproduce
// g_object_set (pipeline, "flags", GST_PLAY_FLAG_AUDIO | GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_TEXT, NULL);
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
gst_element_seek_simple (pipeline, GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, 1 * GST_SECOND);
gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
}
int
tutorial_main (int argc, char *argv[])
{
/* Initialize GStreamer */
gst_init (&argc, &argv);
for (int i=0; i<1; i++) {
run();
}
gst_deinit ();
return 0;
}
int
main (int argc, char *argv[])
{
#if defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE
return gst_macos_main (tutorial_main, argc, argv, NULL);
#else
return tutorial_main (argc, argv);
#endif
}
Expected Behavior
All resources are freed correctly.
Observed Behavior
The volume element is leaked
Setup
- Operating System: Tested in macOS
- Device: Computer
- GStreamer Version: 1.22.x 6c539cbb
- Command line:
Steps to reproduce the bug
- Compile the test sample with: clang test.c `pkg-config --libs --cflags gstreamer-1.0` -o test
- Run the test app: GST_TRACERS='leaks' GST_DEBUG=GST_TRACER:7 ./test
How reproducible is the bug?
Always, with soft-volume enabled