之前想扩展conference和加一个Video_port,后来看了下不会,太复杂。
在者他们做的事也是对声音的混合之类,就不想学着扩展了。
后来在pjsua_media中的pjsua_media_channel_update方法中看到了pjmedia_session_create之后
/* Get the port interface of the first stream in the session. * We need the port interface to add to the conference bridge. */ pjmedia_session_get_port(call->session, 0, &media_port);
/* Notify application about stream creation. * Note: application may modify media_port to point to different * media port */ if (pjsua_var.ua_cfg.cb.on_stream_created) { pjsua_var.ua_cfg.cb.on_stream_created(call_id, call->session, 0, &media_port); }
以上是扩展之后的,就是创建完视频流之后调用一下应该程序的on_stream_created回调。
测试代码为:
static void on_stream_created(pjsua_call_id call_id, pjmedia_session *sess, unsigned stream_idx, pjmedia_port **p_port){ if(stream_idx == 0) { pj_memcpy(&theApp.port_v,*p_port,sizeof(pjmedia_port)); }}
回调函数中保存端口
测试程序
pjmedia_frame myFrame; myFrame.buf = new char[100]; pj_str_t sendbuf = pj_str("testasdfasdfasdf"); pj_memcpy(myFrame.buf,sendbuf.ptr,sendbuf.slen); myFrame.size = sendbuf.slen; myFrame.type = PJMEDIA_FRAME_TYPE_AUDIO; (theApp.port_v).put_frame(&theApp.port_v,&myFrame);
由于保存和测试的是声音端口,声音出发出卡卡声。
所以扩展思路有了,
保存视频端口,之后用Clock Generator定时,用VFW Capture视频并传给视频端口。
对于如何扩展SIP传视频协商SDP处理请参考之前随笔!
转载于:https://www.cnblogs.com/nanshouyong326/archive/2009/11/20/1607034.html
相关资源:数据结构—成绩单生成器