How to use rtpdtmfdepay from gstreamer
amar
asontakke at phonologies.com
Thu Oct 31 12:02:32 CET 2013
Hi Olivier,
I have written a C code to catch rtp DTMF event. I am able to catch the
GST_MESSAGE_ELEMENT from my bus. I am using rtpdtmfdepay for the above
opration. But as pipeline get the DTMF RTP EVENT it throws a segmentation
fault due to SIGFPE (floating point exception ). I tried to debug this with
gdb but not getting any success for resolving the problem. I am giving my
code and back-trace of the problem. Please look at once, what is going
wrong ?
I am using the followimg code to catch RTP DTMF Event :
***********************************************************************************
#include <gst/gst.h>
static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data)
{
GMainLoop *loop = (GMainLoop *) data;
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_EOS:
g_print ("End of stream\n");
g_main_loop_quit (loop);
break;
case GST_MESSAGE_ERROR:{
gchar *debug;
GError *error;
gst_message_parse_error (msg, &error, &debug);
g_free (debug);
g_printerr ("Error: %s\n", error->message);
g_error_free (error);
g_main_loop_quit (loop);
break;
}
case GST_MESSAGE_ELEMENT:
g_print("**************Getting GST_MESSAGE_ELEMENT*************\n");
break;
default:
break;
}
}
int main (int argc, char *argv[])
{
GMainLoop *loop;
GstElement *pipeline, *asource, *acapsfilter, *pcmurtpdepay, *sink;
GstBus *bus;
guint bus_watch_id;
GstCaps *caps;
/* Initialisation */
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
/* Create gstreamer elements */
pipeline = gst_pipeline_new ("av-recorder");
asource = gst_element_factory_make ("udpsrc", "aud-source");
acapsfilter = gst_element_factory_make ("capsfilter", "audio-caps");
pcmurtpdepay = gst_element_factory_make ("rtpdtmfdepay", "artpdepay");
sink = gst_element_factory_make ("filesink", "file-output");
if (!pipeline || !asource || !acapsfilter || !pcmurtpdepay || !sink) {
g_printerr ("One element could not be created. Exiting.\n");
return -1;
}
g_object_set (G_OBJECT (asource), "port", 3333, NULL);
g_object_set (G_OBJECT (sink), "location", "event", NULL);
caps =
gst_caps_from_string("application/x-rtp,encoding-name=TELEPHONE-EVENT,payload=101,media=(string)audio,
clock-rate=(int)0");
g_object_set (G_OBJECT (acapsfilter), "caps", caps, NULL);
gst_caps_unref (caps);
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
bus_watch_id = gst_bus_add_watch (bus, bus_call, loop);
gst_object_unref (bus);
gst_bin_add_many (GST_BIN (pipeline),
asource, acapsfilter, pcmurtpdepay,
sink, NULL);
gst_element_link_many (asource, acapsfilter, pcmurtpdepay, sink, NULL);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print ("Recording (or not!)...\n");
g_main_loop_run (loop);
g_print ("Returned, stopping recording\n");
gst_element_set_state (pipeline, GST_STATE_NULL);
g_print ("Deleting pipeline\n");
gst_object_unref (GST_OBJECT (pipeline));
g_source_remove (bus_watch_id);
g_main_loop_unref (loop);
return 0;
}
*********************************************************************************************
Following is a back-trace from gdb :
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
[amar at localhost gstreamer]$ gdb ./tele_event
GNU gdb (GDB) Fedora (7.6-30.fc19)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html
>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/amar/gstreamer/tele_event...(no debugging
symbols found)...done.
(gdb) run event
Starting program: /home/amar/gstreamer/tele_event event
Traceback (most recent call last):
File "/usr/share/gdb/auto-load/usr/lib/libgobject-2.0.so.0.3600.3-gdb.py",
line 9, in <module>
from gobject import register
File "/usr/share/glib-2.0/gdb/gobject.py", line 3, in <module>
import gdb.backtrace
ImportError: No module named backtrace
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
[New Thread 0xb7d4db40 (LWP 5999)]
Recording (or not!)...
**************Getting GST_MESSAGE_ELEMENT*************
Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 0xb7d4db40 (LWP 5999)]
0xb7de0743 in __divdi3 () from /usr/lib/gstreamer-1.0/libgstdtmf.so
(gdb) bt
#0 0xb7de0743 in __divdi3 () from /usr/lib/gstreamer-1.0/libgstdtmf.so
#1 0xb7ddee04 in gst_dtmf_src_generate_tone (payload=...,
rtpdtmfdepay=0x816e0f8) at gstrtpdtmfdepay.c:356
#2 gst_rtp_dtmf_depay_process (depayload=0x816e0f8, buf=0x81746f0) at
gstrtpdtmfdepay.c:506
#3 0xb7d5d11c in gst_rtp_base_depayload_chain (pad=0x81624e0,
parent=0x816e0f8, in=0x81746f0)
at gstrtpbasedepayload.c:353
#4 0x449cf222 in gst_pad_chain_data_unchecked (data=0x81746f0,
type=<optimized out>, pad=0x81624e0)
at gstpad.c:3655
#5 gst_pad_push_data (pad=0x81623a8, type=type at entry=4112, data=0x81746f0)
at gstpad.c:3872
#6 0x449d671f in gst_pad_push (pad=0x81746f0, buffer=0x81746f0) at
gstpad.c:3975
#7 0x43a8dd0d in gst_base_transform_chain (pad=0x8162270,
parent=0x816c1b8, buffer=0x81746f0)
at gstbasetransform.c:2212
#8 0x449cf222 in gst_pad_chain_data_unchecked (data=0x81746f0,
type=<optimized out>, pad=0x8162270)
at gstpad.c:3655
#9 gst_pad_push_data (pad=0x8162138, type=type at entry=4112, data=0x81746f0)
at gstpad.c:3872
#10 0x449d671f in gst_pad_push (pad=0x81746f0, pad at entry=0x8162138,
buffer=0x81746f0) at gstpad.c:3975
#11 0x43a843bf in gst_base_src_loop (pad=0x8162138) at gstbasesrc.c:2726
#12 0x449fffc8 in gst_task_func (task=task at entry=0x8174010) at gsttask.c:316
#13 0x44a00f70 in default_func (tdata=0x81661e0, pool=0x805cc10) at
gsttaskpool.c:70
#14 0x4f28b475 in g_thread_pool_thread_proxy (data=0x805c8d0) at
gthreadpool.c:309
#15 0x4f28a96b in g_thread_proxy (data=0x8055780) at gthread.c:798
#16 0x4f1089da in start_thread (arg=0xb7d4db40) at pthread_create.c:308
#17 0x4f038c0e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:131
(gdb) f 0
#0 0xb7de0743 in __divdi3 () from /usr/lib/gstreamer-1.0/libgstdtmf.so
(gdb) info local
No symbol table info available.
(gdb) info locals
No symbol table info available.
(gdb) info args
No symbol table info available.
(gdb) info threads
Id Target Id Frame
* 2 Thread 0xb7d4db40 (LWP 5999) "aud-source:src" 0xb7de0743 in __divdi3
()
from /usr/lib/gstreamer-1.0/libgstdtmf.so
1 Thread 0xb7fe66c0 (LWP 5995) "tele_event" 0xb7fff424 in
__kernel_vsyscall ()
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Thanks,
Amar.
On Wed, Oct 30, 2013 at 4:08 PM, Olivier Crête
<olivier.crete at collabora.com>wrote:
> Hi,
>
> On Wed, 2013-10-30 at 15:09 +0530, amar wrote:
> > Thank you for giving response to my query.
> > Please can you give me any example for grepping the DTMF event from
> > rtpdtmfdepay.
> >
> > I am unable to catch the DTMF event from messege bus. How to catch the
> > DTMF event from GstMessege ?
>
> You should receive a message of type GST_MESSAGE_ELEMENT. This only
> works if you receive DTMF as RTP telephone-event messages, if you
> receive the DTMF as sound, you need to use the dtmfdetect element from
> the spandsp plugin. This element will also emit the same messages where
> it gets DTMF sound.
>
> --
> Olivier Crête
> olivier.crete at collabora.com
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131031/c54f3748/attachment-0001.html>
More information about the gstreamer-devel
mailing list