Hi Vadim,
I think some small modifications like:
static int sender_set_session(MSFilter * f, void *arg)
{
SenderData *d = (SenderData *) f->data;
RtpSession *s = (RtpSession *) arg;
PayloadType *pt =
rtp_profile_get_payload(rtp_session_get_profile(s),
rtp_session_get_send_payload_type(s));
if (pt != NULL) {
if
(strcasecmp(pt->mime_type,"g722")==0)
d->rate=8000;
else d->rate =
pt->clock_rate;
} else {
ms_warning("Sending undefined payload type ?");
}
d->session = s;
return 0;
}
static int receiver_set_session(MSFilter * f, void *arg)
{
ReceiverData *d = (ReceiverData *) f->data;
RtpSession *s = (RtpSession *) arg;
PayloadType *pt =
rtp_profile_get_payload(rtp_session_get_profile(s),
rtp_session_get_recv_payload_type
(s));
if (pt != NULL) {
if
(strcasecmp(pt->mime_type,"g722")==0)
d->rate=8000;
else d->rate =
pt->clock_rate;
} else {
ms_warning("Receiving undefined payload type ?");
}
d->session = s;
return 0;
}
Assuming the g722 encoder increments its timestamp by 160 each
time it processes 320 samples of pcm data, this should work.
Do you agree ?
Simon
>
> The desire to keep stable ABI is very good reason to avoid
changing
> payload type.
>
> However it seems that modifciations of of msrtp.c becomes
somewhat more
> complicated than
> you think.
>
>
> First of all when sending (line 223 at msrtp.c) we need to do
something
> like:
>
> / if (pt == g722_pt)
> timestamp /= 2;/
>
> Then when receiving, in addition fo 'reading' 8000 instead of
16000 from
> the payload descriptor we need to
> do something like in receiver_process:
>
> / while ((m = rtp_session_recvm_with_ts(d->session,
timestamp)) !=
> NULL) {
> uint32_t pkttstamp = rtp_get_timestamp(m);
> int pt = rtp_get_payload_type(m);
>
> if (pt == g722_pt)
> pkttstamp *= 2;
>
> mblk_set_timestamp_info(m, pkttstamp);
> mblk_set_marker_info(m, rtp_get_markbit(m));
> mblk_set_payload_type(m, pt);
> rtp_get_payload(m,&m->b_rptr);
> ms_queue_put(f->outputs[0], m);
> }
> /
>
> Any comments?
>
> BTW the g722_pt could have different values for send and
receive
> directions, but this
> is a general problem in mediastreamer --- even if oRtp is
able to
> function with different profiles for each direction
> mediastreamer2 and linphone does not support it
>
> Thanks
> Vadim
>
> > Simon
> >
> > Le Wednesday 28 January 2009 19:30:56 Vadim Lebedev,
vous avez écrit :
> >> Hello,
> >>
> >> We've a following interop problem with G722 codec:
> >>
> >> Because of historical reasons the relevant RTP RFC
speicifies that
> >> when using G722 payload
> >> RTP TIMESTAMP should be incremented with 8KHZ
frequency even if the
> >> REAL sampling rate
> >> is 16KHZ.
> >>
> >> As you understand msrtp.c filter is unable to handle
this situation,
> >> so we've been thinking about possible enchancements.
> >>
> >> One idea that comes to mind is to add a 'rtp_rate'
field to Payloadtype
> >> structure , and if it is non zero and different from
sampling rate to
> >> compute adjustement (divider or multiplier) to rtp
time stamp.
> >>
> >> Any comments on this approach?
> >>
> >>
> >> Thanks
> >> Vadim
> >>
> >>
> >>
> >> _______________________________________________
> >> Linphone-developers mailing list
> >> address@hidden
> >>
http://lists.nongnu.org/mailman/listinfo/linphone-developers