mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-30 01:39:20 +00:00
fix fantastic bug in msfilter.c about type checking.
also in method definition in msrtp.h git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@514 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
parent
9b99da8840
commit
7fde5aa0f4
7 changed files with 74 additions and 20 deletions
|
|
@ -33,6 +33,10 @@
|
|||
#include <linphonecore.h>
|
||||
#include "linphonec.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Forward declarations
|
||||
|
|
@ -64,6 +68,7 @@ static int lpc_cmd_unregister(LinphoneCore *, char *);
|
|||
static int lpc_cmd_duration(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_status(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_ports(LinphoneCore *lc, char *args);
|
||||
static int lpc_cmd_speak(LinphoneCore *lc, char *args);
|
||||
|
||||
/* Command handler helpers */
|
||||
static void linphonec_proxy_add(LinphoneCore *lc);
|
||||
|
|
@ -181,6 +186,11 @@ LPC_COMMAND commands[] = {
|
|||
{ "ports", lpc_cmd_ports, "Network ports configuration",
|
||||
"'ports' \t: prints current used ports.\n"
|
||||
"'ports sip <port number>'\t: Sets the sip port.\n" },
|
||||
{ "speak", lpc_cmd_speak, "Speak a sentence using espeak TTS engine",
|
||||
"This feature is available only in file mode. (see 'help soundcard')\n"
|
||||
"'speak <voice name> <sentence>' : speak a text using the specified espeak voice.\n"
|
||||
"Example for english voice: 'speak default Hello my friend !'"
|
||||
},
|
||||
{ (char *)NULL, (lpc_cmd_handler)NULL, (char *)NULL, (char *)NULL }
|
||||
};
|
||||
|
||||
|
|
@ -1455,6 +1465,30 @@ static int lpc_cmd_ports(LinphoneCore *lc, char *args)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int lpc_cmd_speak(LinphoneCore *lc, char *args){
|
||||
#ifndef WIN32
|
||||
char voice[64];
|
||||
char *sentence;
|
||||
char cl[128];
|
||||
char *wavfile;
|
||||
int status;
|
||||
memset(voice,0,sizeof(voice));
|
||||
sscanf(args,"%s63",voice);
|
||||
sentence=args+strlen(voice);
|
||||
wavfile=tempnam("/tmp/","linphonec-espeak-");
|
||||
snprintf(cl,sizeof(cl),"espeak -v %s -w %s \"%s\"",voice,wavfile,sentence);
|
||||
status=system(cl);
|
||||
if (WEXITSTATUS(status)==0){
|
||||
linphone_core_set_play_file(lc,wavfile);
|
||||
}else{
|
||||
linphonec_out("espeak command failed.");
|
||||
}
|
||||
#else
|
||||
linphonec_out("Sorry, this command is not implemented in windows version.");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* Command table management funx
|
||||
|
|
|
|||
|
|
@ -10,15 +10,15 @@
|
|||
<projectname>linphone</projectname>
|
||||
<projectdirectory>.</projectdirectory>
|
||||
<absoluteprojectpath>false</absoluteprojectpath>
|
||||
<description></description>
|
||||
<defaultencoding></defaultencoding>
|
||||
<description/>
|
||||
<defaultencoding/>
|
||||
</general>
|
||||
<kdevcustomproject>
|
||||
<run>
|
||||
<directoryradio>executable</directoryradio>
|
||||
<mainprogram>/home/smorlat/sources/git/linphone/linphone</mainprogram>
|
||||
<programargs></programargs>
|
||||
<globaldebugarguments></globaldebugarguments>
|
||||
<programargs/>
|
||||
<globaldebugarguments/>
|
||||
<globalcwd>/home/smorlat/sources/git/linphone/linphone</globalcwd>
|
||||
<useglobalprogram>false</useglobalprogram>
|
||||
<terminal>false</terminal>
|
||||
|
|
@ -390,13 +390,13 @@
|
|||
</blacklist>
|
||||
<build>
|
||||
<buildtool>make</buildtool>
|
||||
<builddir></builddir>
|
||||
<builddir/>
|
||||
</build>
|
||||
<other>
|
||||
<prio>0</prio>
|
||||
<otherbin></otherbin>
|
||||
<defaulttarget></defaulttarget>
|
||||
<otheroptions></otheroptions>
|
||||
<otherbin/>
|
||||
<defaulttarget/>
|
||||
<otheroptions/>
|
||||
<selectedenvironment>default</selectedenvironment>
|
||||
<environments>
|
||||
<default/>
|
||||
|
|
@ -407,9 +407,9 @@
|
|||
<numberofjobs>0</numberofjobs>
|
||||
<prio>0</prio>
|
||||
<dontact>false</dontact>
|
||||
<makebin></makebin>
|
||||
<defaulttarget></defaulttarget>
|
||||
<makeoptions></makeoptions>
|
||||
<makebin/>
|
||||
<defaulttarget/>
|
||||
<makeoptions/>
|
||||
<selectedenvironment>default</selectedenvironment>
|
||||
<environments>
|
||||
<default/>
|
||||
|
|
@ -418,11 +418,11 @@
|
|||
</kdevcustomproject>
|
||||
<kdevdebugger>
|
||||
<general>
|
||||
<dbgshell></dbgshell>
|
||||
<gdbpath></gdbpath>
|
||||
<configGdbScript></configGdbScript>
|
||||
<runShellScript></runShellScript>
|
||||
<runGdbScript></runGdbScript>
|
||||
<dbgshell/>
|
||||
<gdbpath/>
|
||||
<configGdbScript/>
|
||||
<runShellScript/>
|
||||
<runGdbScript/>
|
||||
<breakonloadinglibs>true</breakonloadinglibs>
|
||||
<separatetty>false</separatetty>
|
||||
<floatingtoolbar>false</floatingtoolbar>
|
||||
|
|
@ -525,7 +525,7 @@
|
|||
<includePaths>.;</includePaths>
|
||||
</codecompletion>
|
||||
<creategettersetter>
|
||||
<prefixGet></prefixGet>
|
||||
<prefixGet/>
|
||||
<prefixSet>set</prefixSet>
|
||||
<prefixVariable>m_,_</prefixVariable>
|
||||
<parameterName>theValue</parameterName>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ struct _AudioStream
|
|||
MSFilter *dtmfgen;
|
||||
MSFilter *ec;/*echo canceler*/
|
||||
MSFilter *volsend,*volrecv; /*MSVolumes*/
|
||||
MSFilter *resampler;
|
||||
uint64_t last_packet_count;
|
||||
time_t last_packet_time;
|
||||
EchoLimiterType el_type; /*use echo limiter: two MSVolume, measured input level controlling local output level*/
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define MS_RTP_SEND_UNMUTE_MIC MS_FILTER_METHOD_NO_ARG(MS_RTP_SEND_ID,4)
|
||||
|
||||
#define MS_RTP_SEND_SET_RELAY_SESSION_ID MS_FILTER_METHOD(MS_RTP_RECV_ID,5,const char *)
|
||||
#define MS_RTP_SEND_SET_RELAY_SESSION_ID MS_FILTER_METHOD(MS_RTP_SEND_ID,5,const char *)
|
||||
|
||||
|
||||
extern MSFilterDesc ms_rtp_send_desc;
|
||||
|
|
|
|||
|
|
@ -220,6 +220,7 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
|
|||
if (captcard!=NULL) stream->soundread=ms_snd_card_create_reader(captcard);
|
||||
else {
|
||||
stream->soundread=ms_filter_new(MS_FILE_PLAYER_ID);
|
||||
stream->resampler=ms_filter_new(MS_RESAMPLE_ID);
|
||||
if (infile!=NULL) audio_stream_play(stream,infile);
|
||||
}
|
||||
if (playcard!=NULL) stream->soundwrite=ms_snd_card_create_writer(playcard);
|
||||
|
|
@ -288,6 +289,8 @@ int audio_stream_start_full(AudioStream *stream, RtpProfile *profile, const char
|
|||
/*sending graph*/
|
||||
ms_connection_helper_start(&h);
|
||||
ms_connection_helper_link(&h,stream->soundread,-1,0);
|
||||
if (stream->resampler)
|
||||
ms_connection_helper_link(&h,stream->resampler,0,0);
|
||||
if (stream->ec)
|
||||
ms_connection_helper_link(&h,stream->ec,1,1);
|
||||
if (stream->volsend)
|
||||
|
|
@ -362,9 +365,16 @@ void audio_stream_set_rtcp_information(AudioStream *st, const char *cname, const
|
|||
|
||||
void audio_stream_play(AudioStream *st, const char *name){
|
||||
if (ms_filter_get_id(st->soundread)==MS_FILE_PLAYER_ID){
|
||||
int from_rate=0, to_rate=0;
|
||||
ms_filter_call_method_noarg(st->soundread,MS_FILE_PLAYER_CLOSE);
|
||||
ms_filter_call_method(st->soundread,MS_FILE_PLAYER_OPEN,(void*)name);
|
||||
ms_filter_call_method_noarg(st->soundread,MS_FILE_PLAYER_START);
|
||||
ms_filter_call_method(st->soundread,MS_FILTER_GET_SAMPLE_RATE,&from_rate);
|
||||
ms_filter_call_method(st->rtpsend,MS_FILTER_GET_SAMPLE_RATE,&to_rate);
|
||||
if (st->resampler){
|
||||
ms_filter_call_method(st->resampler,MS_FILTER_SET_SAMPLE_RATE,&from_rate);
|
||||
ms_filter_call_method(st->resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&to_rate);
|
||||
}
|
||||
}else{
|
||||
ms_error("Cannot play file: the stream hasn't been started with"
|
||||
" audio_stream_start_with_files");
|
||||
|
|
@ -437,6 +447,8 @@ void audio_stream_stop(AudioStream * stream)
|
|||
/*dismantle the outgoing graph*/
|
||||
ms_connection_helper_start(&h);
|
||||
ms_connection_helper_unlink(&h,stream->soundread,-1,0);
|
||||
if (stream->resampler!=NULL)
|
||||
ms_connection_helper_unlink(&h,stream->resampler,0,0);
|
||||
if (stream->ec!=NULL)
|
||||
ms_connection_helper_unlink(&h,stream->ec,1,1);
|
||||
if (stream->volsend!=NULL)
|
||||
|
|
|
|||
|
|
@ -157,13 +157,13 @@ int ms_filter_call_method(MSFilter *f, unsigned int id, void *arg){
|
|||
int i;
|
||||
unsigned int magic=MS_FILTER_METHOD_GET_FID(id);
|
||||
if (magic!=MS_FILTER_BASE_ID && magic!=f->desc->id) {
|
||||
ms_fatal("Bad method definition in filter %s",f->desc->name);
|
||||
ms_fatal("Method type checking failed when calling %u on filter %s",id,f->desc->name);
|
||||
return -1;
|
||||
}
|
||||
for(i=0;methods!=NULL && methods[i].method!=NULL; i++){
|
||||
unsigned int mm=MS_FILTER_METHOD_GET_FID(methods[i].id);
|
||||
if (mm!=f->desc->id && mm!=MS_FILTER_BASE_ID) {
|
||||
ms_fatal("MSFilter method mismatch: bad call.");
|
||||
ms_fatal("Bad method definition on filter %s. fid=%u , mm=%u",f->desc->name,f->desc->id,mm);
|
||||
return -1;
|
||||
}
|
||||
if (methods[i].id==id){
|
||||
|
|
|
|||
|
|
@ -119,6 +119,12 @@ static int sender_set_relay_session_id(MSFilter *f, void*arg){
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sender_get_sr(MSFilter *f, void *arg){
|
||||
SenderData *d = (SenderData *) f->data;
|
||||
*(int*)arg=d->rate;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* the goal of that function is to return a absolute timestamp closest to real time, with respect of given packet_ts, which is a relative to an undefined origin*/
|
||||
static uint32_t get_cur_timestamp(MSFilter * f, uint32_t packet_ts)
|
||||
{
|
||||
|
|
@ -215,6 +221,7 @@ static MSFilterMethod sender_methods[] = {
|
|||
{MS_RTP_SEND_SET_SESSION, sender_set_session},
|
||||
{MS_RTP_SEND_SEND_DTMF, sender_send_dtmf},
|
||||
{MS_RTP_SEND_SET_RELAY_SESSION_ID, sender_set_relay_session_id},
|
||||
{MS_FILTER_GET_SAMPLE_RATE, sender_get_sr },
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue