diff options
-rw-r--r-- | pjmedia/src/pjmedia-videodev/dshow_dev.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/pjmedia/src/pjmedia-videodev/dshow_dev.c b/pjmedia/src/pjmedia-videodev/dshow_dev.c index 2c57722f..7b4dd3a0 100644 --- a/pjmedia/src/pjmedia-videodev/dshow_dev.c +++ b/pjmedia/src/pjmedia-videodev/dshow_dev.c @@ -214,11 +214,18 @@ pjmedia_vid_dev_factory* pjmedia_dshow_factory(pj_pool_factory *pf) 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; + if (hr == RPC_E_CHANGED_MODE) { + /* When using apartment mode, Dshow object would not be accessible from + * other thread. Take this into consideration when implementing native + * renderer using Dshow. + */ + hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + if (FAILED(hr)) { + 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); |