Skip to content
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

Merged
merged 8 commits into from
Sep 13, 2017
Merged

Use locking callback from ffmpeg using a Java locking mechanism. #770

merged 8 commits into from
Sep 13, 2017

Conversation

mifritscher
Copy link
Contributor

Signed-off-by: Michael Fritscher [email protected]

@mastah84
Copy link

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.

@saudet
Copy link
Member

saudet commented Aug 29, 2017

@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?

@mifritscher
Copy link
Contributor Author

@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 ;-)

@saudet
Copy link
Member

saudet commented Aug 30, 2017 via email

@mifritscher
Copy link
Contributor Author

mifritscher commented Aug 30, 2017

So it is ok to break the "should" in

the "mutex" argument to the function points to a (void *) where the lockmgr should store/get a pointer to a user allocated mutex.

?
Another thing is that a pointer is 32 bit on some architectures, 64 bit on others. If you want I can try to save a 32 bit counter as "pointer".

@saudet
Copy link
Member

saudet commented Aug 31, 2017 via email

  * As suggested, don't allocate a Long, but save the lock number directly as value in the (void *).
@mifritscher
Copy link
Contributor Author

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"

@saudet
Copy link
Member

saudet commented Aug 31, 2017

The build seems to be backlogged, let's wait a bit. Looks good though, thanks :)

BTW, new IntPointer(mutex).get()/put() is probably more efficient. Creating a Buffer is pretty expensive...

Signed-off-by: Michael Fritscher <[email protected]>
@mifritscher
Copy link
Contributor Author

mifritscher commented Aug 31, 2017

Don't know what way is more expensive - but you can choose now :-)
Hmm, https://www.traviscistatus.com/ doesn't mention a major backlog... (We don't build on MacOS X here, do we?^^)

@saudet
Copy link
Member

saudet commented Sep 1, 2017

One last thing, please remove the tabs, but looks good otherwise! Thanks

Signed-off-by: Michael Fritscher <[email protected]>
@mifritscher
Copy link
Contributor Author

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]>
@saudet saudet merged commit 8da8c8e into bytedeco:master Sep 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants