[pjsip] Crash on pjvideo - II

mik rivael_il at yahoo.com
Sun Jan 1 00:56:23 EST 2012


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 at yahoo.com>
Subject: [pjsip] 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20111231/e44c2ca9/attachment-0001.html>


More information about the pjsip mailing list