Buffers not writable after tee
Summary
Buffers coming on some streams from a tee split are not writable (most of them) while on other streams the buffers are always writable.
Example
This pipeline does not work as expected (allow mapping of writable buffers):
gst-launch-1.0 videotestsrc pattern=snow ! video/x-raw, width=640,height=480, framerate=30/1 ! videoconvert ! video/x-raw, format=Y444 ! tee name=t ! queue ! mycustomelement ! videoconvert ! xvimagesink t. ! queue ! videoconvert ! xvimagesink
#
# Example code from "mycustomelement" chain_sink funtion
static GstFlowReturn
gst_plugin_chain_sink (GstPad * pad, GstObject * parent, GstBuffer * buffer)
{
PLUGIN_NAME *plugin;
auto klass = GST_CUSTOM_PLUGIN_CLASS(G_OBJECT_GET_CLASS(parent));
plugin = GST_CUSTOM_PLUGIN (parent);
GstMapInfo map;
if (buffer == NULL || !gst_buffer_is_writable(buffer) )
{
return gst_pad_push (plugin->srcpad, buffer);
}
// Mapping a buffer can fail (non-writable)
if (gst_buffer_map (buffer, &map, GST_MAP_WRITE))
{
//auto ptr = (guint8 *) map.data;
printf("\n %d",(int)map.data[0]);
map.data[0] = 42;
printf("\n %d",(int)map.data[0]);
gst_buffer_unmap (buffer, &map);
}
return gst_pad_push (plugin->srcpad, buffer);
}
While this one does work as expected :
gst-launch-1.0 videotestsrc pattern=snow ! video/x-raw, width=640,height=480, framerate=30/1 ! videoconvert ! video/x-raw, format=Y444 ! tee name=t ! queue ! videoconvert ! xvimagesink t. ! queue ! mycustomelement ! videoconvert ! xvimagesink