Login  Register

Re: playing audio from an AVI file...

Posted by TheLittleP on Mar 18, 2014; 5:31pm
URL: https://forum.jogamp.org/playing-audio-from-an-AVI-file-tp4031894p4031960.html

Im quite taken aback that something I created is "neat" lol

There is an issue with it though. It currently waits the frame time (66milliseconds) and then fetches the audio and video buffers. The problem is it takes too long to process the audio buffer so the audio sink effectives runs out and stops and hence why only a second or 2 plays.

My solution has been to pre-fetch the buffers of the next frame and submit the audio buffer so it is processed and queued before the current buffer runs out. I then wait the 66ms before submitting the image buffer and it works a treat. I create a new thread for each buffer processing so the main thread with a wait of 66ms has minimal latency.

I have wondered if the memory overhead of creating 16 new threads every second would cause a problem but I presume as they are most likely added to the garbage collector before the next 1 is created that it shouldn't be too much of an issue.

I have been a right film director today with lights, camera and action lol. The performers I have to run the script with have been exceptional!

Many Thanks Xerxes

Regards
P