CiPointCloudViewer icon indicating copy to clipboard operation
CiPointCloudViewer copied to clipboard

OpenNI2CloudDataSource - Cannot subscribe to more than one stream

Open jc211 opened this issue 8 years ago • 0 comments

Hi, I've been trying to get this working with my kinect2, but it seems that it will crash when a clouddatasource subscribes to more than one stream.

The error is here:

void OpenNI2CloudDataSource::onStart() {
  util::checkStatus(device_.open(uri_.c_str()), "openni::Device::open() failed.");

  startColorStream();
  startDepthStream();
  //startIrStream();
  enableMirroring();
  enableDepthToColorRegistration();
}

Looking at the OpenNI2 source code:

	/**
	Adds a new Listener to receive this VideoStream onNewFrame event.  See @ref VideoStream::NewFrameListener for
	more information on implementing an event driven frame reading architecture. An instance of a listener can be added to only one source.

	@param [in] pListener Pointer to a @ref VideoStream::NewFrameListener object (or a derivative) that will respond to this event.
	@returns Status code indicating success or failure of the operation.
	*/
	Status addNewFrameListener(NewFrameListener* pListener)
	{
		if (!isValid())
		{
			return STATUS_ERROR;
		}

		return (Status)oniStreamRegisterNewFrameCallback(m_stream, pListener->callback, pListener, &pListener->m_callbackHandle);
	}

"An instance of a listener can be added to only one source."

So I'm not sure if this approach would work.

jc211 avatar Jun 27 '17 08:06 jc211