Niclas Gustafsson
2003-May-09 06:11 UTC
[Asterisk-Users] OH323 Channel Driver buffer sizes
Hello! Anyone with some insight into the oh323 channel driver please shed some light on the code block below from wrapendpoint.cxx. When enabling trace on the channel driver i get this, for me, strange debug info: WrapH323EndPoint::OpenAudioChannel: Direction => PLAYER, Buffer => 320 WrapH323EndPoint::OpenAudioChannel: FrameSize 8, FrameTime 8, TimeUnits 8 WrapH323EndPoint::OpenAudioChannel: Frame 1 WrapH323EndPoint::OpenAudioChannel: LID Codec G.711-uLaw-64k WrapH323EndPoint::OpenAudioChannel: The sound channel is audiosocket:out1(fd=41) WrapH323EndPoint::OpenAudioChannel: The audio device name is audiosocket:out1 PAsteriskSoundChannel::Open: os_handle 41, mediaFormat 0, frameTime 1 WrapH323EndPoint::OpenAudioChannel: Opened sound channel "audiosocket:out1" for playing using 1x8 byte buffers. WrapH323EndPoint::OnStartLogicalChannel: Started logical channel [27258] : receiving G.711-uLaw-64k{hw} WrapH323EndPoint::OnStartLogicalChannel: RxFrames = 20 WrapH323EndPoint::OnStartLogicalChannel: channelsOpen = 1 WrapH323EndPoint::OpenAudioChannel: Direction => RECODER, Buffer => 320 WrapH323EndPoint::OpenAudioChannel: FrameSize 8, FrameTime 8, TimeUnits 8 WrapH323EndPoint::OpenAudioChannel: Frames 20 WrapH323EndPoint::OpenAudioChannel: LID Codec G.711-uLaw-64k WrapH323EndPoint::OpenAudioChannel: The sound channel is audiosocket:in1(fd=43) WrapH323EndPoint::OpenAudioChannel: The audio device name is audiosocket:in1 PAsteriskSoundChannel::Open: os_handle 43, mediaFormat 0, frameTime 1 WrapH323EndPoint::OpenAudioChannel: Opened sound channel "audiosocket:in1" for recording using 1x160 byte buffers. How come the buffers are of different size? Is this a good thing? Recording to 160 bytes and playing to 8 bytes buffers.... When looking into the code, it looks to me as if there has been some trial and error approach? (WrapH323EndPoint::OpenAudioChannel) /************ bufSize = GetFrames(mediaFormat) * mediaFormat.GetFrameSize(); **********/ if (dir == RECORDER) { bufSize = GetFrames(mediaFormat) * mediaFormat.GetFrameSize(); WRAPTRACE(5, "Frames " << GetFrames(mediaFormat)); } else { /************* if ((mediaType == RTP_DataFrame::PCMU) || (mediaType == RTP_DataFrame::PCMA)) { bufSize = bufferSize; } else { ***********/ bufSize = mediaFormat.GetFrameSize(); WRAPTRACE(5, "Frame 1"); /************ } ***********/ Shouldn't the buffers be of equal size? I'm quite new to this code so please correct me if i'm wrong, Ah, and yes, the reason i'm digging in the code is to get my fax to work! ;) It worked fine with the config CiscoGW -> GnuGK -> ATA186 -> Fax, but now it does not and I get comm error on the display. My config now looks like CiscoGW -> GnuGK -> Asterisk -> ATA186 -> Fax. Any ideas anyone, i've disable the silence suppression and disabled the CED tone detection as per Cisco "Using FAX Mode" in their Administrators Guide for the ATA186. Regards, Niclas Gustafsson
Niclas Gustafsson wrote:> Hello! > > Anyone with some insight into the oh323 channel driver please shed > some light on the code block below from wrapendpoint.cxx. > > When enabling trace on the channel driver i get this, for me, strange > debug info: > > WrapH323EndPoint::OpenAudioChannel: Direction => PLAYER, Buffer => 320 > WrapH323EndPoint::OpenAudioChannel: FrameSize 8, FrameTime 8, TimeUnits > 8 > WrapH323EndPoint::OpenAudioChannel: Frame 1 > WrapH323EndPoint::OpenAudioChannel: LID Codec G.711-uLaw-64k > WrapH323EndPoint::OpenAudioChannel: The sound channel is > audiosocket:out1(fd=41) > WrapH323EndPoint::OpenAudioChannel: The audio device name is > audiosocket:out1 > PAsteriskSoundChannel::Open: os_handle 41, mediaFormat 0, frameTime 1 > WrapH323EndPoint::OpenAudioChannel: Opened sound channel > "audiosocket:out1" for playing using 1x8 byte buffers. > WrapH323EndPoint::OnStartLogicalChannel: Started logical channel [27258] > : receiving G.711-uLaw-64k{hw} > WrapH323EndPoint::OnStartLogicalChannel: RxFrames = 20 > WrapH323EndPoint::OnStartLogicalChannel: channelsOpen = 1 > WrapH323EndPoint::OpenAudioChannel: Direction => RECODER, Buffer => 320 > WrapH323EndPoint::OpenAudioChannel: FrameSize 8, FrameTime 8, TimeUnits > 8 > WrapH323EndPoint::OpenAudioChannel: Frames 20 > WrapH323EndPoint::OpenAudioChannel: LID Codec G.711-uLaw-64k > WrapH323EndPoint::OpenAudioChannel: The sound channel is > audiosocket:in1(fd=43) > WrapH323EndPoint::OpenAudioChannel: The audio device name is > audiosocket:in1 > PAsteriskSoundChannel::Open: os_handle 43, mediaFormat 0, frameTime 1 > WrapH323EndPoint::OpenAudioChannel: Opened sound channel > "audiosocket:in1" for recording using 1x160 byte buffers. > > How come the buffers are of different size? Is this a good thing?These buffers are used to copy bytes between Asterisk and OpenH323 lib. The two streams are completely unrelated. The logic behind this, is that the driver reads one frame each time (for sample-based codecs, a predefined number of samples is considered a frame), although there are (possibly) more data already received.> Recording > to 160 bytes and playing to 8 bytes buffers.... When looking into the > code, > it looks to me as if there has been some trial and error approach? > > (WrapH323EndPoint::OpenAudioChannel) > > /************ > > bufSize = GetFrames(mediaFormat) * > mediaFormat.GetFrameSize(); > > **********/ > if (dir == RECORDER) { > bufSize = GetFrames(mediaFormat) * > mediaFormat.GetFrameSize(); > WRAPTRACE(5, "Frames " << > GetFrames(mediaFormat)); > } else { > /************* > > if ((mediaType == RTP_DataFrame::PCMU) || > (mediaType == RTP_DataFrame::PCMA)) { > > bufSize = bufferSize; > > } else { > > ***********/ > bufSize = mediaFormat.GetFrameSize(); > WRAPTRACE(5, "Frame 1"); > /************ > > } > > ***********/ > > Shouldn't the buffers be of equal size?Not necessarily.> I'm quite new to this code so please correct me if i'm wrong, > > Ah, and yes, the reason i'm digging in the code is to get my fax to > work! ;) It worked fine > with the config CiscoGW -> GnuGK -> ATA186 -> Fax, but now it does not > and I get comm error > on the display. My config now looks like CiscoGW -> GnuGK -> Asterisk -> > ATA186 -> Fax. Any > ideas anyone, i've disable the silence suppression and disabled the CED > tone detection as > per Cisco "Using FAX Mode" in their Administrators Guide for the ATA186.You need T.38 support to be able to handle fax and, at this time, asterisk-oh323 doesn't support it. I 'll try to add some preliminary code in order to be able to test it.> > Regards, > Niclas Gustafsson > >Michael.> > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users