[pjsip] A couple of questions.

Nanang Izzuddin nanang at pjsip.org
Thu Apr 10 09:05:54 EDT 2008


Hi Hussain,

It seems you set the wav player port setting independently from stream port.

Master port requires both ports to have same clock rate and ptime
(packet time/frame length in millisecond unit).  In this case, you
have put resample to adjust the clock rate of wav player port, but you
haven't synchronized the ptime. Since usually codecs (managed by
stream port) are strict on ptime, so the wav player should follow the
stream port's ptime.

Please take a look at this quote from streamutil.c:
---------
	wav_ptime = stream_port->info.samples_per_frame * 1000 /
		    stream_port->info.clock_rate;
	status = pjmedia_wav_player_port_create(pool, play_file, wav_ptime,
						0, -1, &play_file_port);
---------

As alternative, you can utilize the conference bridge for this purpose
and it provides convenience by automatic adjustment on the clock rate
and ptime (and also mixing signal, etc) for all ports plugged in to
it.

Btw, about the wrong wav format, it may be caused by compressed wav
data, currently wav player port only supports uncompressed data.

Regards,
nanang


On 10/04/2008, huali at cis.strath.ac.uk <huali at cis.strath.ac.uk> wrote:
> I am having some trouble with WAV file compatibility.
>
>  Basically, I have a PCM 44.1 kHz wav file that I am trying to stream using
>  RTP.  Having looked at some samples, it looks to me like I should be
>  setting up a number of ports like so:
>
>  wav_player_port->master_port->stream_port
>
>  The problem I have been having is to do with the sample rate and the
>  number of samples per frame.  I tried adding a resample port between the
>  wav_player_port and the master_port, which successfully resamples the
>  audio to 8kHz, but leaves us with 320 samples per frame, which the
>  master_port does not like because the stream_port has around 160 samples
>  per frame (can't remember if the numbers are correct, but you get the
>  idea).
>
>  I tried resampling the wav file using nero wav editor, but all that
>  happens is that the wav_player_port then complains that the file is in the
>  wrong format.
>
>  Can anyone suggest a way around this?
>
>  Thanks alot,
>
>  Hussain
>
>
>  _______________________________________________
>  Visit our blog: http://blog.pjsip.org
>
>  pjsip mailing list
>  pjsip at lists.pjsip.org
>  http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>




More information about the pjsip mailing list