Skip to content

cbl-2026-05-14#8

Draft
raytiley wants to merge 79 commits into
mainfrom
cbl-2026-05-14
Draft

cbl-2026-05-14#8
raytiley wants to merge 79 commits into
mainfrom
cbl-2026-05-14

Conversation

@raytiley
Copy link
Copy Markdown
Member

No description provided.

MathieuDuponchelle and others added 30 commits May 14, 2026 05:20
When for example a probe sends out an EOS event, we don't want
to run the chain function with the buffer that triggered the
probe.
When this property is enabled, ccextractor will expose caption pad
on the first buffer even if caption meta is not attached in the buffer.

This feature can be useful when caption branch needs to be
strictly synchronized with video branch via pushed GAP event.

For instance, application might want to produce text related data
even if it doesn't exist (as a dummy or similar form).
Live encoding would be a likely scenario. But by the nature of text,
stream might not contain any caption data at the beginning then
ccextractor cannot notify downstream of emptiness via GAP event
since caption pad is not added yet.
... in order to make use of OS layer file I/O abstraction/optimiztion
... for user to be able to specify the size of read buffer.
Depending on use cases, larger buffer size than default value
can optimize the read pattern and it would be able to save
the cost resulting from too frequent read access to
the underlying storage hardware.
This parse element updates resolution with parsed value which can
be different from upstream one but pixel-aspect-ratio is not updated.
Updates pixel-aspect-ratio as well if resolution is updated
since the upstream information is likely incorrect.
Use given DTS value as the PTS instead of accumulating
frame duration. The frame duration accumulation will be reliable
only if it's very accuration, and if not, that will cause
out of sync issue.
Key differences from the old decklink plugin:
* Single source/sink element instead of separate audio/video source/sink
* Supports old driver (version 10.11 or newer)
* Windows DeckLink SDK build is integrated into plugin build
... so that subclasses can push sticky-events dependent events
Adding GstAggregator based input-selector-like elements.

streamselector element behaves similar to input-selector element,
but active pad selection is done via "active" property of
streamselector's sink pads. And input streams will be synchronized
by using active pad's segment (same as "sync-mode=active-segment" of input-selector).

In addition to streamselector element, streamselectorbin is added
which consists of clocksync and streamselector elements.
The streamselectorbin supports "sync-mode" property identical to
that of input-selector.
... even when active pad is not ready. And send necessary stick event
when active pad is changed even if the active pad does not hold buffer.
... so that the element can skip first N frames as requested.
Support restart streaming via signal action
Support automatic restart when frame dropping happens
Avoid heap allocation in capture thread
SDK 12.4.2 doc says if "sampleFramesWritten" is null, it's blocking
operation finished once all data is written to driver. But the behavior
is not mentioned in old SDK docs.
…ties

Once large A/V desync or no-signal frames are detected, src will
automatically restart streaming
instead, do auto restart on no-signal to signal state transition
Driver may wait for callback thread to join() but we takes the same
lock there
raytiley and others added 22 commits May 14, 2026 05:20
Add a new source mode "running-time". This mode will convert buffer
running time into timecode
There are some streams out there that only have valid content on a single
line (i.e. a single field).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7825>
Use requested video-format in case of auto detect mode as well
If detected format is compatible with previous format, do not
restart stream
Introduce a new "decoder-factory-sort" signal, similar to the
"autoplug-sort" signal in (uri)decodebin. This allows applications
to reorder the list of candidate decoder factories based on their
own preferences
Previously, videoaggregator enforced consistent input interlace-mode,
but this makes little sense from a base class perspective because:
* Subclasses (e.g. compositor) may perform rescaling or cropping.
  Even without rescaling, if the target position's vertical start offset
  is not aligned to an even number, blending already happens between
  mismatched field positions, resulting in suboptimal image quality.
  Therefore, enforcing a consistent interlace-mode provides little
  real benefit.
* For best image quality, blending should always occur in progressive
  mode, though performing pre-deinterlacing can either be the user's
  responsibility or be handled internally by subclasses if desired.

