I'm writing a TheoraDataSource that deals primarily with an Async source. What was the intended way to deal with data not being ready? I assume if the data isn't ready we just block execution until it is?
What kind of async source? Internet streaming? Well essentially just feed data as it becomes available to the codec and when there's no more data, the decoder threads will wait for it, pausing frame decoding. This is where frame preaching feature of the lib comes in handy, so you can smooth out an uneven stream.
to answer your question, not exactly sure right now, try blocking execution (it's in another thread anyway so it won't block your main thread). alternately, return 0 bytes if nothing new is available. but I think input blocking should be ok.
Doesn't returning 0 bytes tell the decoder library that it's the end of the file though?
yeah, I thinks so too :)
Anyway, try locking and if you run into problems, we'll fix it together
It seems that naive sleeping wont do the trick. Unfortunately, whether if its in the main thread or a C# thread Unity compute time gets tied up as the manager needs some data initially to compute the metadata. Since I'm just causing the thread to sleep, what ends up happening is the async IO basically has to complete anyway which is not what I want.
I'm going to implement lazy video creation in the TheoraVideoManager. A worker thread will check a flag, and if it needs initial processing it will do it there.
ok, sure, let me know how it ends up working :)
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.