livoxGen1: Disable pcloudData IFF stimbuff is last being removed
This commit is contained in:
@@ -511,16 +511,16 @@ livoxGen1_detachDeviceCReq(
|
|||||||
// Case 2: StimBuffer exists - proceed with detach
|
// Case 2: StimBuffer exists - proceed with detach
|
||||||
auto requestComponentThread = stimProducer->device->componentThread;
|
auto requestComponentThread = stimProducer->device->componentThread;
|
||||||
|
|
||||||
/** FIXME:
|
// Remove StimBuffer from collection if it exists
|
||||||
* We always disable Livox pcloud sampling here, even when other
|
stimProducer->destroyAttachedStimulusBuffer(stimBuffer);
|
||||||
* StimBuffers on this PcloudStimulusProducer will remain attached.
|
|
||||||
* That leaves surviving qualae without a device stream until something
|
// Check if StimProducer has other buffers
|
||||||
* re-enables pcloud (e.g. a later attach). PcloudStimulusProducer::
|
if (!stimProducer->attachedStimulusBuffers.empty()) {
|
||||||
* destroyAttachedStimulusBuffer() stop()/start() only pauses the SMO
|
// Other buffers exist - just remove this buffer, done
|
||||||
* io_uring/OpenCL frame pipeline for buffer-list mutation; it does not
|
co_return StimBuffDeviceOpResult{true, desc};
|
||||||
* turn Livox sampling back on. Only call disable when detaching the
|
}
|
||||||
* last buffer, or re-enable after a partial detach when buffers remain.
|
|
||||||
*/
|
// Last buffer on producer: disable pcloud before tearing down device
|
||||||
// Disable point cloud data first
|
// Disable point cloud data first
|
||||||
const bool disabled = co_await coAwaitDisablePcloudData(
|
const bool disabled = co_await coAwaitDisablePcloudData(
|
||||||
requestComponentThread, stimProducer->device);
|
requestComponentThread, stimProducer->device);
|
||||||
@@ -540,25 +540,6 @@ livoxGen1_detachDeviceCReq(
|
|||||||
requestComponentThread->getIoService(),
|
requestComponentThread->getIoService(),
|
||||||
boost::posix_time::milliseconds(LIVOX_GEN1_DEVICE_COMMAND_DELAY_MS));
|
boost::posix_time::milliseconds(LIVOX_GEN1_DEVICE_COMMAND_DELAY_MS));
|
||||||
|
|
||||||
// Callback for the delayed destroyDeviceReq
|
|
||||||
// Remove StimBuffer from collection if it exists
|
|
||||||
if (!stimBuffer)
|
|
||||||
{
|
|
||||||
throw std::runtime_error(std::string(__func__)
|
|
||||||
+ ": stimBuffer (API: " + desc->stimBuffApi + ") "
|
|
||||||
+ "is missing in detachDeviceReq1_delayed "
|
|
||||||
+ "for device " + desc->deviceSelector);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the producer from the buffer's parent
|
|
||||||
stimProducer->destroyAttachedStimulusBuffer(stimBuffer);
|
|
||||||
|
|
||||||
// Check if StimProducer has other buffers
|
|
||||||
if (!stimProducer->attachedStimulusBuffers.empty()) {
|
|
||||||
// Other buffers exist - just remove this buffer, done
|
|
||||||
co_return StimBuffDeviceOpResult{true, desc};
|
|
||||||
}
|
|
||||||
|
|
||||||
// No other buffers - stop and remove StimProducer
|
// No other buffers - stop and remove StimProducer
|
||||||
stimProducer->stop();
|
stimProducer->stop();
|
||||||
// Remove stimulus producer from collection before destroying device
|
// Remove stimulus producer from collection before destroying device
|
||||||
|
|||||||
Reference in New Issue
Block a user