What is master port and port zero ?

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

 



Hello Khoa,

Please find my answers inline below.

Regards
Manmeet

On 01/29/2013 12:32 PM, Khoa Pham wrote:
> Hi Manmeet,
>
> 1. In this link 
> http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__MASTER__PORT.htm, 
> they say there are 2 ports connecting to Master Port, what are they ?
As mentioned in the document, the two ports are for media streams. 
Imagine the 2 ports as pipes with their other ends connected to 
clients/files/voice processors and the master port as pump connecting 
the two streams/port together, it pulls data from one stream and pushes 
it onto the other.

> 2. In file conference.c, "pjmedia_conf" structure, there is field 
> "pjmedia_port*master_port"
> And in master_port.c, there is structure "pjmedia_master_port". Are 
> they related ?
Yes, when you create a conference with PJMEDIA_CONF_NO_DEVICE option, an 
internal master port is created and attached to the conference, now to 
start and stop the mix, you need to start and stop the master port. 
Below code snippet is taken from pjsip-apps/src/samples/confbench.c

status = pjmedia_conf_create( pool,
                   PORT_COUNT,
                   CLOCK_RATE,
                   1, SAMPLES_PER_FRAME, 16,
*PJMEDIA_CONF_NO_DEVICE*,
&conf);
     if (status != PJ_SUCCESS) {
     app_perror(THIS_FILE, "Unable to create conference bridge", status);
     return 1;
     }

     conf_port = pjmedia_conf_get_master_port(conf);

     /* Create master port */
     status = pjmedia_master_port_create(pool, null_port, conf_port, 0, 
&master_port);

     pjmedia_master_port_start(master_port);
     ........
     ........
     pjmedia_master_port_stop(master_port);

