appsrc warning

Mario GarcĂ­a garciam4d at gmail.com
Wed Dec 12 13:43:03 UTC 2018


Hi all.

My application consist of pushing images from a folder (actually now is not
reading the info, but is emulate this bytes values with black to almost
white) to a gstremaer pipeline (appsrc --> videoconvert --> capsfilter
--> omxh264enc -->h264parse --> rtph264pay -->udpsink ) using the appsrc
plugin.

In addition, I would like that the program runs until I want to. Hence
there is a loop which calls "push" function infinite times.

THE CODE:
#include <gst/gst.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappsink.h>
#include <malloc.h>
#define TOP 10
#define HEIGHTF 512
#define WIDTHF 640


int main(int argc, char *argv[])
{
  GstElement *pipeline, *source, *convert, *enc, *parse, *rtppay, *sink,
*capsFilter;
        GstCaps *capsSource, *capsConvert;
GstBus *bus;
GstMessage *msg;
GstStateChangeReturn ret;
GstFlowReturn Ret;

/* Initialize GStreamer */
gst_init (&argc, &argv);

/* Create the elements */
//1-SOURCE
source = gst_element_factory_make ("appsrc", NULL);
//Source caps
        capsSource = gst_caps_new_simple ("video/x-raw",
          "format",  G_TYPE_STRING, "GRAY8",
          "width", G_TYPE_INT, 640,
          "height", G_TYPE_INT, 512,
  "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
  "interlace-mode", G_TYPE_STRING, "progressive", NULL) ;
        gst_app_src_set_caps (GST_APP_SRC(source), capsSource);
//Set the block propierty to TRUE
g_object_set(source, "block", TRUE, NULL);
//Set the max-bytes propierty
g_object_set(source, "max-bytes", 655360, NULL);

//2-CONVERSION
convert = gst_element_factory_make ("videoconvert", NULL);

//3-CAPS Filter
capsFilter = gst_element_factory_make ("capsfilter", NULL);
capsConvert = gst_caps_new_simple ("video/x-raw",
          "format",  G_TYPE_STRING, "I420", NULL);
g_object_set(capsFilter, "caps", capsConvert, NULL);

//4-CODEC
enc = gst_element_factory_make ("omxh264enc", "enc");
g_object_set(enc, "bitrate", 1000000, NULL);

//5-PARSSING
parse = gst_element_factory_make ("h264parse", "parse");

  //6-RTP PAYLOAD
rtppay = gst_element_factory_make ("rtph264pay", "rtppay");
g_object_set (G_OBJECT (rtppay), "ssrc", 575096457,  NULL);

//7-DESTINATION
sink = gst_element_factory_make ("udpsink", "sink");
g_object_set(G_OBJECT (sink), "host", "127.0.0.1", NULL );
g_object_set(G_OBJECT (sink), "port", 9078, NULL );


/* Create the empty pipeline */
  pipeline = gst_pipeline_new ("test-pipeline");

if (!pipeline || !source || !convert ||  !capsFilter ||  !enc || !parse ||
!rtppay || !sink) {
  g_printerr ("Not all elements could be created.\n");
  return -1;
}

/* Build the pipeline */
gst_bin_add_many (GST_BIN (pipeline), source, convert, capsFilter, enc,
parse, rtppay, sink, NULL);
if (gst_element_link_many (source, convert, capsFilter, enc, parse, rtppay,
sink, NULL) != TRUE) {
    g_printerr ("Elements could not be linked.\n");
    gst_object_unref (pipeline);
    return -1;
}
/* Start playing */
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
if (ret == GST_STATE_CHANGE_FAILURE) {
    g_printerr ("Unable to set the pipeline to the playing state.\n");
    gst_object_unref (pipeline);
    return -1;
}

//CREATE AND FEED BUFFER
GstBuffer *buf;
GstMapInfo map;
int imageCount=0;

while (imageCount<TOP){
//Allocate and create Buffer
buf=gst_buffer_new_and_alloc(HEIGHTF*WIDTHF);
//To avoid coping in memory
gst_buffer_map(buf, &map, GST_MAP_WRITE);
// We set the buffer to values from 0 (black) to 234 (almost white)
memset (map.data, 26*imageCount, HEIGHTF*WIDTHF);
//Unmap
gst_buffer_unmap(buf, &map);
//Push
Ret=gst_app_src_push_buffer(GST_APP_SRC(source), buf);
if (Ret!=GST_FLOW_OK)
printf ("\nError pushing buffer");
//keep the loop alive
imageCount++;
if(imageCount==10)
imageCount=0;
}

/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,
GST_MESSAGE_ERROR | GST_MESSAGE_EOS);

/* Parse message */
if (msg != NULL) {
GError *err;
gchar *debug_info;

switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_ERROR:
gst_message_parse_error (msg, &err, &debug_info);
g_printerr ("Error received from element %s: %s\n", GST_OBJECT_NAME
(msg->src), err->message);
g_printerr ("Debugging information: %s\n", debug_info ? debug_info :
"none");
g_clear_error (&err);
g_free (debug_info);
break;
      case GST_MESSAGE_EOS:
g_print ("End-Of-Stream reached.\n");
break;
      default:
/* We should not reach here because we only asked for ERRORs and EOS */
g_printerr ("Unexpected message received.\n");
break;
}
gst_message_unref (msg);
}

/* Free resources */
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);/* Create the empty pipeline */
pipeline = gst_pipeline_new ("test-pipeline");



return 0;
}

