Play buffer to a port associated with a call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jessica,

Sorry for late response. I couldn't say whether such way is better or wrong,
I am not really sure on what you want to achieve.

Yes, the silence/zero audio data is there to pad the last frame when you are
using PJMEDIA_MEM_NO_LOOP, this should be less than one frame time
(10-30ms). However if you don't want this, there may be some tricks to avoid
this silence, e.g: make the audio size to be multiplication of the frame
size, or remove PJMEDIA_MEM_NO_LOOP options and put your own (white) noise
for 1-2 frames in the beginning of audio data to avoid 'real' silence.

Regards,
nanang


 2008/6/26 vopjessie <jessievop at hotmail.com>:
> Thanks Nanang, you are right about PJMEDIA_MEM_NO_LOOP. Your message helps
> me understand why i heard some bytes replayed. Thanks! However, I am still
> not able to figure out how to play an audio data stream
> (stored in buffers) to a port associated with a call. If i create a mem
> player for each audio buffer, i would hear the silence between each audio
> buffer. It seems to me i am trying to do this in a wrong way. Is there a
> better way to do this?
>
> thanks a lot!
>
> -Jessica
>
>> Date: Wed, 25 Jun 2008 19:38:02 +0700
>> From: nanang@xxxxxxxxx
>> To: pjsip at lists.pjsip.org
>> Subject: Re: Play buffer to a port associated with a call
>>
>> Hi Jess,
>>
>> Not sure what you want to achieve, but normally you should create mem
>> player port for each audio. Last few bytes replayed sounds like length
>> inconsistency among audio's put in the buffer. Other possibility is
>> PJMEDIA_MEM_NO_LOOP option is not set when creating memplayer.
>>
>> Regards,
>> nanang
>>
>>
>> 2008/6/25 vopjessie <jessievop at hotmail.com>:
>> > Hi Nanang, thanks for the message again. It sounds like the last a few
>> > bytes
>> > are replayed. You are right. I was actually not sure if the way i am
>> > doing
>> > is the right way to play data in a buffer to a port associated with a
>> > call.
>> > Is there a better way to do it?
>> >
>> > thanks a lot
>> >
>> > Jessica
>> >
>> >> Date: Wed,25 Jun 2008 18:15:54 +0700
>> >> From: nanang@xxxxxxxxx
>> >> To: pjsip at lists.pjsip.org
>> >> Subject: Re: Play buffer to a port associated with a call
>> >>
>> >> Hi Jess,
>> >>
>> >> Could you describe more detail on "I can hear the audio, but it
>> >> doesn't sound correct", did it play correct audio but then continued
>> >> with previous audio? or audio was played slower/faster? IMHO, it is
>> >> rather unusual idea to replace the memplayer's audio buffer in EOF
>> >> callback since you should make sure that the clock rate, channel
>> >> number, and PCM length must be exactly same.
>> >>
>> >> Regards,
>> >> nanang
>> >>
>> >>
>> >> 2008/6/25 vopjessie <jessievop at hotmail.com>:
>> >> > I need to play audio data in a buffer to a sip inbound or outbound.
>> >> > The
>> >> > following steps are what I am doing:
>> >> >
>> >> > - call pjmedia_conf_create() to create a conference bridge
>> >> > - call pjmedia_mem_player_create() to create a port for the audio
>> >> > buffer
>> >> > - call pjmedia_mem_player_set_eof_cb() to register a call back
>> >> > - call pjmedia_conf_add_port() to add the port associated with the
>> >> > sip
>> >> > call
>> >> > (inbound or outbound) to the conference bridge
>> >> > - call pjmedia_conf_add_port() to add the port associated with the
>> >> > audio
>> >> > buffer the same conference bridge
>> >> > - call pjmedia_conf_connect_port() to connect the port associated
>> >> > with
>> >> > the
>> >> > audio buffer to the port associated with the sip call (inbound or
>> >> > outbound)
>> >> > - call pjmedia_null_port_create() to create a null port
>> >> > - call pjmedia_master_port_create() to create a master port with the
>> >> > null
>> >> > port as the upstream and the master port obtained from the
conference
>> >> > bridge
>> >> > as the downstream
>> >> > - call pjmedia_master_port_start() to start the master port created
>> >> > in
>> >> > the
>> >> > last step
>> >> >
>> >> > I can hear the audio, but it doesn't sound correct. Since i fill the
>> >> > audio
>> >> > data to the buffer every time the call back function is called, i
>> >> > write
>> >> > the
>> >> > data filled in the audio buffer to a file in the call back function,
>> >> > the
>> >> > audio data in the file are correct. Does anyone know if i have done
>> >> > anything
>> >> > wrong.
>> >> >
>> >> > thanks in advance
>> >> >
>> >> > -Jessica
>> >> >
>> >> > ________________________________
>> >> > "?????????" ?????
>> >> > _______________________________________________
>> >> > 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
>> >> >
>> >> >
>> >> _______________________________________________
>> >> 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
>> >
>> >
>> > ________________________________
>> > ???Hotmail???????? Windows Live Mail? ?????
>> > _______________________________________________
>> > 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
>> >
>> >
>> _______________________________________________
>> 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
>
>
> ________________________________
> "?????????" ?????
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080630/089195ca/attachment-0001.html 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux