Environment
-
GStreamer Version: 1.26.5
-
Binding:
go-gst v1.4.0(Go bindings for GStreamer) -
OS: Windows
-
Pipeline:
appsrc ! bayer2rgb ! capsfilter caps=video/x-raw,format={RGB,BGR,RGBA,BGRA},framerate=30/1 ! videoconvert ! d3d12videosink sync=false -
Source: Custom UDP source feeding Bayer (RGGB) video frames via
appsrc
Problem
When using appsrc as a live source with format=GST_FORMAT_TIME, the pipeline fails with a fatal Internal data stream error when sending a time-based segment event. The error occurs regardless of whether the segment event is sent before or after the pipeline reaches the PLAYING state. Debug logs show:
WARN basesrc gstbasesrc.c:4255:gst_base_src_push_segment:<source> segment format mismatched, ignore
ERROR appsrc gstappsrc.c:1633:gst_app_src_create:<source> Couldn't set new segment segment event: ..., time 99:99:99.999999999, ...
WARN appsrc gstappsrc.c:1740:gst_app_src_create:<source> error: Failed to configure the provided input segment.
ERROR: Could not configure supporting library.
WARN basesrc gstbasesrc.c:3187:gst_base_src_loop:<source> error: Internal data stream error.
Without the segment event, appsrc defaults to a bytes segment, causing gst_segment_to_stream_time: assertion 'segment->format == format' failed warnings with d3d12videosink, but the pipeline streams successfully. Switching to d3d11videosink eliminates all errors and renders correctly with valid PTS set via SetPresentationTimestamp.
Observations
-
Segment Format Mismatch:
-
appsrcis configured withformat=GST_FORMAT_TIME,is-live=true, anddo-timestamp=true. -
Despite this, it emits a
bytessegment:creating segment event bytes segment start=0, offset=0, stop=-1, rate=1.000000, .... -
Sending a
timesegment viagst.NewSegment().Init(gst.FormatTime)is rejected, causing a fatal error. -
The
go-gstbindings lackSetStart/SetStopforGstSegment, limiting configuration, but defaults (start=0,stop=-1) should be valid for live streams.
-
-
d3d12videosink vs. d3d11videosink:
-
d3d12videosinkproducesgst_segment_to_stream_timewarnings due to thebytessegment, but streams if notimesegment is sent. -
d3d11videosinktolerates thebytessegment and renders without issues, using manual PTS fromSetPresentationTimestamp(time.Now().UnixNano()).
-
-
Caps Negotiation:
-
Caps negotiate correctly (
video/x-bayer,format=rggbtovideo/x-raw,format=RGBAorRGBA64_LEwithframerate=0/1). -
Recent logs show
RGBA64_LE(16-bit), possibly due toframerate=0/1, but this doesn’t cause the error.
-
Workaround
-
Switch to
d3d11videosink: Eliminates all errors and renders video correctly with valid PTS. -
Remove Segment Event: Avoid sending
timesegment to preventappsrcrejection. -
Manual PTS: Set PTS via
SetPresentationTimestamp(e.g.,1757714207596254700), which works reliably. -
Variable Framerate: Use
framerate=0/1if the UDP source deviates from 30 fps.
Suspected Bug
-
appsrcdefaults toGST_FORMAT_BYTESfor live sources, ignoringformat=GST_FORMAT_TIME. -
Sending a
timesegment event (even afterPLAYING) is rejected, causing a fatal error. -
This may be a GStreamer 1.26.5 issue or a
go-gstevent handling limitation.
Questions
-
Is this a known issue with
appsrcin GStreamer 1.26.5 for live sources? -
Are there specific configurations to enforce
GST_FORMAT_TIMEinappsrc? -
Any workarounds to send a
timesegment without rejection, givengo-gst’s limited segment API?
Code Snippet
source.SetProperty("format", gst.FormatTime)
source.SetProperty("is-live", true)
source.SetProperty("do-timestamp", true)
source.SetProperty("caps", gst.NewCapsFromString("video/x-bayer,format=rggb,width=1920,height=1200,framerate=30/1"))
// Segment event (causes error):
segment := gst.NewSegment()
segment.Init(gst.FormatTime)
source.SendEvent(gst.NewSegmentEvent(segment))
Request
Can anyone confirm if this is a bug in appsrc or suggest a way to enforce GST_FORMAT_TIME without errors? Logs and full code available if needed. Thanks!