[Bug 759807] collectpads: Cannot use GST_STREAM_FLAG_SPARSE with mpegtsmux

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Wed Dec 23 07:02:13 PST 2015


https://bugzilla.gnome.org/show_bug.cgi?id=759807

--- Comment #2 from Alexander Vasiljev <alexvasiljev at gmail.com> ---
Problem in more details described here:
http://stackoverflow.com/questions/34294755/mux-klv-data-with-h264-by-mpegtsmux

The pipeline consists of two parts:

main part: v4l2src input-src=Camera ! videorate drop-only=true  ! 'video/x-raw,
format=(string)NV12, width=1920, height=1088, framerate=25/1' ! ce_h264enc 
target-bitrate=6000000 idrinterval=25 intraframe-interval=60 ! queue !
mpegtsmux  alignment=7 ! udpsink host=192.168.0.1 port=3000 -v

klv part: appsrc ! mpegtsmux

Main part without appsrc works well. So the point of interest is appsrc:

Creation of appsrc:
appSrc = gst_element_factory_make("appsrc", nullptr);
gst_app_src_set_caps (GST_APP_SRC (appSrc), gst_caps_new_simple("meta/x-klv",
"parsed", G_TYPE_BOOLEAN, TRUE, "sparse", G_TYPE_BOOLEAN, TRUE, nullptr));
g_object_set(appSrc, "format", GST_FORMAT_TIME, nullptr);

addition appsrc:
gst_bin_add(GST_BIN(pipeline), appSrc);
gst_element_link(appSrc, mpegtsmux);

Pushing data:
void AppSrc::pushData(const std::string &data)
{
GstBuffer *buffer = gst_buffer_new_allocate(nullptr, data.size(), nullptr);
GstMapInfo map;
GstClock *clock;
GstClockTime abs_time, base_time;

gst_buffer_map (buffer, &map, GST_MAP_WRITE);
memcpy(map.data, data.data(), data.size());
gst_buffer_unmap (buffer, &map);

GST_OBJECT_LOCK (element);
clock = GST_ELEMENT_CLOCK (element);
base_time = GST_ELEMENT (element)->base_time;
gst_object_ref (clock);
GST_OBJECT_UNLOCK (element);
abs_time = gst_clock_get_time (clock);
gst_object_unref (clock);

GST_BUFFER_PTS (buffer) = abs_time - base_time;
GST_BUFFER_DURATION (buffer) = gst_util_uint64_scale_int (1, GST_SECOND, 1);

gst_app_src_push_buffer(GST_APP_SRC(element), buffer);
}

Setting GST_STREAM_FLAG_SPARSE:
GstEvent* stream_start = gst_event_new_stream_start("klv-04");
gst_event_set_stream_flags(stream_start, GST_STREAM_FLAG_SPARSE);
GstPad* pad = gst_element_get_static_pad(GST_ELEMENT(element), "src"); 
gst_pad_push_event (pad, stream_start);

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list