[Ekiga-list] RTP payload and G729 codec
Jure Petrovic
fonz at siol.net
Fri May 4 17:38:31 UTC 2007
Hello,
I am more or less in a blind street here. My codec advertises
recommended frames per packet(2) and max frames per packet(4), but it
just doesn't use 2 frames per packet for encoding unless I explicitly
force them. However, if I do that, voice is totally scrambled.
On the other hand, decoder is written following the same principle and
it works perfectly (asterisk sends 2 frames per packet).
I listened to Craig's recommendations and I even used part of his code
from gsm codec. Maybe someone will help me, if I attach a piece of code.
This is encoding part:
static int codec_decoder(const struct PluginCodec_Definition * codec,
void * context,
const void * from,
unsigned * fromLen,
void * to,
unsigned * toLen,
unsigned int * flag)
{
//if (!decoderInUse)
// return 0;
// Do we have at least one complete frame to decode?
if (*fromLen < L_FRAME_COMPRESSED || *toLen < SAMPLES_PER_FRAME*2) {
printf("DEBUG::g729codec.c::decoding failed...\n");
return 0;
}
int frames;
frames = MIN(*fromLen/BYTES_PER_FRAME, (*toLen/(SAMPLES_PER_FRAME*2)));
printf("DEBUG::codec_decoder()::frames: %d\n", frames);
*fromLen = frames * BYTES_PER_FRAME;
*toLen = frames * SAMPLES_PER_FRAME * 2;
while (frames-- > 0) {
g729_decode((struct G729STRUCT_DECODE*)context, (char*)from, to);
from = from + BYTES_PER_FRAME;
to = to + SAMPLES_PER_FRAME*2;
}
return 1;
}
Following this code, this is ekiga's output on the console:
[jure at lap myg729]$ ekiga
It appears that you do not have ekiga.server installed in a valid
location. Factory mode disabled.
patch.cxx(301) Patch Added sink
from PCM-16
Clock Rate = 8000
Frame Time = 8
Max Bit Rate = 8000
Max Frame Size = 16
Needs Jitter = 1
Rx Frames Per Packet = 2
Tx Frames Per Packet = 2
to G.729
Clock Rate = 8000
Frame Time = 80
Max Bit Rate = 8000
Max Frame Size = 10
Needs Jitter = 1
Rx Frames Per Packet = 2
Tx Frames Per Packet = 2
DEBUG::g729_encoder_init()::starting init...
DEBUG::g729_encoder_init()::Allocated output buffer: 10
g729codec.c::create_encoder() called!
patch.cxx(301) Patch Added sink
from G.729
Clock Rate = 8000
Frame Time = 80
Max Bit Rate = 8000
Max Frame Size = 10
Needs Jitter = 1
Rx Frames Per Packet = 2
Tx Frames Per Packet = 2
to PCM-16
Clock Rate = 8000
Frame Time = 8
Max Bit Rate = 128000
Max Frame Size = 16
Needs Jitter = 1
Rx Frames Per Packet = 240
Tx Frames Per Packet = 30
g729codec.c::create_decoder() called!
DEBUG::g729_decoder_init()::starting init...
DEBUG::g729_decoder_init()::Allocated output buffer: 160
FIXME
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_decoder()::frames: 2
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_encoder()::frames: 1
DEBUG::codec_decoder()::frames: 2
DEBUG::codec_encoder()::frames: 1
As you can see, decoder accepts 2 frames and decodes them properly.
Encoder gets automatically set to 1 frame. Now, if I force frames=2 in
encoder part, ekiga sends 2 frames in packet but voice is scrambled.
Any ideas?
Regards,
Jure Petrovic
More information about the ekiga-list
mailing list