[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Linphone-developers] ptime handling
From: |
Simon Morlat |
Subject: |
Re: [Linphone-developers] ptime handling |
Date: |
Thu, 09 Sep 2010 21:24:17 +0200 |
Thanks for noticing the inconsistency. However your patch breaks
MS_FILTER_ADD_FMTP. Indeed a fmtp is supposed to be given as ptime=XX
while attributes are ptime:XX.
So I rewrote a bit your patch and commited.
Simon
Le mercredi 08 septembre 2010 à 17:05 +0200, Vadim Lebedev a écrit :
> 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 mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/linphone-developers