since a week I've got trouble with a plugin with fixed sink and source pad. It should recieve a NV12 buffer and forward a Y444 one. The recieving is no Problem at all. The fixed formats are set in filter_set_caps and checked after plug them together (v4l2src -> myfilter -> vpuencoder) The problem seems to be in the chain function:
In the beginning it was a NV12 to NV12 forwarding and worked insitu as well as a new buffer with gst_buffer_copy_metadata( outbuf, inbuf, GST_BUFFER_COPY_ALL ) and a memcopy for the Data and a unref of the old buffer in the end.
Now with the new format I need to build a complete new buffer (many versions from "allocate and set" to all-in-one-APIs are available but there all produce the same error I believe I've done something very wrong a few steps before)
This buffer with fresh memory and new Metadata is made as in many source-plugins:
outbuf = gst_buffer_new_and_alloc(outsize);
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (my_filter->srcpad));
as good (or bad) as:
after that and writing or not in the buffers data I do a
return gst_pad_push (my_filter->srcpad, outbuf);
finally, the plugin compiles and all is pluged together and begins to run, and the first frame produce:
GStreamer-CRITICAL **: gst_mini_object_unref: assertion `mini_object->refcount > 0' failed
and the framework drops Error: Internal data flow error.
just before i checked buffers and caps configuration and all is set as mentioned.
Even with a NV12 setup for the sourcepad the error occurs. But more suspicious to me is, when I copy the old buffers Meta with GST_BUFFER_COPY_ALL even on an Y444 configured Pad, the pad reconfigures without warning to NV12 and runs normally.
Tried gst_buffer_ref(outbuf), no change. Tried gst_buffer_make_writeable(outbuf) but refcount was allready 1, no change.
Since the caps-class has it's own warning of refcount, this seems for me to came from the vpuencoder trying to remove my buffer.
Has anyone an Idea of whats going on? How can I force the encoder to accept this buffer?