windows + qt + dshow(COM threading model)

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

 



 You can solve this problem by initializing pjsip in a separate thread and then register Qt GUI thread with pj_thread_register.

?? ???? // Initializing sip stack in another thread to avoid CoInitialize conflict
?? ??? ?QFuture<bool> future = QtConcurrent::run(this,&SipPhone::initSipStack);
?? ??? ?if (future.result())
?? ??? ???? pj_thread_register("Qt GUI Thread",FPjThreadDesc,&FPjThread);




???????, 29 ??????? 2013, 11:27 +03:00 ?? "R. Savchenko" <gmstima at gmail.com>:
>Hi all,
>
>I want to pay your attention on this part of code:
>
>static pj_status_t dshow_factory_init(pjmedia_vid_dev_factory *f)
>{
>??? HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
>??? if (hr == RPC_E_CHANGED_MODE) {
>??????? PJ_LOG(4,(THIS_FILE, "Failed initializing DShow: "
>???????????????????????????? "COM library already initialized with "
>???????????????????????????? "incompatible concurrency model"));
>??????? return PJMEDIA_EVID_INIT;
>??? }
>
>??? return dshow_factory_refresh(f);
>}
>
>If you'll develop application with qt on windows you'll always have
    RPC_E_CHANGED_MODE if you put 
>this initializing before QApplication instance, because QApplication
    already was initialized with COINIT_APARTMENTTHREADED .
>
>It'll be nice if you'll use the same technique as in wmme_dev;
>
>static void get_dev_names(pjmedia_aud_dev_factory *f)
>{
>??? ....
>??? coinit = CoInitializeEx(NULL, COINIT_MULTITHREADED);
>??? if (coinit == RPC_E_CHANGED_MODE)
>??? coinit = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
>??? if (FAILED(coinit))
>??? goto on_error;
>??? ......
>}
>
>-- 
Regards,
R. Savchenko.
>_______________________________________________
>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/20130829/b10292de/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