PJMEDIA conference bridge - direct port?

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

 



Hi Alex,

hope your client is not the Texan company RevCord ;o)

If you are comfortable with that you can send the troublesome code
off-list and I'll check in-depth.

>From what i can now guess, you don't need an extra merge_port as you
can directly use the decoded RTP buffer buffer in your pseudo-code
like this...

while(RTP decode into PCM frames and such into &frame) {
	pjmedia_frame frame;
	frame.buf = your RTP buffer
	frame.size= the size of the current frame, rtp payload size
	frame.type = PJMEDIA_FRAME_TYPE_AUDIO;
      pjmedia_put_frame(rev, &frame);
   }

Cheers,
Alain


On 19-Dec-11 11:30, Alex Balashov wrote:
> Alain,
> 
> On 12/19/2011 05:20 AM, Alain Totouom wrote:
> 
>> the splitter port is the one connected to the bridge. That port is
>> in sync with the bridge. You'll use it's slot ID to do the mixing.
>> The reverse port is the port you'll async and exclusively read/write
>> from/to.
>> The bridge is just aware of the splitter (slot)...
>>
>> pjmedia_port* sc, *rev;
>> int slot;
>> pjmedia_splitcomb_create(...,&sc);
>> pjmedia_splitcomb_create_rev_channel(pool,sc,..,&rev);
>> pjsua_conf_add_port(.., sc,&slot);
> 
> Understood.  In that case, I understood your original post correctly
> and did all this.
> 
>> /* async write */
>> pjmedia_frame rdf;
>> rdf.buf = ..;
>> rdf.size= ..;
>> rdf.type= ..;
>> pjmedia_port_put_frame (rev,&rdf);
> 
> I think here is where I am running into the problem.  I don't
> produce the frames endogenously within this async write function; 
> instead, they come from the outside, read from a PCAP packet
> capture, and RTP-decoded into PCM frames in the usual manner.  So,
> I'm doing something like this with the PCM frames in that capture
> processing loop:
> 
>    while(RTP decode into PCM frames and such into &frame) {
>       pjmedia_put_frame(&merge_port, &frame);
>    }
> 
> And here's how I have implemented the 'merge_port':
> 
>    pjmedia_port        merge_port;
>    pj_str_t        merge_port_name = pj_str("merge");
>    ...
>    memset(&merge_port, 0, sizeof(pjmedia_port));
>    ...
>    pj_strdup2(pool, &merge_port.info.name, "merge_player");
> 
>    merge_port.get_frame = &merge_get_frame;
>    merge_port.put_frame = &merge_put_frame;
> 
>    pjmedia_port_info_init(&merge_port.info, &merge_port_name,
>                           0x1, 8000, 1, 16,  (8000 * PTIME) / 1000);
> 
> And the callbacks for 'merge_port':
> 
> static pj_status_t merge_get_frame(pjmedia_port *port,
>                                    pjmedia_frame *f)
> {
>         return PJ_EINVALIDOP;
> }
> 
> static pj_status_t merge_put_frame(pjmedia_port *port,
>                                    const pjmedia_frame *f)
> {
>         if(f->size == 0)
>                 return PJ_SUCCESS;
> 
>         return pjmedia_port_put_frame(conf_port, f);
> }
> 
> 
> And here is what I end up with:
> 
> recombine: ../src/pjmedia/splitcomb.c:742: rport_put_frame:
> Assertion `frame->size == this_port->info.bytes_per_frame' failed.
> 
> A little backtracing reveals:
> 
> #6  0x0000000000404d90 in merge_put_frame (port=0x241, f=0x0)
>     at media_proc.c:653
> 
> So, for some reason it's getting a NULL frame.  Any idea what I'm
> doing wrong?
> 

-- 
                            ""
                          (o)(o)
                _____o00o__(__)__o00o_____
3072D/146D10DE 2011-09-29    Alain Totouom  <totouom at gmx.de>
PGP Fingerprint 39A4F092 FFA7C746 CC305CB0 69091911 146D10DE



[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