Basicaly what you need to do is to change the treatment of the
play_pcap_audio|video event in the call.cpp file in the function
executeAction().
This function has the mechanism to prepare the sending of the RTP packets.
It creates a thread with the name media_thread and has a clear condition to
kill any existing thread and start a new one for every pcap_play_* it founds
in your script. So the idea of my implementation is to avoid this behavior
allowing the creation of two threads, one for audio and one for video. Then
the old thread will only be killed if there is already one running for the
same purpose(send audio or video).
I attached a diff, where you can see the changes I did. You can try to apply
it in a 3.2 untouched code(hope it works, havent tried) or make the changes
by yourself based on the file, line number and functions names the diff
gives. It's not that hard!
Patrick
On Wed, May 18, 2011 at 7:23 AM, Shailesh Bansal
<bansal.shail...@gmail.com>wrote:
> Patrick you were right on Linux it is not able to play both streams. Can
> you suggest changes you were talking about I can give it a shot though I
> haven't seen the code till now but I hope I can do it.
>
> ~Shailesh
>
>
> On Wed, May 18, 2011 at 11:44 AM, Shailesh Bansal <
> bansal.shail...@gmail.com> wrote:
>
>> error logs only says:
>>
>> sipp: The following events occured:
>> 2011-05-18 10:35:29:511 1305695129.511447: Automatic response mode
>> for an unexpected INFO, UPDATE or NOTIFY for call:
>> 2e1ac00-263d280a-13c4-5506-12fc-2ddd1856-12fc.
>>
>>
>> and log file is totally empty as I do not write any logs in this case but
>> I get a core dump of around 134MB when I try to look in using gdb it says
>> that its not valid.
>>
>> ~Shailesh
>>
>>
>> On Tue, May 17, 2011 at 6:10 PM, Patrick Wakano <pwak...@gmail.com>wrote:
>>
>>> Interesting, on my debian env I couldnt make it work without changing the
>>> code....
>>>
>>> You can run your test with the option -trace_logs and -trace_err, the
>>> logs and traces will be written in a file.
>>> See http://sipp.sourceforge.net/doc/reference.html#Log+files
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Tue, May 17, 2011 at 9:19 AM, Shailesh Bansal <
>>> bansal.shail...@gmail.com> wrote:
>>>
>>>> I was running this senario in windows and it was working Two play_pcap_*
>>>> were working for windows. What logs can I provide to help you on this for
>>>> now video is my priority so if it stops crashing while playing only video I
>>>> will be more than happy.
>>>>
>>>> Please tell me location of logs and if some specific steps need to be
>>>> taken to get those logs.
>>>>
>>>> ~Shailesh
>>>>
>>>>
>>>> On Tue, May 17, 2011 at 5:32 PM, Patrick Wakano <pwak...@gmail.com>wrote:
>>>>
>>>>> Hi,
>>>>> I never had the crash problem, maybe some log would help....
>>>>> About your second problem, two consecutive calls to play_pcap_* won't
>>>>> work.... By looking in the code, Sipp only uses one thread to send media,
>>>>> so
>>>>> the second call to some play_pcap_* will kill the first....
>>>>> I had the same problem and had to change the sources to make it
>>>>> work.... If you can code I can give you the hints!
>>>>>
>>>>>
>>>>> Patrick
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, May 17, 2011 at 1:29 AM, Shailesh Bansal <
>>>>> bansal.shail...@gmail.com> wrote:
>>>>>
>>>>>>
>>>>>> hi
>>>>>>
>>>>>> I am trying to play video using SIPP on Centos 5.3. But SIPP crashes
>>>>>> after playing video for some time. Though when I try to play both audio
>>>>>> and
>>>>>> video; only audio gets played and SIPP do not crash. Not sure what wrong
>>>>>> am
>>>>>> I doing; attaching call flow used.
>>>>>>
>>>>>> Thanks in advance
>>>>>>
>>>>>> ~Shailesh
>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Achieve unprecedented app performance and reliability
>>>>>> What every C/C++ and Fortran developer should know.
>>>>>> Learn how Intel has extended the reach of its next-generation tools
>>>>>> to help boost performance applications - inlcuding clusters.
>>>>>> http://p.sf.net/sfu/intel-dev2devmay
>>>>>> _______________________________________________
>>>>>> Sipp-users mailing list
>>>>>> Sipp-users@lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/sipp-users
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>
diff -rbwp sipp.svn_3.2_orig/call.cpp sipp.svn/call.cpp
*** sipp.svn_3.2_orig/call.cpp 2010-11-08 11:02:28.000000000 -0200
--- sipp.svn/call.cpp 2011-05-17 09:17:04.322661150 -0300
*************** void call::init(scenario * call_scenario
*** 509,515 ****
memset(&(play_args_a.from), 0, sizeof(struct sockaddr_storage));
memset(&(play_args_v.from), 0, sizeof(struct sockaddr_storage));
hasMediaInformation = 0;
! media_thread = 0;
#endif
peer_tag = NULL;
--- 509,516 ----
memset(&(play_args_a.from), 0, sizeof(struct sockaddr_storage));
memset(&(play_args_v.from), 0, sizeof(struct sockaddr_storage));
hasMediaInformation = 0;
! audio_media_thread = 0;
! video_media_thread = 0;
#endif
peer_tag = NULL;
*************** call::~call()
*** 625,633 ****
}
# ifdef PCAPPLAY
! if (media_thread != 0) {
! pthread_cancel(media_thread);
! pthread_join(media_thread, NULL);
}
#endif
--- 626,638 ----
}
# ifdef PCAPPLAY
! if (audio_media_thread != 0) {
! pthread_cancel(audio_media_thread);
! pthread_join(audio_media_thread, NULL);
! }
! if (video_media_thread != 0) {
! pthread_cancel(video_media_thread);
! pthread_join(video_media_thread, NULL);
}
#endif
*************** call::T_ActionResult call::executeAction
*** 3804,3827 ****
from->sin_family = AF_INET;
from->sin_addr.s_addr = inet_addr(media_ip);
}
- /* Create a thread to send RTP packets */
- pthread_attr_t attr;
- pthread_attr_init(&attr);
#ifndef PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN 16384
#endif
//pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
! if (media_thread != 0) {
// If a media_thread is already active, kill it before starting a new one
! pthread_cancel(media_thread);
! pthread_join(media_thread, NULL);
! media_thread = 0;
}
! int ret = pthread_create(&media_thread, &attr, send_wrapper,
! (void *) play_args);
if(ret)
ERROR("Can create thread to send RTP packets");
pthread_attr_destroy(&attr);
#endif
} else {
ERROR("call::executeAction unknown action");
--- 3816,3855 ----
from->sin_family = AF_INET;
from->sin_addr.s_addr = inet_addr(media_ip);
}
#ifndef PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN 16384
#endif
+ if (currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_AUDIO) {
+ /* Create a thread to send RTP packets */
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
+ //pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
+ if (audio_media_thread != 0) {
+ // If a media_thread is already active, kill it before starting a new one
+ pthread_cancel(audio_media_thread);
+ pthread_join(audio_media_thread, NULL);
+ audio_media_thread = 0;
+ }
+ int ret = pthread_create(&audio_media_thread, &attr, send_wrapper, (void *) play_args);
+ if(ret)
+ ERROR("Can create thread to send RTP packets");
+ pthread_attr_destroy(&attr);
+ } else if (currentAction->getActionType() == CAction::E_AT_PLAY_PCAP_VIDEO) {
+ /* Create a thread to send RTP packets */
+ pthread_attr_t attr;
+ pthread_attr_init(&attr);
//pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
! if (video_media_thread != 0) {
// If a media_thread is already active, kill it before starting a new one
! pthread_cancel(video_media_thread);
! pthread_join(video_media_thread, NULL);
! video_media_thread = 0;
}
! int ret = pthread_create(&video_media_thread, &attr, send_wrapper, (void *) play_args);
if(ret)
ERROR("Can create thread to send RTP packets");
pthread_attr_destroy(&attr);
+ }
#endif
} else {
ERROR("call::executeAction unknown action");
diff -rbwp sipp.svn_3.2_orig/call.hpp sipp.svn/call.hpp
*** sipp.svn_3.2_orig/call.hpp 2009-04-15 09:10:03.000000000 -0300
--- sipp.svn/call.hpp 2011-05-16 17:29:53.394667870 -0300
*************** private:
*** 165,171 ****
#ifdef PCAPPLAY
int hasMediaInformation;
! pthread_t media_thread;
play_args_t play_args_a;
play_args_t play_args_v;
#endif
--- 165,172 ----
#ifdef PCAPPLAY
int hasMediaInformation;
! pthread_t audio_media_thread;
! pthread_t video_media_thread;
play_args_t play_args_a;
play_args_t play_args_v;
#endif
diff -rbwp sipp.svn_3.2_orig/send_packets.c sipp.svn/send_packets.c
*** sipp.svn_3.2_orig/send_packets.c 2009-05-28 08:01:17.000000000 -0300
--- sipp.svn/send_packets.c 2011-04-26 09:33:20.213255503 -0300
*************** void send_packets_cleanup(void *arg)
*** 125,131 ****
int
send_packets (play_args_t * play_args)
{
! int ret, sock, port_diff;
pcap_pkt *pkt_index, *pkt_max;
uint16_t *from_port, *to_port;
struct timeval didsleep = { 0, 0 };
--- 125,131 ----
int
send_packets (play_args_t * play_args)
{
! int ret, sock, port_diff, len;
pcap_pkt *pkt_index, *pkt_max;
uint16_t *from_port, *to_port;
struct timeval didsleep = { 0, 0 };
*************** send_packets (play_args_t * play_args)
*** 149,154 ****
--- 149,155 ----
if (sock < 0) {
ERROR("Can't create raw socket (need to run as root?)");
}
+ len = sizeof(struct sockaddr_in6);
from_port = &(((struct sockaddr_in6 *)(void *) from )->sin6_port);
to_port = &(((struct sockaddr_in6 *)(void *) to )->sin6_port);
}
*************** send_packets (play_args_t * play_args)
*** 157,166 ****
--- 158,172 ----
if (sock < 0) {
ERROR("Can't create raw socket (need to run as root?)");
}
+ len = sizeof(struct sockaddr_in);
from_port = &(((struct sockaddr_in *)(void *) from )->sin_port);
to_port = &(((struct sockaddr_in *)(void *) to )->sin_port);
}
+ if((ret = bind(sock, ((struct sockaddr *)(void *)from), len))) {
+ WARNING("Can't bind IP %s", inet_ntoa(((struct sockaddr_in *)(void *) from )->sin_addr));
+ }
+
#ifndef MSG_DONTWAIT
fd_flags = fcntl(sock, F_GETFL , NULL);
fd_flags |= O_NONBLOCK;
------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its
next-generation tools to help Windows* and Linux* C/C++ and Fortran
developers boost performance applications - including clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users