Help on video demux plugin

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Help on video demux plugin

Myzhar
This post was updated on .
Hi all,
I'm writing a plugin that receives a single stream composed of two frames stitched in top/down configuration.
The plugin should copy the two image in two different buffers and push them in two separated source pads.

For some reason the `chain` function is not working and fails trying to unmap the first of the two buffers after pushing:
gst_buffer_unmap: assertion 'GST_IS_BUFFER (buffer)' failed

This is my code

static GstFlowReturn gst_zeddemux_chain(GstPad* pad, GstObject * parent, GstBuffer* buf )
{
    GstZedDemux *filter;

    filter = GST_ZEDDEMUX (parent);

    GST_DEBUG_OBJECT( filter, "Chain" );

    GstMapInfo map_in;
    GstMapInfo map_out_left;
    GstMapInfo map_out_aux;

    GstFlowReturn ret_left = GST_FLOW_ERROR;
    GstFlowReturn ret_aux = GST_FLOW_ERROR;

    GstClockTime timestamp = GST_CLOCK_TIME_NONE;

    timestamp = GST_BUFFER_TIMESTAMP (buf);
    GST_DEBUG ("timestamp %" GST_TIME_FORMAT, GST_TIME_ARGS (timestamp));

    GST_DEBUG_OBJECT( filter, "Processing ..." );
    if(gst_buffer_map(buf, &map_in, GST_MAP_READ))
    {
        gsize out_buf_size = gst_buffer_get_size(buf)/2;

        GST_DEBUG ("Input buffer size %lu B", out_buf_size*2 );

        filter->buf_left = gst_buffer_new_and_alloc(out_buf_size);
        if( gst_buffer_map(filter->buf_left, &map_out_left, GST_MAP_WRITE) )
        {
            GST_DEBUG ("Copying left buffer %lu B", map_out_left.size );
            memcpy(map_out_left.data, map_in.data, map_out_left.size);
            GST_BUFFER_PTS (filter->buf_left) = GST_BUFFER_PTS (buf);

            GST_DEBUG ("Left buffer push" );
            ret_left = gst_pad_push(filter->srcpad_left, filter->buf_left);

            if(filter->buf_left)
            {
                GST_DEBUG ("Left buffer unmap" );
                gst_buffer_unmap(filter->buf_left, &map_out_left); // <== "gst_buffer_unmap: assertion 'GST_IS_BUFFER (buffer)' failed"
            }
        }

        filter->buf_aux = gst_buffer_new_and_alloc(out_buf_size);
        if( gst_buffer_map(filter->buf_aux, &map_out_aux, GST_MAP_WRITE) )
        {
            GST_DEBUG ("Copying aux buffer %lu B", map_out_aux.size );
            memcpy(map_out_aux.data, map_in.data+out_buf_size, map_out_aux.size);
            GST_BUFFER_PTS (filter->buf_aux) = GST_BUFFER_PTS (buf);

            GST_DEBUG ("Aux buffer push" );
            ret_aux = gst_pad_push(filter->srcpad_aux, filter->buf_aux);

            GST_DEBUG ("Aux buffer unmap" );
            gst_buffer_unmap(filter->buf_aux, &map_out_aux);
        }

    }
    GST_DEBUG ("... processed" );

    if(ret_left==GST_FLOW_OK && ret_aux==GST_FLOW_OK)
    {
        GST_DEBUG_OBJECT( filter, "Chain OK" );
        return GST_FLOW_OK;
    }

    return GST_FLOW_ERROR;
}

Any idea?

Thank you
Walter





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Walter Lucetti
www.myzhar.com