Search Unity

GearVR Performance Issue on Download

Discussion in 'AR/VR (XR) Discussion' started by Tunkali, Mar 23, 2017.

  1. Tunkali

    Tunkali

    Joined:
    Feb 5, 2013
    Posts:
    54
    Hello folks,

    I am porting my cardboard App for Oculus Store and I needed to put my download manager into the VR-Mode.
    But whenever a moviefile finished the download (and writing to sdcard with md5 check) the whole thing is freezing a few seconds and even the VR-View got problems (becoming black for a few seconds). What can I do?

    Thank you!
     
  2. Tunkali

    Tunkali

    Joined:
    Feb 5, 2013
    Posts:
    54
    Ok, after further inspections it seems its MD5.

    74,8% CPU Load for MD5CryptoServerProvider.ProcessBlock()

    Does anybody have any suggestions how to do this more smoothly?
     
  3. SiliconDroid

    SiliconDroid

    Joined:
    Feb 20, 2017
    Posts:
    302
    Hi,

    Coroutine wont work because MD5CryptoServerProvider is blocking. So put it on a separate thread. Just make sure your interface to it is thread safe, simple way: You don't need mutexes or anything to check download state, just poll a byte (bytes are thread safe because atomic) from your main unity thread that the threaded downloader advances 0 ... 100 as it progresses. Have it set byte to different numbers >100 to report different failure modes. Then after your downloader has completely finished you can copy its finished buffer into your main thread and then release the threaded buffer to GC.
     
    Last edited: Mar 27, 2017