I am hitting a segfault when rendering my edit on a separate thread using:
tracktion_engine::Renderer::renderToFile(
"Render", renderFile, edit, range, tracksToDo, true, {}, true);
The last argument is the useThread boolean which ive set to true.
I have a component that consumes a level measurer object:
LevelMeterComponent::LevelMeterComponent(tracktion_engine::LevelMeasurer &lm,
int chan)
: channel(chan), levelMeasurer(lm) {
...
...
levelMeasurer.addClient(levelClient);
}
and I create the component like so and pass in the master track levels:
std::make_unique<LevelMeterComponent>(
t->edit.getCurrentPlaybackContext()->masterLevels, 0)
however this causes a segfault when rendering on a separate thread when it calls the addClient method of the measurer. This ONLY happens with the master levels. If I use a regular tracks measurer like this:
std::make_unique<LevelMeterComponent>(
track->pluginList
.getPluginsOfType<tracktion_engine::LevelMeterPlugin>()
.getLast()
->measurer,
0)
things work fine. Things also work fine if I render on the main thread instead. It makes me think I am not using the correct way of obtaining the level measurer for the master track, and that I am running into some thread safety issue with the master measurer object. Is there a better way of getting it other than t->edit.getCurrentPlaybackContext()->masterLevels
?