Hi Michael, How do you use CoInitialize() in your GUI application (i.e. what parameters do you pass to the function)? Actually it shouldn't be a problem if the application decides to do the initialization by itself and dshow_init() shouldn't return failure just because the application already did the initialization earlier (although it probably should return failure if the initialization failed due to some other reasons). So I'm guessing that your GUI application initialized it with incompatible setting with what DShow device needs. Best regards, Ming On Tue, Jan 3, 2012 at 6:51 PM, Nanang Izzuddin <nanang.izzuddin at gmail.com> wrote: > Hi Michael, > > Has just created ticket for this: https://trac.pjsip.org/repos/ticket/1438. > Thanks for the report. > > BR, > nanang > > > On Sun, Jan 1, 2012 at 12:56 PM, mik <rivael_il at yahoo.com> wrote: >> >> >> Apparently, my problem was that my GUI program did CoInitialize and this prevented the one in the dshow_dev.c from working. Removing the CoInitialize in the GUI solved my problem. >> >> I have added some code to the "dshow_factory_init" to alert about such an event, so I save some debugging days from my fellow programmers: >> >> /* API: init factory */ >> static pj_status_t dshow_factory_init(pjmedia_vid_dev_factory *f) >> { >> ??? HRESULT hr; >> ??? hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); >> ??? if (FAILED (hr)) { >> ??? ??? char msg[80]; >> ??? ??? if (AMGetErrorText(hr, msg, sizeof(msg))) >> ??? ??? ??? PJ_LOG(4,(THIS_FILE, "****? Unable to CoInitizeEx!? ******: %s (hr=0x%x)", msg, hr)); >> ??? ??? else PJ_LOG(4,(THIS_FILE, "****? Unable to CoInitizeEx!? ******: (hr=0x%x)", hr)); >> ??? ??? PJ_ASSERT_RETURN(0, PJ_ECANCELLED); >> ??? } >> >> ??? return dshow_factory_refresh(f); >> } >> >> --- On Thu, 12/29/11, mik <rivael_il at yahoo.com> wrote: >> >> >> From: mik <rivael_il@xxxxxxxxx> >> Subject: Crash on pjvideo >> To: "pjsip list" <pjsip at lists.pjsip.org> >> Date: Thursday, December 29, 2011, 4:13 PM >> >> Hello, >> >> When the built-in camera is not instantiated a crash occur at: >> >> IMediaFilter_Stop(stream->dgraph.media_filter); because the pointer is null. >> >> I have change the code to: >> if (stream->dgraph.media_filter) >> ????? IMediaFilter_Stop(stream->dgraph.media_filter); >> >> and this solve the crash. >> >> I still have the problem of not able to render/filter the camera. The error messages are: >> 22:28:51.500??? pjsua_vid.c? .......Setting up TX.. >> 22:28:51.500??? pjsua_vid.c? ........Creating video window: type=preview, cap_id=0, rend_id=2 >> 22:31:50.796???? vid_port.c? .........Opening device Integrated Webcam [dshow] for capture: format=YUY2, size=352x288 @30000:1001 fps >> 22:32:36.937??? dshow_dev.c? .........Error creating filter graph: CoInitialize has not been called.? (hr=0x800401f0) >> 22:32:36.937??? dshow_dev.c? .........Trying to open dshow dev with default fps >> 22:32:36.937??? dshow_dev.c? .........Error creating filter graph: CoInitialize has not been called.? (hr=0x800401f0) >> 22:32:36.937??? dshow_dev.c? .........Trying to open dshow dev with default size & fps >> 22:32:36.937??? dshow_dev.c? .........Error creating filter graph: CoInitialize has not been called.? (hr=0x800401f0) >> 22:32:50.000??? dshow_dev.c? .........Stopping dshow video stream >> 22:33:37.281???? vid_port.c? .........Closing Integrated Webcam.. >> 22:33:53.453??? pjsua_vid.c? .........Window 1: destroying.. >> 22:34:33.359? pjsua_media.c? .......Error updating media call00:1: Unknown Error (PJ_EUNKNOWN) >> >> (CoInitialize HAS been called.) >> Any idea? >> >> Thanks, >> >> Michael >> >> -----Inline Attachment Follows----- >> >> _______________________________________________ >> 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