javacv icon indicating copy to clipboard operation
javacv copied to clipboard

is grabber's startUnsafe have any risk?

Open ggslayer opened this issue 1 year ago • 2 comments

Hi, I met a problem when grab local video file and remote rtmp concurrent, when the rtmp is no stream, the rtmp's grabber's start method will block in the start method by rw_timeout,in this time, if local file 's grabber's start called, this call will block by the code in start method : synchronized (org.bytedeco.ffmpeg.global.avcodec.class)

So, I found the no synchronized version: startUnsafe and releaseUnsafe,I use them in the unstable rtmp situation and start/stop in local file, there is no problem found.

But, I worried about the "unsafe", Can you tell me is there some risk about the startunsafe/releaseUnsafe ? thank you!

ggslayer avatar May 24 '23 03:05 ggslayer

Some codecs are not thread-safe, but if the codecs you are using are thread-safe, then we don't need the extra synchronization.

saudet avatar May 24 '23 04:05 saudet

In my scene, the libx264 and libacc are used, do you know and can you tell me they are thread safe? thank you @saudet

ggslayer avatar May 24 '23 05:05 ggslayer