Search Unity

Video Discarding thread data

Discussion in 'Audio & Video' started by lz7cjc, Mar 30, 2020.

  1. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    538
    Hi
    I have my slider set up on a streaming video and it is calling the following code:
    Code (CSharp):
    1.  
    2. public void onChangeVideoTime()
    3.     {
    4.         if (VideoPlayer.isPrepared)
    5.         {
    6.             frames = System.Convert.ToInt32(VideoPlayer.frameCount);
    7.             frameshift = System.Convert.ToInt32(timeStamp.value);
    8.             frameJump = frames * frameshift / 100;
    9.            VideoPlayer.frame = System.Convert.ToInt64(frameJump);
    10.     }
    11.  
    The video is jumping to the correct frame of the film but i am getting this error:
    Code (Boo):
    1. "Long running job detected: Thread "Job.Worker 4" in frame 1166 must have been in sync with the Main Thread, but it did not flush data for 50 frames and might be frozen.
    2. Discarding thread data.
    3. Previous 5 samples:
    4.   <Root>
    5. In the scope:
    6.   <Root>"
    Is it important? If so how do i fix?

    thanks
     
  2. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    260
    Hi!

    Is this happening on every seek or just occasionally? From the look of it, it may be due to our job system not being ready to handle decode jobs that take a while to complete, which could be the case when playing from the network. It's strange we haven't seen this happen before though.

    One thing to check is that you're not flooding the VideoPlayer with seek requests. If onChangeVideoTime is hooked directly to a slider without any sort of filtering, it could very well be that there is a long queue of seek requests that will execute in sequential order, causing many attempts to re-buffer.

    So when you start a seek (by setting the frame property) you may want to wait for the seekCompleted event before you trigger another seek. Any additional seek that comes in during this time can be noted down and only emitted when you know the previous seek has completed.

    Let us know how this goes!

    Dominique Leroux
    A/V developer at Unity
     
  3. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    538
    thanks - i will try to decipher this and make the fix (am a bit of a hacker) then let you know