Hi Daniel,
sorry for that , please find the GDB trace for it
1. the GDB trace when we use
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;
}
GStreamer-CRITICAL **: 12:55:41.181: gst_mini_object_ref: assertion 'mini_object != NULL' failed
#0 0x00007ffff66edc41 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#1 0x00007ffff66eef2b in g_logv () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007ffff66ef07f in g_log () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007ffff7897942 in gst_mini_object_ref (mini_object=0x0) at gstminiobject.c:344
old_refcount = <optimized out>
new_refcount = <optimized out>
__func__ = "gst_mini_object_ref"
__PRETTY_FUNCTION__ = "gst_mini_object_ref"
#4 0x00007ffff78dcee4 in gst_caps_ref (caps=<optimized out>) at ../gst/gstcaps.h:210
result = 0x0
query = 0x55555589f990
__func__ = "gst_pad_query_caps"
__PRETTY_FUNCTION__ = "gst_pad_query_caps"
#5 0x00007ffff78dcee4 in gst_pad_query_caps (pad=pad@entry=0x5555558a6180, filter=filter@entry=0x0) at gstutils.c:3045
result = 0x0
query = 0x55555589f990
__func__ = "gst_pad_query_caps"
__PRETTY_FUNCTION__ = "gst_pad_query_caps"
#6 0x00007ffff7899352 in gst_pad_link_check_compatible_unlocked (flags=1435133496, sink=0x5555558a6620, src="" at gstpad.c:2259
srccaps = 0x0
sinkcaps = 0x0
compatible = 0
__PRETTY_FUNCTION__ = "gst_pad_link_prepare"
#7 0x00007ffff7899352 in gst_pad_link_prepare (srcpad=srcpad@entry=0x5555558a6180, sinkpad=sinkpad@entry=0x5555558a6620, flags=flags@entry=GST_PAD_LINK_CHECK_DEFAULT) at gstpad.c:2397
__PRETTY_FUNCTION__ = "gst_pad_link_prepare"
#8 0x00007ffff78a61ea in gst_pad_link_full (srcpad=0x5555558a6180, sinkpad=0x5555558a6620, flags=GST_PAD_LINK_CHECK_DEFAULT) at gstpad.c:2524
result = <optimized out>
parent = 0x5555558a41a0
srcfunc = <optimized out>
sinkfunc = <optimized out>
__func__ = "gst_pad_link_full"
__PRETTY_FUNCTION__ = "gst_pad_link_full"
#9 0x000055555555970e in main() () at ../src/test_issue.cpp:76
srcpad = {pCppObject_ = 0x55555587c000}
sinkpad = {pCppObject_ = 0x5555558ab7a0}
linkreturn = Gst::PAD_LINK_OK
major = 1
minor = 14
micro = 0
nano = 0
main_loop = {pCppObject_ = 0x555555894930}
nano_str = 0x55555555d41f ""
pipeline = {pCppObject_ = 0x5555558840a0}
---Type <return> to continue, or q <return> to quit---
rtpbin = {pCppObject_ = 0x5555558a1eb0}
h264encoder = {pCppObject_ = 0x5555558a1f90}
rtph264pay = {pCppObject_ = 0x5555558a9850}
udpsink = {pCppObject_ = 0x5555557eae00}
host = "127.0.0.1"
t = {_M_id = {_M_thread = 93824995540992}}
2. the GDB backtrace when we use
virtual bool decide_allocation_vfunc(const Glib::RefPtr<Gst::Query>& query) override
{
const auto pushsrc = static_cast<BaseClassType*>(g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
);
std::cout << "Query is writable :" << query->is_writable() << std::endl;
const auto base = (GstBaseSrcClass *) pushsrc;
if (base && base->decide_allocation)
{
auto * newquery = Glib::unwrap(query);
bool retval((*base->decide_allocation)((GstBaseSrc *) gobj(), newquery));
return retval;
}
typedef bool RType;
return RType();
}
GStreamer-CRITICAL **: 13:06:42.029: gst_structure_id_take_value: assertion 'IS_MUTABLE (structure)' failed
#0 0x00007ffff66edc41 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#1 0x00007ffff66eef2b in g_logv () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007ffff66ef07f in g_log () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007ffff78c5154 in gst_structure_id_take_value (structure=structure@entry=0x7fffe4003260, field=field@entry=392, value=value@entry=0x7fffeef2ea90)
at gststructure.c:565
__func__ = "gst_structure_id_take_value"
#4 0x00007ffff78b619e in ensure_array (s=0x7fffe4003260, quark=392, element_size=<optimized out>, clear_func=<optimized out>) at gstquery.c:863
new_array_val =
{g_type = 140737018618784, data = "" = -469756720, v_uint = 3825210576, v_long = 140737018598608, v_ulong = 140737018598608, v_int64 = 140737018598608, v_uint64 = 140737018598608, v_float = -9.45073176e+21, v_double = 6.9533325987692788e-310, v_pointer = 0x7fffe40014d0}, {v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}}}
array = <optimized out>
value = <optimized out>
clear_func = <optimized out>
element_size = <optimized out>
s = 0x7fffe4003260
quark = 392
array = <optimized out>
value = <optimized out>
#5 0x00007ffff78b89b2 in gst_query_get_n_allocation_params (query=query@entry=0x7fffe4004450) at gstquery.c:2003
array = <optimized out>
structure = <optimized out>
__func__ = "gst_query_get_n_allocation_params"
#6 0x00007ffff7b99939 in gst_base_src_decide_allocation_default (basesrc=0x5555558a41a0, query=0x7fffe4004450) at gstbasesrc.c:3148
outcaps = 0x0
pool = 0x7ffff5ed2760
size = 21845
min = 0
max = 0
allocator = 0x7fffeef2eb40
params =
{flags = (GST_MEMORY_FLAG_READONLY | unknown: 8), align = 140737315791691, prefix = 93824994381856, padding = 140737322705423, _gst_reserved = {0x1, 0x555555761020 <std::cout@@GLIBCXX_3.4>, 0x555555761020 <std::cout@@GLIBCXX_3.4>, 0x7ffff5ed2760 <_IO_2_1_stdout_>}}
config = <optimized out>
update_allocator = <optimized out>
__PRETTY_FUNCTION__ = "gst_base_src_decide_allocation_default"
#7 0x000055555555abbd in FooSrc::decide_allocation_vfunc(Glib::RefPtr<Gst::Query> const&) (this=0x5555558a1f90, query=...) at ../src/Foosrc.h:65
newquery = 0x7fffe4004450
retval = false
pushsrc = 0x555555894e80
base = 0x555555894e80
#8 0x00007ffff7537e8b in Gst::BaseSrc_Class::decide_allocation_vfunc_callback(_GstBaseSrc*, _GstQuery*) (self=0x5555558a41a0, query=0x7fffe4004450)
at basesrc.cc:885
obj = 0x5555558a1f90
---Type <return> to continue, or q <return> to quit---
obj_base = <optimized out>
base = <optimized out>
#9 0x00007ffff7b9de24 in gst_base_src_prepare_allocation (caps=0x0, basesrc=0x5555558a41a0) at gstbasesrc.c:3241
bclass = 0x555555895a00
pool = 0x0
allocator = 0x0
params =
{flags = (unknown: 1), align = 140737202285712, prefix = 93824995779792, padding = 140737346381359, _gst_reserved = {0x2500000000, 0x7fffe4001320, 0x0, 0x0}}
result = 1
query = 0x7fffe4004450
caps = 0x0
bclass = <optimized out>
result = <optimized out>
src = ""> buf = 0x0
ret = <optimized out>
position = <optimized out>
eos = 0
blocksize = <optimized out>
pending_events = 0x0
tmp = <optimized out>
__PRETTY_FUNCTION__ = "gst_base_src_loop"
__func__ = "gst_base_src_loop"
#10 0x00007ffff7b9de24 in gst_base_src_negotiate (basesrc=0x5555558a41a0) at gstbasesrc.c:3379
caps = 0x0
bclass = <optimized out>
result = <optimized out>
src = ""> buf = 0x0
ret = <optimized out>
position = <optimized out>
eos = 0
blocksize = <optimized out>
pending_events = 0x0
tmp = <optimized out>
__PRETTY_FUNCTION__ = "gst_base_src_loop"
__func__ = "gst_base_src_loop"
#11 0x00007ffff7b9de24 in gst_base_src_loop (pad=0x5555558a6180) at gstbasesrc.c:2792
src = ""> buf = 0x0
ret = <optimized out>
position = <optimized out>
eos = 0
---Type <return> to continue, or q <return> to quit---
blocksize = <optimized out>
pending_events = 0x0
tmp = <optimized out>
__PRETTY_FUNCTION__ = "gst_base_src_loop"
__func__ = "gst_base_src_loop"
#12 0x00007ffff78d0f59 in gst_task_func (task=0x5555558b64d0) at gsttask.c:332
lock = 0x5555558a61f0
tself = 0x5555558d6720
priv = 0x5555558b6480
__PRETTY_FUNCTION__ = "gst_task_func"
#13 0x00007ffff67107d0 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00007ffff670fe05 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007ffff64846db in start_thread (arg=0x7fffeef2f700) at pthread_create.c:463
pd = 0x7fffeef2f700
now = <optimized out>
unwind_buf =
{cancel_jmp_buf = {{jmp_buf = {140737202288384, 6702658702322279373, 140737202286208, 0, 93824995911456, 140737488343936, -6702625674632780851, -6702680043168095283}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = "" = 0x0, cleanup = 0x0, canceltype = 0}}}
not_first_call = <optimized out>
#16 0x00007ffff5c0788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95