GStreamer Device Monitor Bug

Hello,

I’ve noticed that gst-device-monitor does not detect when a Source/Monitor device is removed or added. When I retrieve the list of currently available devices, the monitors are correctly listed. However, if a change occurs (e.g., a monitor is connected or disconnected), the GStreamer device monitor does not receive any event or message on the bus.

This appears to be a bug in the device monitoring functionality. It affects dynamic detection of display sources, which is critical in applications where monitors may be connected or disconnected at runtime.

Is this a known limitation or a bug in GstDeviceMonitor? If not, I’d like to report it properly.

Where can I submit this issue?

Thank you.

Are you using gst-device-monitor-1.0 -f ?

What’s the device you are connecting/disconnecting? What plugin/device provider handles it?

And what version of GStreamer are you testing this with?

Bugs can be reported in GitLab: Issues · GStreamer / gstreamer · GitLab

Hello,

I am using gst-device-monitor-1.0 -f on Windows with GStreamer 1.26.0. It works well for detecting dynamic device changes such as webcams and microphones — they are correctly detected when connected or disconnected.

However, display monitors (device class: Source/Monitor) are not detected dynamically. When I connect or disconnect a monitor, no event is emitted on the GStreamer bus. The only way to update the device list is to restart the monitor tool.

When I list the available devices manually, display monitors are correctly shown. My GStreamer setup uses the d3d11screencapturesrc and d3d12screencapturesrc APIs. Here is an example of a display device as reported:

Device found:
name : HP E27k G5
class : Source/Monitor
caps : video/x-raw(memory:D3D11Memory), format=BGRA, width=3840, height=2160, …
properties:
device.api = d3d11
device.name = \.\DISPLAY2
device.path = \?\DISPLAY#HPN389A#…
device.primary = false
device.type = displayport-external
device.hmonitor = 123669627

Thank you!

Ah, something for @seungha I suppose :slight_smile:

Looking at the D3D device provider, there is indeed no support for dynamic devices, it’s only a static listing. I guess it would need to be implemented.

Already fixed in d3d12screencapture: Add support for monitor add/remove in device provider (!9330) · Merge requests · GStreamer / gstreamer · GitLab (d3d12 only)

Note that as the maintainer of GstD3D11/12, I’m focusing development solely on D3D12, while D3D11 is mainly maintained for legacy compatibility. Contributions to GstD3D11 are still welcome, of course

@seungha

I’m currently testing GStreamer with multiple monitors connected to my system, and I’ve encountered an unexpected behavior when using gst-device-monitor -f to list available video sources (specifically display/screen capture sources).

Here’s the scenario:

  • I have two monitors connected and gst-device-monitor lists both displays correctly.
  • When I disconnect the secondary monitor (the non-primary one), I receive a device removed event for both displays, followed immediately by a device added event for the remaining (still connected) monitor.
  • If I have a running pipeline that captures from the still-connected display, disconnecting the secondary display causes the pipeline to crash, because the source device disappears momentarily and is re-added under (apparently) a different ID.

This seems odd because:

  1. Disconnecting one monitor shouldn’t affect the availability or identity of the other.
  2. The ID of the remaining display should ideally stay the same, especially if it’s still physically connected and active.
  3. When the primary display is removed, I would expect a “device removed” event for it, and perhaps a “device property changed” event for the other monitor (e.g., it became the new primary), rather than a full remove + re-add cycle.

:red_question_mark: Questions:

  • Is this behavior intentional, or is it a bug in how gst-device-monitor or the underlying screen capture source handles hotplug events?
  • Should the device ID of a monitor change just because another monitor was disconnected?

Thanks!

that full removed/added cycle was not intentional.

d3d12screencapturedevice: Avoid false device removal on monitor reconfiguration (!9472) · Merge requests · GStreamer / gstreamer · GitLab will post device-changed instead of removed/added