gst/gstpad: Invoke pad probe callback only once when pushing buffer lists #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.