libobs: Use reference counting with source frames
When a frame is processed by a filter, it comes directly from the source's video frame cache. However, if a filter is using or processing those frames for whatever reason, there would be no guarantee that the frames would persist during processing, and frames could eventually be deallocated unexpected, for example when the resolution or format changes. So the solution is to implement simple reference counting for the frames so that the frames will exist until they have been released by any source or filter that's using them.
This commit is contained in:
@@ -228,6 +228,9 @@ struct obs_source_frame {
|
||||
float color_range_min[3];
|
||||
float color_range_max[3];
|
||||
bool flip;
|
||||
|
||||
/* used internally by libobs */
|
||||
volatile long refs;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user