Can we notify H323 channel of available source audio?

Discussion related to implementation and use of the H.323 Plus H.323 stack at https://www.h323plus.org.
Post Reply
Alcor2022
Posts: 7
Joined: Mon Dec 20, 2021 3:37 am

Can we notify H323 channel of available source audio?

Post by Alcor2022 »

Hello,

I have a custom H323Channel class derived from PIndirectChannel. I was able to play a wav file through this channel as in the sample application. Now I have a situation where audio is being provided from the MIC source from NAUDIO and I need to pipe that audio through my custom H323 channel and to other destinations. The issue I am having is that H323 is polling for audio data (calling the read method every 20ms) and I need to sync that with the data I am getting from this other source. Ideally, when I have audio data I want to send through my H323 channel I could trigger an event within H323 and provide the data. This doesn't seem to be available, or I am not aware of how to do that.

So, my solution is to try and implement an event and build a buffer within my own class that can be used to grab data whenever the READ method is called by H323 (I would read data from my buffer, similar to reading a chunk of bytes from an audio file). I will be working on that solution this week, but was wondering if the event notification method was available. I would like to "push" audio data to the H323 source channel rather than have it poll me for data.

The only other option would be to rewrite part of this application to use H323 as the audio source, but then I would need the H323 channel to notify me when source audio is available (so I can broadcast that data elsewhere). I don't like that option because we are using NAUDIO as the source for both our SIP and H323 endpoints. NAUDIO provides data from the MIC that I can then send to SIPSorcery's endpoint/MediaSession and to wherever else. I have not seen an event in H323 I can subscribe to that would provide me audio data from the source (MIC). Is there a way to have H323 send me audio data coming from the local source device?

David
Alcor2022
Posts: 7
Joined: Mon Dec 20, 2021 3:37 am

Re: Can we notify H323 channel of available source audio?

Post by Alcor2022 »

I have developed a working solution which utilizes a circular buffer to help process the source audio. This way, I can feed audio into the buffer and have it available whenever a Read request comes from the H323 channel. For the Audio Sink direction I was able to route that audio from the H323 channel's write method. So, now I can create custom H323 channels and route the audio through the network and multiple devices.

David
Post Reply