>
>
> On Tue, Jan 29, 2013 at 1:56 PM, Manmeet Singh 
> <manmeets at gc-solutions.net <mailto:manmeets at gc-solutions.net>> wrote:
>
>     Hello Khoa,
>
>     Port zero is port in the conference. It could be Master Port or
>     Sound Port depending on what option you provided when calling
>     pjmedia_conf_create.
>
>
>     Regards
>     Manmeet
>
>     On 01/29/2013 12:19 PM, Khoa Pham wrote:
>>     Hi Manmeet,
>>
>>     So Sound Device Port uses sound hardware clock, and Master Port
>>     uses Clock Generator ?
>>     And in 1 conference bridge, there should be only 1 of these 2 Ports ?
>>
>>     In this link
>>     http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__CONF.htm,
>>     they said
>>     "Under normal operation (i.e. when PJMEDIA_CONF_NO_DEVICE option
>>     is NOT specified), the bridge internally create an instance of
>>     sound device and connect the sound device to port zero of the bridge.
>>
>>     If PJMEDIA_CONF_NO_DEVICE options is specified, no sound device
>>     will be created in the conference bridge.
>>     Application MUST acquire the port interface of the bridge by
>>     calling pjmedia_conf_get_master_port(), and connect this port
>>     interface to a sound device port by calling
>>     pjmedia_snd_port_connect(), or to a master port
>>     (pjmedia_master_port) if application doesn't want to instantiate
>>     any sound devices."
>>
>>     What is port zero? If port zero is Master Port, then Sound device
>>     is connected to Master Port ??
>>
>>
>>
>>     On Tue, Jan 29, 2013 at 12:33 PM, Manmeet Singh
>>     <manmeets at gc-solutions.net <mailto:manmeets at gc-solutions.net>> wrote:
>>
>>         Guys,
>>         Please correct me here if I am wrong in any point. I have
>>         been studying PJSip for sometime now but I may have many
>>         incorrect assumptions when trying to connect the dots. :)
>>
>>         Hello Khoa,
>>         In conferencing, the way it works port zero would either be
>>         Sound Device Port or Master Port. These are attached for a
>>         reason, both these ports have a unique property, they provide
>>         clock/timing to the media they connect to. Other media ports
>>         by design are passive, they would not push the conference to
>>         take their buffers and mix them for other parties to listen.
>>         Sound card interfaces require callbacks which either provide
>>         recorded voice in buffer or while playing a buffer when
>>         finished would ask for next buffer.
>>
>>         Sound card has callbacks and on similar pattern media port
>>         internally has an instance of Clock Generator, so for the
>>         conference mixing to happen you need to have one of these
>>         added to the conference.
>>
>>         If you have any further queries or if any of my points above
>>         are not clear, please do let me know.
>>
>>         Regards
>>         Manmeet
>>
>>
>>         On 01/28/2013 10:24 PM, Khoa Pham wrote:
>>>         Hi Manmeet,
>>>
>>>         I've read those 3 links. please explain to me what is the
>>>         relation among sound device port, master port, and port zero.
>>>
>>>
>>>         On Mon, Jan 28, 2013 at 8:37 PM, Manmeet Singh
>>>         <manmeets at gc-solutions.net
>>>         <mailto:manmeets at gc-solutions.net>> wrote:
>>>
>>>             Hello Khoa,
>>>
>>>             If following links don't clarify things then please do
>>>             let me know. Then I'll try and give you a snapshot of
>>>             the complete scenario of how the conference is designed
>>>             in pjsip.
>>>
>>>             snd_port
>>>             http://www.pjsip.org/pjmedia/docs/html/group__PJMED__SND__PORT.htm
>>>             master_port
>>>             http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__MASTER__PORT.htm
>>>             port
>>>             http://www.pjsip.org/docs/latest-2/pjmedia/docs/html/group__PJMEDIA__PORT.htm
>>>
>>>             The media clock/timing extends the media port concept
>>>             that is explained inMedia Ports Framework
>>>             <http://www.pjsip.org/docs/latest-2/pjmedia/docs/html/group__PJMEDIA__PORT.htm>.
>>>             When clock is present in the ports interconnection,
>>>             media will flow automatically (and with correct timing
>>>             too!) from one media port to another.
>>>
>>>             There are few objects in PJMEDIA that are able to
>>>             provide clock/timing to media ports interconnection:
>>>
>>>               * Sound Device Port
>>>                 <http://www.pjsip.org/docs/latest-2/pjmedia/docs/html/group__PJMED__SND__PORT.htm>
>>>                 The sound device makes a good candidate as the clock
>>>                 source, and PJMEDIAPortable Sound Hardware
>>>                 Abstraction
>>>                 <http://www.pjsip.org/docs/latest-2/pjmedia/docs/html/group__PJMED__SND.htm>is
>>>                 designed so that it is able to invoke operations
>>>                 according to timing driven by the sound hardware
>>>                 clock (this may sound complicated, but actually it
>>>                 just means that the sound device abstraction
>>>                 provides callbacks to be called when it has/wants
>>>                 media frames).
>>>                 SeeSound Device Port
>>>                 <http://www.pjsip.org/docs/latest-2/pjmedia/docs/html/group__PJMED__SND__PORT.htm>for
>>>                 more details.
>>>
>>>               * Master Port
>>>                 <http://www.pjsip.org/docs/latest-2/pjmedia/docs/html/group__PJMEDIA__MASTER__PORT.htm>
>>>                 The master port usesClock Generator
>>>                 <http://www.pjsip.org/docs/latest-2/pjmedia/docs/html/group__PJMEDIA__CLOCK.htm>as
>>>                 the clock source. By usingMaster Port
>>>                 <http://www.pjsip.org/docs/latest-2/pjmedia/docs/html/group__PJMEDIA__MASTER__PORT.htm>,
>>>                 it is possible to interconnect passive media ports
>>>                 and let the frames flow automatically in timely manner.
>>>                 Please seeMaster Port
>>>                 <http://www.pjsip.org/docs/latest-2/pjmedia/docs/html/group__PJMEDIA__MASTER__PORT.htm>for
>>>                 more details.
>>>
>>>
>>>             Regards
>>>             Manmeet
>>>
>>>
>>>             On 01/28/2013 06:53 PM, Khoa Pham wrote:
>>>>             Thanks Gaurav for the prompt reply, I've already read
>>>>             that link.
>>>>             "A master port has two media ports connected to it".
>>>>             What are those 2 media ports?
>>>>             In "pjmedia_conf" structure, there are "master_port",
>>>>             "snd_port" and "ports" list, how are they related ?
>>>>
>>>>
>>>>             On Mon, Jan 28, 2013 at 8:15 PM, Gaurav Srivastava
>>>>             <gaurav.srivastava2 at agnity.com
>>>>             <mailto:gaurav.srivastava2 at agnity.com>> wrote:
>>>>
>>>>                             Hi Khoa,
>>>>
>>>>                             Please go through the link
>>>>
>>>>                 http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__MASTER__PORT.htm
>>>>
>>>>                             In case not fruitful, please let me know.
>>>>
>>>>                             Thanks and Regards,
>>>>
>>>>                             Gaurav
>>>>
>>>>                 -----Original Message-----
>>>>                 *From:* pjsip [mailto:pjsip-bounces at lists.pjsip.org
>>>>                 <mailto:pjsip-bounces at lists.pjsip.org>] *On Behalf
>>>>                 Of *Khoa Pham
>>>>                 *Sent:* Monday, January 28, 2013 6:33 PM
>>>>                 *To:* pjsip list
>>>>                 *Subject:* [pjsip] What is master port and port zero ?
>>>>
>>>>                 When reading conference bridge on
>>>>                 pjsip.org/pjmedia/docs
>>>>                 <http://pjsip.org/pjmedia/docs>, I see these 2
>>>>                 port. What are they, are they the same ?
>>>>
>>>>                 When running pjsua_app, I use "cl" command to list
>>>>                 port in conference bridge, I see
>>>>
>>>>                 pjsua_var.mconf->master_port->info->name = "Wave
>>>>                 mapper"
>>>>
>>>>                 pjsua_var.mconf->ports[0]->name = "Wave mapper"
>>>>
>>>>                 pjsua_var.mconf->ports[1]->name = "ringback"
>>>>
>>>>                 pjsua_var.mconf->ports[2]->name = "ring"
>>>>
>>>>                 pjsua_var.mconf->ports[3]->name =
>>>>                 "sip:voip1 at freesipserver.com
>>>>                 <mailto:sip%3Avoip1 at freesipserver.com>"
>>>>
>>>>                 And it says ports[0] is transmitting to port[3],
>>>>                 and port[3] is transmitting to ports[0]
>>>>
>>>>                 Any answer is highly appreciated, thanks in advance.
>>>>
>>>>                 -- 
>>>>                 Khoa Pham
>>>>                 HCMC University of Science
>>>>                 Faculty of Information Technology
>>>>
>>>>
>>>>                 _______________________________________________
>>>>                 Visit our blog: http://blog.pjsip.org
>>>>
>>>>                 pjsip mailing list
>>>>                 pjsip at lists.pjsip.org <mailto:pjsip at lists.pjsip.org>
>>>>                 http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>>
>>>>
>>>>
>>>>
>>>>             -- 
>>>>             Khoa Pham
>>>>             HCMC University of Science
>>>>             Faculty of Information Technology
>>>>
>>>>
>>>>             _______________________________________________
>>>>             Visit our blog:http://blog.pjsip.org
>>>>
>>>>             pjsip mailing list
>>>>             pjsip at lists.pjsip.org  <mailto:pjsip at lists.pjsip.org>
>>>>             http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>
>>>
>>>
>>>
>>>         -- 
>>>         Khoa Pham
>>>         HCMC University of Science
>>>         Faculty of Information Technology
>>
>>
>>
>>
>>     -- 
>>     Khoa Pham
>>     HCMC University of Science
>>     Faculty of Information Technology
>
>
>
>
> -- 
> Khoa Pham
> HCMC University of Science
> Faculty of Information Technology

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20130129/da225d1c/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