Skip to content

Conversation

@amberik1
Copy link
Contributor

@amberik1 amberik1 commented Jan 8, 2026

When pushing a buffer list through a pad that does not implement a custom chainlist function (i.e. it uses gst_pad_chain_list_default), and a pad probe is installed that handles both buffer lists and individual buffers, the probe callback is invoked twice:

  • once for the buffer list itself
  • once for each buffer in the list, via the default chainlist function From within the probe callback, it is not possible to distinguish whether buffers are received as part of a buffer list or as individual buffers, which can lead to buffers being processed multiple times.

Use case

Consider a section of a pipeline where both individual buffers and buffer lists may flow, and a pad is selected dynamically such that it is not known in advance whether the pad supports a custom chainlist function. A pad probe is attached to this pad and is expected to handle both individual buffers and buffer lists uniformly.

With the current behavior, pads without a custom chainlist function invoke the probe callback multiple times for the same buffers when a buffer list is pushed, while pads with a custom chainlist function invoke the probe callback only once for the buffer list. This results in inconsistent probe behavior depending on the pad implementation.

To address this inconsistency, skip invoking the pad probe callback for the buffer list when the pad does not have a custom chainlist function. In this case, the default chainlist implementation will invoke the probe callback for each buffer in the list. Pads with a custom chainlist function continue to receive the probe callback for the buffer list as before, ensuring consistent and predictable probe semantics.

…ists

When pushing a buffer list through a pad that does not implement a custom
chainlist function (i.e. it uses gst_pad_chain_list_default), and a pad
probe is installed that handles both buffer lists and individual buffers,
the probe callback is invoked twice:
- once for the buffer list itself
- once for each buffer in the list, via the default chainlist function
From within the probe callback, it is not possible to distinguish whether
buffers are received as part of a buffer list or as individual buffers,
which can lead to buffers being processed multiple times.

Use case

Consider a section of a pipeline where both individual buffers and buffer
lists may flow, and a pad is selected dynamically such that it is not known
in advance whether the pad supports a custom chainlist function. A pad
probe is attached to this pad and is expected to handle both individual
buffers and buffer lists uniformly.

With the current behavior, pads without a custom chainlist function
invoke the probe callback multiple times for the same buffers when a buffer
list is pushed, while pads with a custom chainlist function invoke the
probe callback only once for the buffer list. This results in inconsistent
probe behavior depending on the pad implementation.

To address this inconsistency, skip invoking the pad probe callback for the
buffer list when the pad does not have a custom chainlist function. In
this case, the default chainlist implementation will invoke the probe
callback for each buffer in the list. Pads with a custom chainlist
function continue to receive the probe callback for the buffer list as
before, ensuring consistent and predictable probe semantics.
@amberik1 amberik1 changed the title gst/gstpad: Invoke pad probe callback only once when pushing buffer l… gst/gstpad: Invoke pad probe callback only once when pushing buffer lists Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants