[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Linphone-developers] ptime handling
From: |
Vadim Lebedev |
Subject: |
[Linphone-developers] ptime handling |
Date: |
Wed, 08 Sep 2010 17:05:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100713 Lightning/1.0b2pre Thunderbird/3.0.6 |
I see that there is some inconsistency in 'ptime" handling in various
codecs.
Some of them handle it using MS_FILTER_ADD_ATTR method and others using
MS_FILTER_ADD_FMTP method....
So here is the fix that allows both methods to wokr for GSM and SPEEX codecs
Thanks
Vadim
=====================================
diff -r 382d1e675c27 src/gsm.c
--- a/src/gsm.c Tue Sep 07 11:35:21 2010 +0200
+++ b/src/gsm.c Wed Sep 08 16:56:22 2010 +0200
@@ -36,19 +36,21 @@
MSBufferizer *bufferizer;
} EncState;
-static int enc_add_fmtp(MSFilter *f, void *arg){
+static int enc_add_attr(MSFilter *f, void *arg){
const char *fmtp=(const char *)arg;
EncState *s=(EncState*)f->data;
- char tmp[30];
- if (fmtp_get_value(fmtp,"ptime",tmp,sizeof(tmp))){
- int ptime = atoi(tmp);
+
+ if (strstr(fmtp,"ptime")!=NULL){
+ int ptime = atoi(fmtp+6);
switch (ptime) {
case 20:
case 40:
case 60:
case 80:
case 100:
- s->ptime = atoi(tmp);
+ case 120:
+ case 140:
+ s->ptime = ptime;
break;
default:
ms_warning("MSGsmEnc: unsupported ptime [%i] using
default",ptime);
@@ -58,6 +60,11 @@
return 0;
}
+static int enc_add_fmtp(MSFilter *f, void *arg){
+
+ return enc_add_attr(f, arg);
+}
+
static void enc_init(MSFilter *f){
EncState *s=(EncState *)ms_new(EncState,1);
s->state=gsm_create();
@@ -104,6 +111,7 @@
}
static MSFilterMethod enc_methods[]={
{ MS_FILTER_ADD_FMTP , enc_add_fmtp},
+ { MS_FILTER_ADD_ATTR , enc_add_attr},
{ 0 , NULL }
};
diff -r 382d1e675c27 src/msspeex.c
--- a/src/msspeex.c Tue Sep 07 11:35:21 2010 +0200
+++ b/src/msspeex.c Wed Sep 08 16:56:22 2010 +0200
@@ -259,11 +259,16 @@
return 0;
}
+static int enc_add_attr(MSFilter *f, void *arg);
+
static int enc_add_fmtp(MSFilter *f, void *arg){
char buf[64];
const char *fmtp=(const char *)arg;
SpeexEncState *s=(SpeexEncState*)f->data;
+ if (strstr(fmtp, "ptime:"))
+ enc_add_attr(f, arg);
+
memset(buf, '\0', sizeof(buf));
fmtp_get_value(fmtp, "vbr", buf, sizeof(buf));
if (buf[0]=='\0'){
- [Linphone-developers] ptime handling,
Vadim Lebedev <=