Req: Need clarification on buffer allocation
In the section 220.127.116.11 of the section in item 3, it is specified that "The allocator port allocates buffers according to the maximum of its own requirements, the requirements of the tunneled port, and the requirement of all of the sharing ports."
It seems to me that this will create some unnecessary buffer copying under certain circumstances.
One example that comes to my mind is that of encoding video.
1) Let us assume that we have a preprocessing element that gets raw video -either from a file or via a live capture- and needs to hold 3 video frames (for frame based chrome decimation or whatever reason) before sending a frame to the next component.
2) Let us assume that it is connected to a video decoder with B-frame/VOP support. The B frame encoding requires the video encoder to hold on to several video frames before returning them back to the supplier.
3) The preprocessing component is the supplier. It may be even using buffers from a HW video capture unit. Assume that buffer sizes between the two components are the same.
4) The video encoder needs to hold on to 3 frames to encode a B frame -I believe it may be even more for some prfiles of H.264-.
5) The input port of the video encoder component would specify its buffer requirements as 3 frames when queried by the preprocessing component.
6) The preprocessor also needs 3 frames. Therefore when allocating the buffers the preprocessor component will allocate only 3 buffers, which is the maximum of the requirements of the two components.
7) The preprocessor components calls EmptyThisBufer on the encoder only after it fills in all 3 buffers.
8) It cannot send the other two since it will need them later.
9) The encoder cannot call FillThisBuffer on preprocessor since it cannat send it back until it acquires 3 buffers to encode the B frame.
10) The system would lock up unless the video encoder copies all buffers sent from the prerocessor to internal buffers and send them back to preprocessor immediately.
11) That is a significant overhead, which could be traded to using extra memory should the allocator had allocated 6 buffers (actually 7 is better so that there will be true concurrency) instead of allocating 3.
I guess I did not understand something correctly.
I would appreciate any feedback.