Why gst_app_src_get_size always return -1 but in general everything works well?

I have app in C, that uses gstreamer lib and I push GstBuffer to appsrc - it works, video is playing, but I can not get the size of appsrc element ? I am doing this:

  GstElement* element = gst_bin_get_by_name (GST_BIN (mybin), "binname");

     gst_app_src_push_buffer (GST_APP_SRC (element), buffer);
     printf("  SIZE OF APPSRC = %d \n", gst_app_src_get_size(GST_APP_SRC (element)));

I always see -1

1 answer

  • answered 2017-11-13 15:53 Florian Zwoch

    I think that is an informational value. Appsrc does not know how much data you will feed to it before the stream is EOS. Therefore it tells you it is 'unknown'. If you set it via gst_app_src_set_size() it will probably return the same result here. Similar to gst_app_src_set/get_duration(). AppSrc gives your app control over the feed to the pipeline therefore you cannot expect the pipeline to figure out these things for you.