[osg-users] FFmpegImageStream thread safety

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Fri Jul 31 12:24:43 PDT 2020

Hi Ben,

I'm away from my dev computer so just commenting off the top of my. 
FFmpegImageStream should be double buffered so that the ffmpeg thread 
writing to the image will be writing to one part of the data, while the 
other half is available to be read by the graphics thread.  This should 
avoid threading issues.

The threading used by the ffmpeg plugin is separate from the viewer 
threading so settings related to the viewer won't be important, nor will 
general settings of the scene graph.

You should be able to just add the ffmpeg genearted imagestream to a 
texture, start the steam going and then largely forget about it.


On Friday, 31 July 2020 at 20:15:45 UTC+1 bjs.me... at gmail.com wrote:

> Hi,
> I was just looking at FFmpegImageStream, I am not very familiar with this 
> code, but I have some questions.
> It is not immediately clear to me how FFmpegImageStream::publishNewFrame 
> is thread safe.
> It seems like the image data is set (setImage) from the video decoder 
> thread.
> The image then uses a pointer to one of the buffers of the video decoder 
> (of which the contents might also change ?).
> FFmpegImageStream also doesn't seem to override requiresUpdateCall, which 
> I believe will result in the texture not being dynamic 
> (Texture2D::setImage).
> Which could be used, for example in StateSet::computeDataVariance(), to 
> determine whether the StateSet should be dynamic (which is needed for 
> multithreaded rendering).
> If anyone could shed more light on this subject, it would be very much 
> appreciated.
> Thank you.
> Cheers,
> Ben

You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/386b2bdb-9924-4d01-bc42-98565c685ac0n%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200731/4c4a837b/attachment.html>

More information about the osg-users mailing list