-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/138 #139
Feature/138 #139
Conversation
@RyanYANG52 I have made some changes, so please try it in your environment. Buffer pooling is done in the var cameraDevices = new CameraDevices(new YourOwnBufferPool());
// ...
|
@RyanYANG52 Hmm, the last commit contains a bug, I forgot calling As a matter of fact, I think that in a situation where |
e7f4c5e works, in my case after 1-2 second it can be reused for most of frames, I will look into the BufferPool impl in weekend. |
I look into the BufferPool feature, for my use case (no transcode) my camera jpeg size increase from 13k to 30k about 30 frame after initial start, DefaultBufferPool may not be suitable. However with a BufferPool abstraction, I could create my impl like you said. Maybe just one byte array as cache, if size is not enough then create a new array with double capacity , like List does inside. |
You are correct. I will continue to modify the current |
@RyanYANG52 Implemented buffer returner, could you please test it? |
1I test in my PC, it works. But I'm not still sure about the
for default impl, the max retained memory in pool would be around 16 * 13 * 400k = ~80M for this simple buffer provider, I only get one or two Rent call per capture public class NoneBufferPool : BufferPool
{
public override byte[] Rent(int size, bool exactSize)
{
Debug.WriteLine($"NoneBufferPool: Rent: {size}, {exactSize}");
return new byte[exactSize ? size: size * 2];
}
public override void Return(byte[] buffer)
{
}
} I think mjpeg web camera is relatively main stream, if add current 2Another thing is for YUV and transcode frames, they rent exactSize and only return when size is less then current, which should never happen (not sure) because size does not change per PixelBuffer. So I think for 3Rent and Return is not matched; PixelBuffer currently has no dispose or clean method, FrameProcessor has one, when it disposes |
How about this changes?
In practice, I believe that in MJPEG, the sizes rarely match, and as a result,
You are correct, I have fix it.
I was wondering if I should implement Therefore, if I implement |
I love it, simple & powerful, and with WeakReference, |
Will write docs and merge, thanks! |
No description provided.