Framework: Media Server Kurento < /li>
< /ul>
0:00:19.635646312 [35m790342[00m 0x79d0d8001150 [36mINFO [00m [00;01;37;41m GST_ELEMENT_PADS gstelement.c
0:00:19.635664077 [35m790342[00m 0x79d0d8001150 [36mINFO [00m [00;01;31;44m GST_PADS gstpad.c
0:00:19.635688821 [35m790342[00m 0x79d0d8001150 [36mINFO [00m [00;01;31;44m GST_PADS gstpad.c
0:00:19.635700218 [35m790342[00m 0x79d0d8001150 [36mINFO [00m [00;01;31;44m GST_PADS gstpad.c
Pankaj Capsfilter link also failed (-4)
< /code>
реализация: < /p>
GstElement *dtmfdepay =
kms_utils_element_factory_make ("rtpdtmfdepay", "dtmfdepay");
GstElement *fake = kms_utils_element_factory_make ("fakesink", PLUGIN_NAME);
if (!dtmfdepay || !fake) {
GST_ERROR_OBJECT (self, "Failed to create dtmfdepay or fakesink");
goto end;
}
// Configure fakesink
g_object_set (fake, "async", FALSE, "sync", FALSE, "silent", TRUE, NULL);
// Add elements to bin BEFORE linking
gst_bin_add_many (GST_BIN (self), dtmfdepay, fake, NULL);
// Set elements to READY state to allow pad queries
gst_element_set_state (dtmfdepay, GST_STATE_READY);
gst_element_set_state (fake, GST_STATE_READY);
// Get the sink pad from dtmfdepay
GstPad *dtmf_sinkpad = gst_element_get_static_pad (dtmfdepay, "sink");
if (!dtmf_sinkpad) {
GST_ERROR_OBJECT (self, "Failed to get dtmfdepay sink pad");
gst_bin_remove_many (GST_BIN (self), dtmfdepay, fake, NULL);
goto end;
}
// Check what caps dtmfdepay can accept
GstCaps *dtmf_caps = gst_pad_query_caps (dtmf_sinkpad, NULL);
gchar *dtmf_caps_str = gst_caps_to_string (dtmf_caps);
g_print ("Pankaj DTMF depay accepts: %s\n", dtmf_caps_str);
g_free (dtmf_caps_str);
gst_caps_unref (dtmf_caps);
// Try to link rtpbin pad directly to dtmfdepay
GstPadLinkReturn link_result = gst_pad_link (pad, dtmf_sinkpad);
gst_object_unref (dtmf_sinkpad);
if (link_result != GST_PAD_LINK_OK) {
g_print ("Pankaj Direct link failed (%d), trying with capsfilter\n",
link_result);
// Remove elements and try with capsfilter
gst_bin_remove_many (GST_BIN (self), dtmfdepay, fake, NULL);
// Create capsfilter approach
GstElement *capsfilter =
gst_element_factory_make ("capsfilter", "dtmf_capsfilter");
dtmfdepay = kms_utils_element_factory_make ("rtpdtmfdepay", "dtmfdepay");
fake = kms_utils_element_factory_make ("fakesink", PLUGIN_NAME);
if (!capsfilter || !dtmfdepay || !fake) {
GST_ERROR_OBJECT (self,
"Failed to create elements for capsfilter approach");
goto end;
}
g_object_set (fake, "async", FALSE, "sync", FALSE, "silent", TRUE, NULL);
// Try different caps variants that might work
GstCaps *filter_caps;
// Option 1: Keep original caps but fix encoding-name
if (g_strrstr (caps_str, "clock-rate=(int)8000")) {
filter_caps = gst_caps_from_string (
"application/x-rtp, media=audio, encoding-name=TELEPHONE-EVENT, payload=101, clock-rate=8000");
} else {
// Option 2: More flexible caps
filter_caps = gst_caps_from_string (
"application/x-rtp, encoding-name=TELEPHONE-EVENT, payload=101");
}
g_object_set (capsfilter, "caps", filter_caps, NULL);
gst_caps_unref (filter_caps);
// Add elements to bin
gst_bin_add_many (GST_BIN (self), capsfilter, dtmfdepay, fake, NULL);
// Set to READY state
gst_element_set_state (capsfilter, GST_STATE_READY);
gst_element_set_state (dtmfdepay, GST_STATE_READY);
gst_element_set_state (fake, GST_STATE_READY);
// Link capsfilter -> dtmfdepay -> fakesink first
if (!gst_element_link_many (capsfilter, dtmfdepay, fake, NULL)) {
GST_ERROR_OBJECT (self,
"Failed to link capsfilter -> dtmfdepay -> fakesink");
gst_bin_remove_many (GST_BIN (self), capsfilter, dtmfdepay, fake, NULL);
goto end;
}
// Now link rtpbin pad to capsfilter
GstPad *capsfilter_sinkpad =
gst_element_get_static_pad (capsfilter, "sink");
link_result = gst_pad_link (pad, capsfilter_sinkpad);
gst_object_unref (capsfilter_sinkpad);
if (link_result != GST_PAD_LINK_OK) {
g_print ("Pankaj Capsfilter link also failed (%d)\n", link_result);
GST_ERROR_OBJECT (self, "Failed to link rtpbin pad to capsfilter");
gst_bin_remove_many (GST_BIN (self), capsfilter, dtmfdepay, fake, NULL);
goto end;
}
// Sync state with parent
gst_element_sync_state_with_parent (capsfilter);
gst_element_sync_state_with_parent (dtmfdepay);
gst_element_sync_state_with_parent (fake);
} else {
g_print ("Pankaj Direct link successful!\n");
// Link dtmfdepay to fakesink
if (!gst_element_link (dtmfdepay, fake)) {
GST_ERROR_OBJECT (self, "Failed to link dtmfdepay to fakesink");
gst_bin_remove_many (GST_BIN (self), dtmfdepay, fake, NULL);
goto end;
}
// Sync state with parent
gst_element_sync_state_with_parent (dtmfdepay);
gst_element_sync_state_with_parent (fake);
}
< /code>
Все попытки связывания не удастся с: < /p>
caps are incompatible
link between rtpbin1:recv_rtp_src_0_1147121133_101 and dtmfdepay_rtpdtmfdepay0:sink failed: no common format
< /code>
debug output: < /p>
rtpbin pad caps:
Pankaj Pad caps: application/x-rtp, media=(string)audio, encoding-name=(string)telephone-event, payload=(int)101, clock-rate=(int)8000
After case conversion for capsfilter:
Pankaj Converting encoding-name from 'telephone-event' to 'TELEPHONE-EVENT'
Pankaj Using filter caps: application/x-rtp, media=(string)audio, encoding-name=(string)TELEPHONE-EVENT, payload=(int)101, clock-rate=(int)8000
< /code>
Журналы ошибок: < /p>
INFO GST_PADS gstpad.c
INFO GST_PADS gstpad.c
INFO GST_PADS gstpad.c
Подробнее здесь: https://stackoverflow.com/questions/797 ... in-kurento
Мобильная версия