diff --git a/src/SourceImpl.cpp b/src/SourceImpl.cpp index 3bc2c596d2..d5db1f9604 100644 --- a/src/SourceImpl.cpp +++ b/src/SourceImpl.cpp @@ -88,8 +88,9 @@ llvm::ArrayRef SourceImpl::EnumerateProperties( if (!m_properties_cached && !CacheProperties(status)) return llvm::ArrayRef{}; std::lock_guard lock(m_mutex); - for (int i = 0; i < static_cast(m_propertyData.size()); ++i) - vec.push_back(i + 1); + for (int i = 0; i < static_cast(m_propertyData.size()); ++i) { + if (m_propertyData[i]) vec.push_back(i + 1); + } return vec; } diff --git a/src/USBCameraImpl.cpp b/src/USBCameraImpl.cpp index b41ce5fa23..28dd07d229 100644 --- a/src/USBCameraImpl.cpp +++ b/src/USBCameraImpl.cpp @@ -636,7 +636,7 @@ void USBCameraImpl::DeviceConnect() { std::unique_lock lock2(m_mutex); for (std::size_t i = 0; i < m_propertyData.size(); ++i) { const auto& prop = m_propertyData[i]; - if (!prop->valueSet) continue; + if (!prop || !prop->valueSet) continue; if (!DeviceSetProperty(lock2, static_cast(*prop))) WARNING("USB " << m_path << ": failed to set property " << prop->name); } @@ -786,7 +786,11 @@ void USBCameraImpl::DeviceProcessCommands() { } else if (newMode.fps != m_mode.fps) { m_mode = newMode; lock.unlock(); + // Need to stop streaming to set FPS + bool wasStreaming = m_streaming; + if (wasStreaming) DeviceStreamOff(); DeviceSetFPS(); + if (wasStreaming) DeviceStreamOn(); Notifier::GetInstance().NotifySource(*this, CS_SOURCE_VIDEOMODE_CHANGED); lock.lock();