>Ok, understood, but why we can't just continue doing > >while (have_frames(MY_POOL_ID)) { > FrameBuffer *frame = framebuffer_get(MY_POOL_ID); > do_some_processing(frame); > frame->id = my_frame_num++; > framebuffer_put(frame, NEXT_POOL_ID); // the frame->status switch is > // actually done here >} > >like we already do? >(our current code is not that different, see for example >frame_threads.c , and vframe_reserve/vframe_push_next and their >implementation) > >In a nutshell, why can't just pass away the old frame recycling it?
Because then we'd have to add framebuffer_free(frame) calls to every filter that doesn't have a 1:1 correspondence between frames. Admittedly, I don't think there are very many filters like that (modfps, decimate, 29to23, ...) but I'm more concerned about the possibility of resource leakage in general. As a rule, I prefer a mechanism that's robust against leakage (e.g. by having a single free() call that applies to every module) over one which relies on multiple modules to all do the right thing (e.g. call free() if they don't put() the same frame buffer). --Andrew Church achu...@achurch.org http://achurch.org/