-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Use locking callback from ffmpeg using a Java locking mechanism. #770
Conversation
Signed-off-by: Michael Fritscher <[email protected]>
While this change allows me to make few pretty code reorganizations, it doesnt resolve problem from referenced issue. PS. You can make some good use of CountDownLatch in Your testfile. |
@mifritscher Looks good! But I don't think we need to allocate any native memory manually with Pointer. Although what we need to return is a Pointer object, we can just return any arbitrary integer with Pointer.address, in occurrence lockCounter looks like a good candidate, and use it to query the HashMap. Also, would you have any objections in naming the class FFmpegLockCallback, for consistency with FFmpegLogCallback? |
@allocating: I don't know if I understand you correctly. If I understood the documentation correctly, I can only store a pointer to my "lockdata" to it, no real data (e.g. my Counter). It could work if I sneeze in an integer in it, but I wanted to be on the safe side (e.g. if ffmpeg do "funny things" with the pointer) Regarding rename: Choose whatever name you like ;-) |
It can't do anything to memory it doesn't allocate, so yes we can put
whatever we want as address.
|
So it is ok to break the "should" in
? |
A pointer in C/C++ is just an integer, and that's all we need. The memory
allocated is on the Java heap, so we don't need to allocate native memory.
The pointer size might be just 32 bits, yes, but that's fine.
|
* As suggested, don't allocate a Long, but save the lock number directly as value in the (void *).
O, I did made both changes and committed them. I don't know whether travis built it - https://travis-ci.org/bytedeco/javacv/builds/270335084?utm_source=github_status&utm_medium=notification says "not started", while https://travis-ci.org/bytedeco/javacv/requests says "Build created successfully" |
The build seems to be backlogged, let's wait a bit. Looks good though, thanks :) BTW, |
Signed-off-by: Michael Fritscher <[email protected]>
Don't know what way is more expensive - but you can choose now :-) |
One last thing, please remove the tabs, but looks good otherwise! Thanks |
Signed-off-by: Michael Fritscher <[email protected]>
Sorry, my eclipse uses the standard Java recommendations. I've fixed the indentation in the newest commit. |
…ses ending with "Test". Signed-off-by: Michael Fritscher <[email protected]>
Signed-off-by: Michael Fritscher [email protected]