copied.ptr = new unsigned char[buffer_size];
memcpy(copied.ptr, preprocessed.ptr, buffer_size);
- auto_zoom->getAsyncManager()->pushInput(copied);
+ // Make sure to release copied buffer if incoming queue isn't empty so skipped pushing the buffer.
+ if (auto_zoom->getAsyncManager()->pushInput(copied) < 0)
+ delete copied.ptr;
}
bool AutoZoom::isKeyValid(std::string key)
// This function will be called by specific input service internally.
// Ps. caller has to provide captured data with concrete class object as data parameter.
- void pushInput(In &in_data)
+ int pushInput(In &in_data)
{
// This callback will be called by platform specific input feed module.
// The input feed module calls this callback with captured data after capturing data such as
// If input data exists in incoming queue then skip a new one.
// TODO. consider for multiple input data later.
if (!_incoming_queue.empty())
- return;
+ return -1;
_incoming_queue.push(in_data);
_incoming_queue_event.notify_one();
+
+ return 0;
}
void pushOutput(Out &result)