Log in or register to post comments

VideoPlayback, video freeze after first frames or low frame rate

October 30, 2015 - 1:53am #1
Hello.
 
This thread has been derived from the following: 
 
 
I use the VideoPlayback on AR Marker.
The Video freeze after first frames or low frame rate on iOS iPad in my app.
 
These problem occurs on:
iPad2 iOS: 8.4.1
iPad3 iOS: 9.0.2
 
It works fine on:
iPhone5s iOS: 9.1
iPad4 iOS: 9.1
 
[our survey info]
I added a log in "getNextVideoFrame" method on "VideoPlayerHelper.m".
 
When the camera is find the AR marker, it seems delta variable is growing.
And, because the delta variable is not less than "1 / video frame rate", the syncStatus variable will not be SYNC_READY.
 
if (delta <1 / videoFrameRate) {
  // Video in sync with audio
  syncStatus = SYNC_READY;
}
 
When the camera loses the AR marker, it seems delta variable is reduced.
 
 
I do not know why delta variable continues to increase.
 
- CPU Type?
 
- I implements other process with AR marker finding.
This process will take a load on the CPU (more than Vuforia Playback Sample.)
Is it influence to Calculate for the delta variable?
 
- We got such advice in the past.
However, this time, it does not resolve when I changed the thread priority.
 
 
My current versions are:
Vuforia 5.0.5
VideoPlayback libs from sample 5.0.5
Xcode 7.1
Unity 5.2.1f1
 

VideoPlayback, video freeze after first frames or low frame rate

November 1, 2015 - 11:31pm #5

See also latest comment here:

https://developer.vuforia.com/forum/unity-extension-technical-discussion/videoplayback-video-freeze-after-first-frames-xcode-71-io

it seems some combination of device + iOS version may be subject to a more severe CPU overhead (as you also observed), in general, but in particular when running connected to Xcode; on the other hand, accoridng to the thread above, if you run disconnected from Xcode, things should run much smoother; also worth comparing debug mode with release mode

 

VideoPlayback, video freeze after first frames or low frame rate

November 1, 2015 - 9:50pm #4
Thanks for your quick reply.
 
> have you tried setting the threadPriority to a slightly higher value, for example to 0.6 instead of 0.5 ?
>
Yes. 
I had set the threadPriority to 0.6, 0.75 or 0.9 before I asked you on the referenced thread.
 
 
I recorded the running video with the threadPriority setting to 0.9 on iPad.
- It seems freezed at first time.
- After 20 sec., It Lost and re-found a AR Marker, The video was skip some frames and freezed.
- and after 30 sec. the movie was played with low frame rate.
(In case of the threadPriority to 0.6, almost same.)
 
 
Here is the log file and the VideoPlayerHelper.m.
search keyword : 'delta='
 
The frame timer fire event looks fine.
In 'while' statement loop on the getNextVideoFrame method,
I can not understand that the difference between the caCurrentTime variable and the frameTimeStamp variable increases.
 

VideoPlayback, video freeze after first frames or low frame rate

October 30, 2015 - 5:14am #3

Forgot one additional tip:

have you tried setting the threadPriority to a slightly higher value, for example to 0.6 instead of 0.5 ? 

 

 

VideoPlayback, video freeze after first frames or low frame rate

October 30, 2015 - 5:10am #2

In reference to this thread:

https://developer.vuforia.com/forum/ios/ios-8-video-playback-frame-rate-0

the suggested code change ( ...[[NSThread currentThread] setThreadPriority:0.5] ...) is meant to give a "hint" to the OS, so that the video timer thread is not "left behind" other tasks;  

however, setting the thread priority does not provide a deterministic guarantee of the actual execution timing; for example, if your Application is running additional CPU-intensive tasks, the OS may pick up your timer at a lower frequency than in a case where the CPU load is low;

this may also vary from one device (CPU) to another, for example, a faster and/or multi-core CPU might be able to handle many more tasks simultaneously without impacting the average callback rate of your timer.

 

You mention:

- I implements other process with AR marker finding.
This process will take a load on the CPU (more than Vuforia Playback Sample.)

this sounds like you are probably loading your device CPU (and possibly other resources, such as memory and GPU) more severely than in the VP sample app, with a resulting side effect on the video timer execution rate.

Have you checked if there are any opportunities of code optimization in your App, that could save or reduce some of the CPU load ? 

Another thing to consider is the video format and resolution; for example, if the resolution of your video is very large, it could take a lot more time and a lot more CPU to upload each frame to the video texture.

 

 

Log in or register to post comments