Appsrc internal dataflow error.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Appsrc internal dataflow error.

dtmoodie
I'm trying to stream images from opencv to a gstreamer pipeline.

My caps are as follows:
GstCaps* caps = gst_caps_new_simple("video/x-raw",
        "format", G_TYPE_STRING, "RGB24",
        "width", G_TYPE_INT, imgSize.width,
        "height", G_TYPE_INT, imgSize.height,
        "framerate", GST_TYPE_FRACTION, 15, 1,
        "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
        NULL);

I've also tried with format = RGB.
red_mask     = 0x00ff0000
blue_mask   = 0x000000ff
green_mask = 0x0000ff00
endianness

Some examples I'm going off of:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-caps-api.html
http://www.imgportal.net/home/wp-content/uploads/maris-script1.cpp

My desired pipeline:
appsrc name=mysource ! openh264enc ! rtph264pay config-interval=1 pt=96 ! udpsink host=127.0.0.1 port=8004

Pushing data onto the appsrc:

cv::Mat frameimage(user_data->imgSize, CV_8UC3);
static GstClockTime timestamp = 0;
GstBuffer *buffer;
guint buffersize;
GstFlowReturn ret;
GstMapInfo info;
buffersize = frameimage.cols * frameimage.rows * frameimage.channels();
buffer = gst_buffer_new_and_alloc(buffersize);
if (gst_buffer_map(buffer, &info, (GstMapFlags)GST_MAP_WRITE)) {
        memcpy(info.data, frameimage.data, buffersize);
        gst_buffer_unmap(buffer, &info);
}
else
{
        BOOST_LOG_TRIVIAL(error) << "Unable to map image data to buffer";
}
ret = gst_app_src_push_buffer((GstAppSrc*)user_data->source_OpenCV, buffer);
if (ret != GST_FLOW_OK) {
        BOOST_LOG_TRIVIAL(error) << "something wrong in cb_need_data";
        g_main_loop_quit(user_data->glib_MainLoop);
}

Full source can be found here:
https://github.com/dtmoodie/EagleEye/blob/Dev/Plugins/GStreamer/src/gstreamer.cpp
Reply | Threaded
Open this post in threaded view
|

Re: Appsrc internal dataflow error.

Justin Kim
Your caps might have different format so it cannot negotiate properly.

According to source codes of openh264, it accepts only I420 format as an input, but you used RGB here.


On Sun, Aug 30, 2015 at 6:01 AM, dtmoodie <[hidden email]> wrote:
I'm trying to stream images from opencv to a gstreamer pipeline.

My caps are as follows:
GstCaps* caps = gst_caps_new_simple("video/x-raw",
        "format", G_TYPE_STRING, "RGB24",
        "width", G_TYPE_INT, imgSize.width,
        "height", G_TYPE_INT, imgSize.height,
        "framerate", GST_TYPE_FRACTION, 15, 1,
        "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
        NULL);

I've also tried with format = RGB.
red_mask     = 0x00ff0000
blue_mask   = 0x000000ff
green_mask = 0x0000ff00
endianness

Some examples I'm going off of:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-caps-api.html
http://www.imgportal.net/home/wp-content/uploads/maris-script1.cpp

My desired pipeline:
appsrc name=mysource ! openh264enc ! rtph264pay config-interval=1 pt=96 !
udpsink host=127.0.0.1 port=8004

Pushing data onto the appsrc:

cv::Mat frameimage(user_data->imgSize, CV_8UC3);
static GstClockTime timestamp = 0;
GstBuffer *buffer;
guint buffersize;
GstFlowReturn ret;
GstMapInfo info;
buffersize = frameimage.cols * frameimage.rows * frameimage.channels();
buffer = gst_buffer_new_and_alloc(buffersize);
if (gst_buffer_map(buffer, &info, (GstMapFlags)GST_MAP_WRITE)) {
        memcpy(info.data, frameimage.data, buffersize);
        gst_buffer_unmap(buffer, &info);
}
else
{
        BOOST_LOG_TRIVIAL(error) << "Unable to map image data to buffer";
}
ret = gst_app_src_push_buffer((GstAppSrc*)user_data->source_OpenCV, buffer);
if (ret != GST_FLOW_OK) {
        BOOST_LOG_TRIVIAL(error) << "something wrong in cb_need_data";
        g_main_loop_quit(user_data->glib_MainLoop);
}

Full source can be found here:
https://github.com/dtmoodie/EagleEye/blob/Dev/Plugins/GStreamer/src/gstreamer.cpp




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Appsrc-internal-dataflow-error-tp4673397.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Appsrc internal dataflow error.

Tim Müller
In reply to this post by dtmoodie
On Sat, 2015-08-29 at 14:01 -0700, dtmoodie wrote:

Hi,

> I'm trying to stream images from opencv to a gstreamer pipeline.
>
> My caps are as follows:
> GstCaps* caps = gst_caps_new_simple("video/x-raw",
> "format", G_TYPE_STRING, "RGB24",
> "width", G_TYPE_INT, imgSize.width,
> "height", G_TYPE_INT, imgSize.height,
> "framerate", GST_TYPE_FRACTION, 15, 1,
> "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
> NULL);
>
> I've also tried with format = RGB.
> red_mask     = 0x00ff0000
> blue_mask   = 0x000000ff
> green_mask = 0x0000ff00
> endianness

Those fields are no longer needed in GStreamer 1.x, they are now implied
by the format string.

> Some examples I'm going off of:
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/section-caps-api.html
> http://www.imgportal.net/home/wp-content/uploads/maris-script1.cpp
>
> My desired pipeline:
> appsrc name=mysource ! openh264enc ! rtph264pay config-interval=1 pt=96 !
> udpsink host=127.0.0.1 port=8004

As Justin Kim said, openh264enc wants input in I420 YUV, not RGB. Try
adding a videoconvert element between appsrc and openh264enc.

Cheers
 -Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

Join us at the GStreamer Conference: 8-9 October 2015 in Dublin, Ireland


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Appsrc internal dataflow error.

dtmoodie
Hello all and thank you for your responses.

I can't believe I didn't think of that.  I was sure it was something wrong with my caps wrt to the appsrc.  I figured internal dataflow error meant that the error was internal to the appsrc not between appsrc and another element.