oss: Check for element types when reconfiguring

Make gst_oss_device_reconfigure_element() check whether the passed element
type matches that of the device itself before attempting to apply the new
configuration.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9558>
This commit is contained in:
Adrian Perez de Castro 2025-08-14 21:46:48 +03:00
parent 9c166d6dfa
commit 71619ec72b

View File

@ -25,6 +25,8 @@
#include "gstossdeviceprovider.h"
#include "gstosshelper.h"
#include "gstosssink.h"
#include "gstosssrc.h"
#include <glib/gstdio.h>
#include <gst/gst.h>
#include <fcntl.h>
@ -190,6 +192,16 @@ gst_oss_device_reconfigure_element (GstDevice * device, GstElement * element)
{
GstOssDevice *oss_dev = GST_OSS_DEVICE (device);
if (strcmp (oss_dev->element, "osssrc") == 0) {
if (!GST_IS_OSS_SRC (element))
return FALSE;
} else if (strcmp (oss_dev->element, "osssink") == 0) {
if (!GST_IS_OSSSINK (element))
return FALSE;
} else {
g_assert_not_reached ();
}
g_object_set (element, "device", oss_dev->device_path, NULL);
return TRUE;