[pjsip] wav memory record buffer problems

Benny Prijono bennylp at pjsip.org
Thu Nov 8 08:35:45 EST 2007


You're guessing right. The memory based reader/writer's buffer 
simply doesn't have WAV header, and that's all there is.

cheers,
  -benny


Thomas Plotkowiak wrote:
> I am trying to read in a mono wav file and put it into memory, in short.
> 
> The things I am doing now in short are:
> 
> 1. Allocate some buffer space
> /* Allocate some memmory for the buffer*/
>     int membuffer_size = 1024*8000;
>     unsigned char *membuffer;
>     membuffer = new unsigned char[membuffer_size];
> 
> 2. Init PJ LIb ...
> 3. Create a media port from the WAV file
> status = pjmedia_wav_player_port_create(.... &file_port...)
> 
> 4. Create a memory capture port
> status = pjmedia_mem_capture_create (... 
> membuffer,membuffer_size,..&mem_port...)
> 
> 5. Create a conference bridge
> 
> 6. Add the mem_port to the conference bridge
> status = pjmedia_conf_add_port( ... mem_port...)
> 
> 7. Add the file_port to the conference bridge
> status = pjmedia_conf_add_port( ... file_port...)
> 
> 8.  Connect the fileport source (2) to memport (1) destination
> status = pjmedia_conf_connect_port(conf, 2, 1, 0);
> 
> SO FAR everything works like expected. But now I am trying to read that 
> memory buffer out with another application.
> 
> BUT here the problem is i simply am not hearing any sound. I have 
> checked that that the file_port is writing to the memory by
> 
> status = pjmedia_mem_capture_get_size (mem_port);
> 
> which shows an increase in size so a good guess that its not the writing.
> 
> MY Guess is that the wav in memory lacks a RIFF WAV header, I guess it 
> is only created after i destroy the file_writer, because some 
> calculations about the length of the wav file etc.. have to be made in 
> the header. So my question is would it make sense to add a "dummy" 
> header to make the wav file readable in "realtime"? or are there better 
> ways?
> 
> Here is the link to the Memory/Buffer Capture Port
> http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__MEM__CAPTURE.htm
> 
> 
> Cheers Thomas






More information about the pjsip mailing list