Recently we received a question about a crash while calling FBPlayerControl::GotoStart() from within a device real-time engine thread. It seems this worked fine up to MoBu 2014, and crashes in Mobu 2015.ide
Actually, it's possible it worked in previous Mobu versions, but as the best practice, it’s not suggested because the SDK doc clearly says that some methods like DeviceIONotify() and DeviceEvaluationNotify() are called by the Real-time engine thread, and they should consume as little CPU time as possible and return as soon as possible. So it should contain only minimal operations, and especially should avoid UI related operations like FBPlayerControl::GotoStart().this
Back to the problem itself, so how to solve this issue? Any workaround for this? Let’s take this as an example:lua
The problem is that this was reported in a device plugin, and they wanted to control the transport control player from an external device, so they’d like to fire the FBPlayerControls from within the method of DeviceIONotify() or DeviceEvaluationNotify(). spa
To solve the problem, you can remove the UI operation codes(FBPlayerControl::GotoStart()) out of the real-time engine( DeviceIONotify() and DeviceEvaluationNotify() ) methods, and just save the status of the operation. Then use the system OnUIIdle callback to check the status, and if needing to operate the transport control, call the FBPlayerControl::GotoStart(). The main code is as follow, and this then prevents the crash.code
Initialize the following code like:blog
Update the DeviceEvaluationNotify to save the status:ip
Call the UI operation inside a UI Idle event:ci