diff --git a/cmio/VCamIPC/src/ipcbridge.mm b/cmio/VCamIPC/src/ipcbridge.mm index 39b0705..78e4ad9 100644 --- a/cmio/VCamIPC/src/ipcbridge.mm +++ b/cmio/VCamIPC/src/ipcbridge.mm @@ -577,15 +577,21 @@ bool AkVCam::IpcBridge::deviceStart(const std::string &deviceId, UNUSED(format); AkLogFunction(); - if (!this->d->m_serverMessagePort) + if (!this->d->m_serverMessagePort) { + AkLogError() << "Service not ready." << std::endl; + return false; + } auto it = std::find(this->d->m_broadcasting.begin(), this->d->m_broadcasting.end(), deviceId); - if (it != this->d->m_broadcasting.end()) + if (it != this->d->m_broadcasting.end()) { + AkLogError() << '\'' << deviceId << "' is busy." << std::endl; + return false; + } auto dictionary = xpc_dictionary_create(nullptr, nullptr, 0); xpc_dictionary_set_int64(dictionary, "message", AKVCAM_ASSISTANT_MSG_DEVICE_SETBROADCASTING); @@ -597,6 +603,7 @@ bool AkVCam::IpcBridge::deviceStart(const std::string &deviceId, auto replyType = xpc_get_type(reply); if (replyType != XPC_TYPE_DICTIONARY) { + AkLogError() << "Invalid reply received." << std::endl; xpc_release(reply); return false; diff --git a/dshow/VCamIPC/src/ipcbridge.cpp b/dshow/VCamIPC/src/ipcbridge.cpp index bbfb250..5c7fb1a 100644 --- a/dshow/VCamIPC/src/ipcbridge.cpp +++ b/dshow/VCamIPC/src/ipcbridge.cpp @@ -598,8 +598,11 @@ bool AkVCam::IpcBridge::deviceStart(const std::string &deviceId, this->d->m_broadcasting.end(), deviceId); - if (it != this->d->m_broadcasting.end()) + if (it != this->d->m_broadcasting.end()) { + AkLogError() << '\'' << deviceId << "' is busy." << std::endl; + return false; + } std::wstring portName(this->d->m_portName.begin(), this->d->m_portName.end()); @@ -607,8 +610,11 @@ bool AkVCam::IpcBridge::deviceStart(const std::string &deviceId, this->d->m_globalMutex = Mutex(portName + L".mutex"); if (!this->d->m_sharedMemory.open(maxBufferSize, - SharedMemory::OpenModeWrite)) + SharedMemory::OpenModeWrite)) { + AkLogError() << "Can't open shared memory for writing." << std::endl; + return false; + } Message message; message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SETBROADCASTING; @@ -622,6 +628,7 @@ bool AkVCam::IpcBridge::deviceStart(const std::string &deviceId, (std::min)(this->d->m_portName.size(), MAX_STRING)); if (!this->d->m_mainServer.sendMessage(&message)) { + AkLogError() << "Error sending message." << std::endl; this->d->m_sharedMemory.close(); return false;