Similarly, input formats with an alpha channel are now allowed even
when the output format does not have one. Filtering out alpha-capable
input formats in such cases is unnecessary, since subclasses like
compositor and d3d12compositor can already handle this properly.
By this commit, overlaycomposition will be able to blend
upstream overlay-compositions with video frames if downstream
does not support the meta.

Summary of changes
* Port to basetransform
* Notify upstream that overlay-composition meta is always supported
  by this element during negotiation. Then decision whether
  blending is needed or not will be made by this element
We need both overlay composition meta added/removed caps.
Four related fixes to the COM-style wrapper classes used to bridge
GStreamer buffers/callbacks with the DeckLink SDK:

- IGstDeckLinkMemoryAllocator (input): QI checked
  IID_IDeckLinkInputCallback instead of IID_IDeckLinkMemoryAllocator.
  When the driver QIs our allocator after SetVideoInputFrameMemoryAllocator,
  it would receive E_NOINTERFACE and may take a degraded code path that
  bypasses our ReleaseBuffer, leaving g_malloc'd 4 MB frame buffers
  permanently allocated.

- IGstDeckLinkInputCallback_v11_5_1 (input): QI checked
  IID_IDeckLinkInputCallback (the latest-API IID) instead of the v11_5_1
  variant. Only affects builds against pre-12.0 DeckLink SDK.

- IGstDeckLinkVideoFrame (output): QI checked
  IID_IDeckLinkVideoOutputCallback instead of IID_IDeckLinkVideoFrame.
  Same pattern as upstream commit 31dab02730304e21256e3bc03f2f12ddd206e765e3
  and the analogous decklink (non-decklink2) fix b5717dd
  ("Fix frame completion callbacks for firmware 14.3+"). When the driver
  internally QIs an output frame, returning E_NOINTERFACE breaks the
  completion-callback chain so the wrapper's refcount never drops to
  zero, keeping the GstVideoFrame mapped, the GstBuffer ref'd, and the
  underlying DeckLink-pool 4 MB allocation alive.

- IGstDeckLinkVideoFrame::Clone (output): passed &frame_ (the parent's
  already-mapped struct) to the new instance's constructor instead of
  the just-mapped local &frame. Refcounts happened to balance via the
  leaked local map, but both parent and clone end up calling
  gst_video_frame_unmap with identical struct contents, double-unmapping
  the underlying GstMemory.

All four IIDs were verified against the SDK headers (linux/DeckLinkAPI.h,
mac/DeckLinkAPI.h, win/DeckLinkAPI.idl which #includes DeckLinkAPI_v11_5_1.idl
at line 1357).
@raytiley raytiley changed the title cbl-2026-05-24 cbl-2026-05-14 May 28, 2026
nirbheek added 5 commits May 28, 2026 16:33
It should be super low-risk to add an extra KB to the stack at all
call-sites.
The return value of snprintf will let us know that already. %n is only
needed for ancient snprintf implementation that didn't do that. We do
not support any of those.

This allows us to use snprintf instead of sprintf which is marginally
faster.
This implementation is 66% faster (0.33x time) than the current
variant. We call GST_TIME_ARGS one very single log message and it adds
up quickly.

This reduces logging time by 30% (0.7x time) for a GST_INFO() macro.
When setting GST_DEBUG_FILE, the file was opened with fopen() and
written to with fwrite(). This required an expensive fflush() on
Windows because fwrite() doesn't support line-buffered I/O.

Bypass the CRT userspace buffering by submitting whole lines in
a single write to the kernel. This is equivalent to line-buffered FILE
writes, and is about 12% faster.
HRESULT STDMETHODCALLTYPE QueryInterface (REFIID riid, void **object)
{
if (riid == IID_IDeckLinkInputCallback) {
if (riid == IID_IDeckLinkMemoryAllocator) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sdroege / @seungha-yang - would ya'll sanity check this commit for me?

I'm trying to track down a memory / resource leak in our app and the memory dumps I had pointed to decklink vanc, I had the robot review and it found these potential issues.

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.

6 participants