-
Notifications
You must be signed in to change notification settings - Fork 47
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
Check if the frame is writable before copyPlanes #84
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I forced the frame to be writable by adding .MakeWritable()
when copying planes but then I realized the developer should be free to decide when to make the frame writable. However checking whether the frame is writable seems like a good idea even though I don't really know whether this is a big performance drop 👍
Could you also add tests for this use case? Something like the following added here(after a newline)
f3 := astiav.AllocFrame()
defer f3.Free()
require.NoError(t, f3.Ref(f2))
require.Error(t, fd2.FromImage(i1))
require.Error(t, fd2.SetBytes(b1, align))
frame_data_test.go
Outdated
require.NoError(t, f3.Ref(f2)) | ||
require.Error(t, fd2.FromImage(i1)) | ||
require.Error(t, fd2.SetBytes(b1, align)) | ||
f3.MakeWritable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f2
should be the frame that we make writable here
Thanks for the PR! ❤️ Let me know whether you need a tag 👍 |
Please tag this as well 🚀 |
I've created a |
* check if the frame is writable before copyPlanes * apply review * make f2 writable
For safety of frame operations, check if the frame is writable before copyPlanes.
If this seems to be a performance overhead, I would like input as this PR may not be necessary.