ZeroCopyReturnValue: Reset status properly

This commit is contained in:
2026-03-03 20:54:15 +01:00
parent 7f9f03da5f
commit 4f9c07b4fa
2 changed files with 102 additions and 11 deletions

View File

@@ -7,8 +7,8 @@
#include "ThreadSafeFIFO.h"
ZeroCopyReturnValue::ZeroCopyReturnValue(void *in_ptr, ImageBuffer &in_ctrl, uint32_t in_handle)
: ptr(in_ptr), payload_size(0), image_number(-1), buf_ctrl(in_ctrl), handle(in_handle),
indexed(false) {
: ptr(in_ptr), payload_size(0), image_number(-1), buf_ctrl(in_ctrl), handle(in_handle),
indexed(false) {
}
void ZeroCopyReturnValue::SetImageNumber(int64_t in_image_number) {
@@ -23,20 +23,21 @@ size_t ZeroCopyReturnValue::GetImageSize() const {
return payload_size;
}
void * ZeroCopyReturnValue::GetImage() const {
void *ZeroCopyReturnValue::GetImage() const {
return ptr;
}
void ZeroCopyReturnValue::release() {
if (status == ImageBufferEntryStatus::InPreparation)
ReadyToSend();
if (status == ImageBufferEntryStatus::InPreparation)
ReadyToSend();
if (status == ImageBufferEntryStatus::Sending) {
buf_ctrl.ReleaseSlot(handle);
} else {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Trying to send image that is not in preparation");
}
if (status == ImageBufferEntryStatus::Sending) {
buf_ctrl.ReleaseSlot(handle);
status = ImageBufferEntryStatus::InPreparation;
} else {
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
"Trying to send image that is not in preparation");
}
}
int64_t ZeroCopyReturnValue::GetImageNumber() const {