Skip to main content
Inspiring
February 3, 2022
Question

Sequence data corrupted in PF_Cmd_DO_DIALOG once PF_OutFlag2_SUPPORTS_THREADED_RENDERING is set

  • February 3, 2022
  • 2 replies
  • 875 views

Hi,


PF_Cmd_DO_DIALOG gets passed a corrupt sequence data handle as soon as I set the PF_OutFlag2_SUPPORTS_THREADED_RENDERING flag in order to support AE's new rendering/threading model in AE 22.x


Is this by design or expected and is there any way to work around this?


Thanks.

 

Best,

Reimund

This topic has been closed for replies.

2 replies

Community Manager
February 9, 2022

Hi reimundd1593001,

 

I did a quick test examining the contents of sequence_data on PF_Cmd_DO_DIALOG and I'm not able to reproduce the data corruption issue. Are you setting the sequence_data value on PF_Cmd_SEQUENCE_SETUP? Are you replacing sequence_data on a different selector and also not returning an error from that selector?

Inspiring
February 9, 2022

Thanks for your feedback, Jason. Yes, the sequence data are allocated and set in sequence setup. The same code has been working for years. The issue only occurse once I set PF_OutFlag2_SUPPORTS_THREADED_RENDERING. It's not that the data get corrupted in, but the handle I receive in in_data doesn't even seem to point to valid memory.

 

Here's a sketch of what we're doing

 

------------------------------------------------------

PF_Cmd_SEQUENCE_SETUP

AEGP_SuiteHandler suites(in_data->pica_basicP);

...
size_t sequence_data_size = ...;

PF_Handle handle = suites.HandleSuite1()->host_new_handle(sequence_data_size);
AEX_WRAPPER_CHECKPTR(handle, PF_Err_OUT_OF_MEMORY)

// Lock the handle
auto aex_data = (pi1::aex_sequence_data*) suites.HandleSuite1()->host_lock_handle(handle);
AEX_WRAPPER_CHECKPTR(aex_data, PF_Err_INTERNAL_STRUCT_DAMAGED)

out_data->sequence_data = handle;
suites.HandleSuite1()->host_unlock_handle(handle);

------------------------------------------------------

PF_Cmd_SEQUENCE_SETDOWN

AEGP_SuiteHandler suites(in_data->pica_basicP);

PF_Handle handle = in_data->sequence_data;
AEX_WRAPPER_CHECKPTR(handle, PF_Err_INTERNAL_STRUCT_DAMAGED)

...

suites.HandleSuite1()->host_dispose_handle(handle);

in_data->sequence_data = NULL;
out_data->sequence_data = NULL;

------------------------------------------------------

PF_Cmd_SEQUENCE_RESETUP

AEGP_SuiteHandler suites(in_data->pica_basicP);

PF_Handle handle = in_data->sequence_data;
AEX_WRAPPER_CHECKPTR(handle, err)

auto aex_data = (pi1::aex_sequence_data*) suites.HandleSuite1()->host_lock_handle(handle);
if(aex_data)
{
// Read sequence data and transfer to underlying component
...

suites.HandleSuite1()->host_unlock_handle(handle);
out_data->sequence_data = in_data->sequence_data;

err = PF_Err_NONE;
}
else
{
err = SequenceSetup(in_data, out_data);
}

------------------------------------------------------

PF_Cmd_SEQUENCE_FLATTEN

AEGP_SuiteHandler suites(in_data->pica_basicP);

PF_Handle handle = in_data->sequence_data;
AEX_WRAPPER_CHECKPTR(handle, err)

// NOTE: IT DOESN'T MAKE A DIFFERENCE, WHETHER I LOCK THE HANDLE HERE
auto aex_data = (pi1::aex_sequence_data*) DH(handle);

// Get state data from underlying components
size_t data_size = ...;
const void *data_ptr = ...;

::memcpy(aex_data->data, data_ptr, data_size);
out_data->sequence_data = handle;

 

I'm stuck 😕😕

Community Manager
March 5, 2022

Were you able to resolve this issue?

 

If not and if you haven't already I would suggest logging out the sequence_data handle value on each selector to see where the bad handle is coming from. The handle coming into PF_Cmd_SEQUENCE_FLATTEN is owned by the effect so it should be one that the effect allocated at some point. It is also notable there is not 

PF_Cmd_GET_FLATTENED_SEQUENCE_DATA here. See the documentation at 

PF_OutFlag2_SUPPORTS_THREADED_RENDERING in AE_Effect.h for sequence_data handling and multi-frame rendering.

Community Expert
February 6, 2022

are you using the sequnce data suite or grabbing it the old way directly from in_data?

Inspiring
February 6, 2022

I've tried both, i.e. directly accessing the handle via the DH() macro as well as locking/unlocking it via the data handle suite.

Both ways fail.

Community Expert
February 6, 2022

it shouldn't apply to a DO_DIALOG call, but are you using PF_EffectSequenceDataSuite1 on the render thread? perhaps that's where your sequence data get mangled...