Re: Glib::RefPtr<Gst::QueryCaps> ->set_caps_result gives error that "gst_mini_object_ref: assertion 'mini_object != NULL' failed"



Hi Daniel,

This happens when we link src of the pushsrc to sink of rtppayloader.

when we handle the Gst::QueryType::QUERY_CAPS event as such below.

  gboolean query_event(const Glib::RefPtr<Gst::Pad>& pad, Glib::RefPtr<Gst::Query>& queryevent)
    {
      switch (queryevent->get_query_type())
      {
        case Gst::QueryType::QUERY_CAPS:
        {

          Glib::RefPtr<Gst::QueryCaps> querycaps = Glib::RefPtr<Gst::QueryCaps>::cast_static (queryevent);
          auto newquerycaps = Glib::RefPtr<Gst::QueryCaps>::cast_static (querycaps->create_writable());
          auto caps = Gst::Caps::create_from_string("video/x-h264, stream-format=(string)byte-stream, alignment=(string)au");
          newquerycaps->set_caps_result( caps);
          return true;

        }
      }
      return false;
    }

this is the level 5 debug log.

log start -------------------
0:00:02.192512194 [336m 3311 [00m 0x5555557c6d00 [36mINFO   [00m [00;01;31;41m            GST_PADS gstpad.c:2378:gst_pad_link_prepare: [00m trying to link foosrcmm:src and rtph264pay:sink
0:00:02.192536485 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstutils.c:3040:gst_pad_query_caps:<foosrcmm:src> [00m get pad caps with filter (NULL)
0:00:02.192558512 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00m               query gstquery.c:675:gst_query_new_custom: [00m creating new query 0x555555a80cf0 caps
0:00:02.192578672 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;31;41m            GST_PADS gstpad.c:4006:gst_pad_query:<foosrcmm:src> [00m doing query 0x555555a80cf0 (caps)
got a query event: src:43523
0:00:03.374329639 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00m               query gstquery.c:675:gst_query_new_custom: [00m creating new query 0x555555a80e30 caps
0:00:03.374344393 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;37;41m     GST_PERFORMANCE gstminiobject.c:317:gst_mini_object_make_writable: [00m copy GstQuery miniobject 0x555555a80cf0 -> 0x555555a80e30
0:00:03.374357249 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00m           structure gststructure.c:1964:gst_structure_parse_field: [00m trying field name 'stream-format'
0:00:03.374362425 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;04m             default gstvalue.c:2548:_priv_gst_value_parse_value: [00m trying type name 'string'
0:00:03.374368089 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00m           structure gststructure.c:1964:gst_structure_parse_field: [00m trying field name 'alignment'
0:00:03.374370968 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;04m             default gstvalue.c:2548:_priv_gst_value_parse_value: [00m trying type name 'string'
0:00:03.374395588 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;31;41m            GST_PADS gstpad.c:4029:gst_pad_query:<foosrcmm:src> [00m sent query 0x555555a80cf0 (caps), result 1

(testgstreamer:3311): GStreamer- [1;35mCRITICAL [0m **: [34m12:32:58.473 [0m: gst_mini_object_ref: assertion 'mini_object != NULL' failed
0:00:03.374457499 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstutils.c:3047:gst_pad_query_caps:<foosrcmm:src> [00m query returned (NULL)
0:00:03.374463646 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstutils.c:3040:gst_pad_query_caps:<rtph264pay:sink> [00m get pad caps with filter (NULL)
0:00:03.374467365 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00m               query gstquery.c:675:gst_query_new_custom: [00m creating new query 0x555555a80d40 caps
0:00:03.374471161 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;31;41m            GST_PADS gstpad.c:4006:gst_pad_query:<rtph264pay:sink> [00m doing query 0x555555a80d40 (caps)
0:00:03.374478090 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00m      rtpbasepayload gstrtpbasepayload.c:574:gst_rtp_base_payload_query_default:<rtph264pay> [00m getting caps with filter (NULL)
0:00:03.374482469 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstutils.c:3086:gst_pad_peer_query_caps:<rtph264pay:src> [00m get pad peer caps with filter (NULL)
0:00:03.374485731 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00m               query gstquery.c:675:gst_query_new_custom: [00m creating new query 0x555555a80de0 caps
0:00:03.374489039 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;31;41m            GST_PADS gstpad.c:4133:gst_pad_peer_query:<rtph264pay:src> [00m peer query 0x555555a80de0 (caps)
0:00:03.374492480 [336m 3311 [00m 0x5555557c6d00 [36mINFO   [00m [00;01;31;41m            GST_PADS gstpad.c:4189:gst_pad_peer_query:<rtph264pay:src> [00m pad has no peer
0:00:03.374500545 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;31;41m            GST_PADS gstpad.c:4029:gst_pad_query:<rtph264pay:sink> [00m sent query 0x555555a80d40 (caps), result 1
0:00:03.374504286 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstutils.c:3047:gst_pad_query_caps:<rtph264pay:sink> [00m query returned video/x-h264, stream-format=(string)avc, alignment=(string)au; video/x-h264, stream-format=(string)byte-stream, alignment=(string){ nal, au }
0:00:03.374512559 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstpad.c:2278:gst_pad_link_check_compatible_unlocked:<foosrcmm:src> [00m src caps (NULL)
0:00:03.374515578 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstpad.c:2280:gst_pad_link_check_compatible_unlocked:<rtph264pay:sink> [00m sink caps video/x-h264, stream-format=(string)avc, alignment=(string)au; video/x-h264, stream-format=(string)byte-stream, alignment=(string){ nal, au }
0:00:03.374519943 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstpad.c:2298:gst_pad_link_check_compatible_unlocked: [00m caps are not compatible
0:00:03.374522597 [336m 3311 [00m 0x5555557c6d00 [36mINFO   [00m [00;01;31;41m            GST_PADS gstpad.c:2434:gst_pad_link_prepare: [00m caps are incompatible
0:00:03.374525503 [336m 3311 [00m 0x5555557c6d00 [36mINFO   [00m [00;01;31;41m            GST_PADS gstpad.c:2529:gst_pad_link_full: [00m link between foosrcmm:src and rtph264pay:sink failed: no common format
0:00:03.374538989 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;43m             GST_BUS gstbus.c:318:gst_bus_post:<bus1> [00m [msg 0x555555a80630] posting on bus structure-change message: 0x555555a80630, time 99:99:99.999999999, seq-num 25, element 'sink', GstMessageStructureChange, type=(GstStructureChangeType)GST_STRUCTURE_CHANGE_TYPE_PAD_LINK, owner=(GstElement)"\(foosrcmm\)\ foosrcmm", busy=(boolean)false;
0:00:03.374555231 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01m                 bin gstbin.c:3715:gst_bin_handle_message_func:<gtkmm__gstpipeline0> [00m [msg 0x555555a80630] handling child sink message of type structure-change
0:00:03.374582114 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01m                 bin gstbin.c:961:bin_remove_messages:<rtph264pay:sink> [00m deleting message 0x555555a805b0 of type structure-change (types 0x00001000)
0:00:03.374587793 [336m 3311 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;43m             GST_BUS gstbus.c:353:gst_bus_post:<bus1> [00m [msg 0x555555a80630] dropped
log end --------------------

but if we use the API as shown below it works.

  gboolean query_event(const Glib::RefPtr<Gst::Pad>& pad, Glib::RefPtr<Gst::Query>& queryevent)
    {
      switch (queryevent->get_query_type())
      {
        case Gst::QueryType::QUERY_CAPS:
        {
           std::cout << "Gst Query Event  is writable:" << queryevent->is_writable() << std::endl;
           auto * q = queryevent->gobj();
           std::cout << "Gst Query is writable: " << gst_query_is_writable(q) << std::endl;

           auto * wq = gst_query_make_writable(q);
           auto * newcaps = gst_caps_new_simple("video/x-h264",
           "stream-format",G_TYPE_STRING,"byte-stream",
           "alignment",G_TYPE_STRING,"au",
           NULL);
           gst_query_set_caps_result(wq, newcaps);
           std::cout << "Gst Query is written : " << std::endl;
           gst_caps_unref (newcaps);
          return true;

        }
      }
      return false;
    }


log start ---------------------

0:00:07.968218034 [336m 3053 [00m 0x5555557c6d00 [36mINFO   [00m [00;01;31;41m            GST_PADS gstpad.c:2378:gst_pad_link_prepare: [00m trying to link foosrcmm:src and rtph264pay:sink
0:00:07.968243917 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstutils.c:3040:gst_pad_query_caps:<foosrcmm:src> [00m get pad caps with filter (NULL)
0:00:07.968266454 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00m               query gstquery.c:675:gst_query_new_custom: [00m creating new query 0x555555a814f0 caps
0:00:07.968287663 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;31;41m            GST_PADS gstpad.c:4006:gst_pad_query:<foosrcmm:src> [00m doing query 0x555555a814f0 (caps)
0:00:09.550305389 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;31;41m            GST_PADS gstpad.c:4029:gst_pad_query:<foosrcmm:src> [00m sent query 0x555555a814f0 (caps), result 1
0:00:09.550351757 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstutils.c:3047:gst_pad_query_caps:<foosrcmm:src> [00m query returned video/x-h264, stream-format=(string)byte-stream, alignment=(string)au
0:00:09.550386007 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstutils.c:3040:gst_pad_query_caps:<rtph264pay:sink> [00m get pad caps with filter (NULL)
0:00:09.550414780 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00m               query gstquery.c:675:gst_query_new_custom: [00m creating new query 0x555555a81590 caps
0:00:09.550434461 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;31;41m            GST_PADS gstpad.c:4006:gst_pad_query:<rtph264pay:sink> [00m doing query 0x555555a81590 (caps)
0:00:09.550460791 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00m      rtpbasepayload gstrtpbasepayload.c:574:gst_rtp_base_payload_query_default:<rtph264pay> [00m getting caps with filter (NULL)
0:00:09.550482880 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstutils.c:3086:gst_pad_peer_query_caps:<rtph264pay:src> [00m get pad peer caps with filter (NULL)
0:00:09.550501309 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00m               query gstquery.c:675:gst_query_new_custom: [00m creating new query 0x555555a81540 caps
0:00:09.550519577 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;31;41m            GST_PADS gstpad.c:4133:gst_pad_peer_query:<rtph264pay:src> [00m peer query 0x555555a81540 (caps)
0:00:09.550538513 [336m 3053 [00m 0x5555557c6d00 [36mINFO   [00m [00;01;31;41m            GST_PADS gstpad.c:4189:gst_pad_peer_query:<rtph264pay:src> [00m pad has no peer
0:00:09.550566261 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;31;41m            GST_PADS gstpad.c:4029:gst_pad_query:<rtph264pay:sink> [00m sent query 0x555555a81590 (caps), result 1
0:00:09.550587149 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstutils.c:3047:gst_pad_query_caps:<rtph264pay:sink> [00m query returned video/x-h264, stream-format=(string)avc, alignment=(string)au; video/x-h264, stream-format=(string)byte-stream, alignment=(string){ nal, au }
0:00:09.550618681 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstpad.c:2278:gst_pad_link_check_compatible_unlocked:<foosrcmm:src> [00m src caps video/x-h264, stream-format=(string)byte-stream, alignment=(string)au
0:00:09.550640539 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstpad.c:2280:gst_pad_link_check_compatible_unlocked:<rtph264pay:sink> [00m sink caps video/x-h264, stream-format=(string)avc, alignment=(string)au; video/x-h264, stream-format=(string)byte-stream, alignment=(string){ nal, au }
0:00:09.550673361 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m            GST_CAPS gstpad.c:2298:gst_pad_link_check_compatible_unlocked: [00m caps are compatible
0:00:09.550694672 [336m 3053 [00m 0x5555557c6d00 [36mINFO   [00m [00;01;31;41m            GST_PADS gstpad.c:2586:gst_pad_link_full: [00m linked foosrcmm:src and rtph264pay:sink, successful
0:00:09.550718028 [336m 3053 [00m 0x5555557c6d00 [36mINFO   [00m [00;01;34m           GST_EVENT gstevent.c:1517:gst_event_new_reconfigure: [00m creating reconfigure event
0:00:09.550733889 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m           GST_EVENT gstevent.c:306:gst_event_new_custom: [00m creating new event 0x7fffc8006b50 reconfigure 61441
0:00:09.550756422 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01;34m           GST_EVENT gstpad.c:5638:gst_pad_send_event_unchecked:<foosrcmm:src> [00m have event type reconfigure event: 0x7fffc8006b50, time 99:99:99.999999999, seq-num 25, (NULL)
0:00:09.550779908 [336m 3053 [00m 0x5555557c6d00 [36mINFO   [00m [00;01;34m           GST_EVENT gstpad.c:5744:gst_pad_send_event_unchecked:<foosrcmm:src> [00m Received event on flushing pad. Discarding
0:00:09.550813982 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;43m             GST_BUS gstbus.c:318:gst_bus_post:<bus1> [00m [msg 0x555555a80e00] posting on bus structure-change message: 0x555555a80e00, time 99:99:99.999999999, seq-num 26, element 'sink', GstMessageStructureChange, type=(GstStructureChangeType)GST_STRUCTURE_CHANGE_TYPE_PAD_LINK, owner=(GstElement)"\(foosrcmm\)\ foosrcmm", busy=(boolean)false;
0:00:09.550872653 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01m                 bin gstbin.c:3715:gst_bin_handle_message_func:<gtkmm__gstpipeline0> [00m [msg 0x555555a80e00] handling child sink message of type structure-change
0:00:09.550895790 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;01m                 bin gstbin.c:961:bin_remove_messages:<rtph264pay:sink> [00m deleting message 0x555555a80d80 of type structure-change (types 0x00001000)
0:00:09.550922872 [336m 3053 [00m 0x5555557c6d00 [37mDEBUG  [00m [00;43m             GST_BUS gstbus.c:353:gst_bus_post:<bus1> [00m [msg 0x555555a80e00] dropped
log end ----------------------


On Wed, Jun 13, 2018 at 2:04 AM, Daniel Boles <dboles src gmail com> wrote:
When does that assert fail? Where's the backtrace?


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list




--
Regards

Ankur Deep Jaiswal
Software Architect
Techgentsia Software Technologies Private Limited
Ernakulam


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]