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:
jp9000
2015-03-07 08:47:49 -08:00
parent 724690d77e
commit 26206f6af4
2 changed files with 40 additions and 8 deletions

View File

@@ -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;
};
/* ------------------------------------------------------------------------- */