It compile without errors, but when I execute I obtain the next output. I
do not know how to continue, because it seem like the speed of feeding is
wrong or maybe an allocation memory issue. Please, if someone could help
me, I would be very grateful.

DEBUG INFO
ubuntu at tegra-ubuntu:~/mario/Project/MarioApp/Images_app$ ./ALLIMAGESMEMGST
0:00:00.060633916  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1147:gst_app_src_set_caps:<appsrc0> setting caps to
video/x-raw, format=(string)GRAY8, width=(int)640, height=(int)512,
pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
0:00:00.060954416  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1300:gst_app_src_set_max_bytes:<appsrc0> setting max-bytes to
655360

(ALLIMAGESMEMGST:4114): GLib-GObject-WARNING **: g_object_set_valist:
object class 'GstAppSrc' has no property named 'width'
0:00:00.070510333  4114   0x139d20 WARN                     omx
/dvs/git/dirty/git-master_linux/external/gstreamer/gst-omx/omx/gstomx.c:2814:plugin_init:
Failed to load configuration file: Valid key file could not be found in
search dirs (searched in:
/home/ubuntu/.config:/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg as
per GST_OMX_CONFIG_DIR environment variable, the xdg user config directory
(or XDG_CONFIG_HOME) and the system config directory (or XDG_CONFIG_DIRS)
0:00:00.091209833  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:591:gst_app_src_internal_get_caps:<appsrc0> caps: video/x-raw,
format=(string)GRAY8, width=(int)640, height=(int)512,
pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
0:00:00.093006166  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:591:gst_app_src_internal_get_caps:<appsrc0> caps: video/x-raw,
format=(string)GRAY8, width=(int)640, height=(int)512,
pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
0:00:00.095336833  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:591:gst_app_src_internal_get_caps:<appsrc0> caps: video/x-raw,
format=(string)GRAY8, width=(int)640, height=(int)512,
pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
0:00:00.096090833  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:591:gst_app_src_internal_get_caps:<appsrc0> caps: video/x-raw,
format=(string)GRAY8, width=(int)640, height=(int)512,
pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
0:00:00.096366500  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:591:gst_app_src_internal_get_caps:<appsrc0> caps: video/x-raw,
format=(string)GRAY8, width=(int)640, height=(int)512,
pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
0:00:00.096731416  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:591:gst_app_src_internal_get_caps:<appsrc0> caps: video/x-raw,
format=(string)GRAY8, width=(int)640, height=(int)512,
pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
Inside NvxLiteH264DecoderLowLatencyInitNvxLiteH264DecoderLowLatencyInit set
DPB and Mjstreaming0:00:00.123102833  4114   0x139d20 DEBUG
 appsrc gstappsrc.c:742:gst_app_src_start:<appsrc0> starting
0:00:00.123251750  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1222:gst_app_src_get_size:<appsrc0> getting size of -1
0:00:00.123316083  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:865:gst_app_src_do_seek:<appsrc0> seeking to 0, format bytes
0:00:00.123684083  4114   0x14bbb0 FIXME                default
gstutils.c:3648:gst_pad_create_stream_id_printf_valist:<appsrc0:src>
Creating random stream-id, consider implementing a deterministic way of
creating a stream-id
0:00:00.124006083  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1537:gst_app_src_push_buffer_full:<appsrc0> queueing buffer
0x181160
0:00:00.124418750  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1537:gst_app_src_push_buffer_full:<appsrc0> queueing buffer
0x181200
0:00:00.124764333  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1502:gst_app_src_push_buffer_full:<appsrc0> queue filled
(655360 >= 655360)
0:00:00.124814416  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1502:gst_app_src_push_buffer_full:<appsrc0> queue filled
(655360 >= 655360)
0:00:00.124853666  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1523:gst_app_src_push_buffer_full:<appsrc0> waiting for free
space
0:00:00.125336916  4114   0x14bbb0 WARN                GST_PADS
gstpad.c:3669:gst_pad_peer_query:<appsrc0:src> could not send sticky events
0:00:00.125457583  4114   0x14bbb0 DEBUG                 appsrc
gstappsrc.c:1052:gst_app_src_create:<appsrc0> we have buffer 0x181160 of
size 327680
0:00:00.126733083  4114   0x14bbb0 WARN                 basesrc
gstbasesrc.c:2865:gst_base_src_loop:<appsrc0> error: Internal data flow
error.
0:00:00.126812416  4114   0x14bbb0 WARN                 basesrc
gstbasesrc.c:2865:gst_base_src_loop:<appsrc0> error: streaming task paused,
reason not-negotiated (-4)
0:00:00.128321250  4114   0x14bbb0 WARN               baseparse
gstbaseparse.c:1153:gst_base_parse_sink_event_default:<parse> error: No
valid frames found before end of stream
0:00:00.126777250  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1537:gst_app_src_push_buffer_full:<appsrc0> queueing buffer
0x1812a0
0:00:00.128696000  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1502:gst_app_src_push_buffer_full:<appsrc0> queue filled
(655360 >= 655360)
0:00:00.128746333  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1502:gst_app_src_push_buffer_full:<appsrc0> queue filled
(655360 >= 655360)
0:00:00.128783583  4114   0x139d20 DEBUG                 appsrc
gstappsrc.c:1523:gst_app_src_push_buffer_full:<appsrc0> waiting for free
space

 Thank you very much in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20181212/a04762d3/attachment-0001.html>


More information about the gstreamer-devel mailing list