Log in or register to post comments

videoplayback loading 5 videos at time app crashing

August 9, 2013 - 5:00am #1

Hi VuforiaTeam

     in my app i am loading 5 videos, after coming to the camera screen app crashing, if i put 2 video app working fine, so can you give me some code to load video dynamically, means after detecting the target i want to load that video please provide me Sample code.

 

Regrads

Nag

videoplayback loading 5 videos at time app crashing

September 6, 2013 - 4:01am #6

I think I first have to clear out what i try to achieve: I want to play one video at a time and clean up its resources thorougly, so that I can play dozens of videos one after another without running into troubles. I think that should be very well feasable, but I also agree that due to limited resources it's impossible to play multiple videos at time on crappy devices :)

I have to admit that my test was/is not very well crafted. I worked a little bit on it (update's attached) and now it's much more stable. But again, after like 20 video switches it freezes (on a Samsung Galaxy Tab 8.9 GT-P7310 running Android 4.0.4). Unfortunately I don't have the GT-P5110 anymore, which was the best testing device, because it crashed very soon.

Now what bugs me is: Am I doing everything I can do right to make it happen or is there something like a memory leak within Vuforia's MediaPlayer/AwesomePlayer that happens to cause the trouble?

I still need to investigate further, but for now I'm gonna ship my app with a fallback ( we use another video library for pre 4.0 Android devices anyways; but this one has other disadvantages ).

Any hint or help is still highly appreciated!

Thanks Alessandro!

edit: I just saw my test still plays multiple videos at a time eventually. so no need to test it, if it's still buggy.

edit 2: hold on, I made a fix that is better (still allows playback of 2 simultaniously in certain cases), but stayed stable after like 50 video switches. I updated the file. hoooray!

AttachmentSize
Package icon ManyVideos.unitypackage.zip21.34 KB

videoplayback loading 5 videos at time app crashing

September 5, 2013 - 7:15am #5

I attached a PDF of a Frame marker collage for convenient testing.

here's a log of e reproduceable bug. I track Markers 0,1,2 and 4 (in that order). The first 3 start to play as expected, the FrameMarker4 fails to load:

errors on the Samsung GT-P5110:
 
09-05 16:06:54.390: I/Unity(3790): Trackable FrameMarker4 found
09-05 16:06:54.390: I/Unity(3790): UnityEngine.Debug:Internal_Log(Int32, String, Object)
09-05 16:06:54.390: I/Unity(3790): UnityEngine.Debug:Log(Object)
09-05 16:06:54.390: I/Unity(3790): TrackableEventHandler:OnTrackingFound() (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Scripts/TrackableEventHandler.cs:127)
09-05 16:06:54.390: I/Unity(3790): TrackableEventHandler:OnTrackableStateChanged(Status, Status) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Scripts/TrackableEventHandler.cs:94)
09-05 16:06:54.390: I/Unity(3790): TrackableBehaviour:OnTrackerUpdate(Status) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/TrackableBehaviour.cs:142)
09-05 16:06:54.390: I/Unity(3790): StateManagerImpl:UpdateTrackablePoses(Camera, TrackableResultData[], Int32, Int32) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/Internal/StateManagerImpl.cs:497)
09-05 16:06:54.390: I/Unity(3790): QCARManagerImpl:UpdateTrackers(FrameState) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/Internal/QCARManagerImpl.cs:485)
09-05 16:06:54.390: I/Unity(3790): QCARManagerImpl:Update(ScreenOrientation, CameraDeviceMode, VideoModeData&) (at /Users/andreas/VuforiaVideoMemoryTest/As
09-05 16:06:54.406: I/Unity(3790): VideoPlaybackBehaviour.Init
09-05 16:06:54.406: I/Unity(3790): UnityEngine.Debug:Internal_Log(Int32, String, Object)
09-05 16:06:54.406: I/Unity(3790): UnityEngine.Debug:Log(Object)
09-05 16:06:54.406: I/Unity(3790): VideoPlaybackBehaviour:Init() (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Vuforia Video Playback/Scripts/VideoPlaybackBehaviour.cs:338)
09-05 16:06:54.406: I/Unity(3790): TrackableEventHandler:OnTrackingFound() (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Scripts/TrackableEventHandler.cs:153)
09-05 16:06:54.406: I/Unity(3790): TrackableEventHandler:OnTrackableStateChanged(Status, Status) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Scripts/TrackableEventHandler.cs:94)
09-05 16:06:54.406: I/Unity(3790): TrackableBehaviour:OnTrackerUpdate(Status) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/TrackableBehaviour.cs:142)
09-05 16:06:54.406: I/Unity(3790): StateManagerImpl:UpdateTrackablePoses(Camera, TrackableResultData[], Int32, Int32) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/Internal/StateManagerImpl.cs:497)
09-05 16:06:54.406: I/Unity(3790): QCARManagerImpl:UpdateTrackers(FrameState) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/Internal/QCAR
09-05 16:06:54.406: I/Unity(3790): VideoPlaybackBehaviour Update: Init
09-05 16:06:54.406: I/Unity(3790): UnityEngine.Debug:Internal_Log(Int32, String, Object)
09-05 16:06:54.406: I/Unity(3790): UnityEngine.Debug:Log(Object)
09-05 16:06:54.406: I/Unity(3790): VideoPlaybackBehaviour:Update() (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Vuforia Video Playback/Scripts/VideoPlaybackBehaviour.cs:188)
09-05 16:06:54.406: I/Unity(3790):  
09-05 16:06:54.406: I/Unity(3790): (Filename: /Users/andreas/VuforiaVideoMemoryTest/Assets/Vuforia Video Playback/Scripts/VideoPlaybackBehaviour.cs Line: 188)
09-05 16:06:54.414: V/AwesomePlayer(98): setDefault
09-05 16:06:54.414: V/AwesomePlayer(98): constructor
09-05 16:06:54.414: V/AwesomePlayer(98): setDefault
09-05 16:06:54.414: I/AwesomePlayer(98): reset
09-05 16:06:54.414: I/AwesomePlayer(98): cancel player events
09-05 16:06:54.414: V/AwesomePlayer(98): mAudioTrackVector clear
09-05 16:06:54.414: V/AwesomePlayer(98): setListener
09-05 16:06:54.414: V/AwesomePlayer(98): AwesomePlayer running on behalf of uid 10105
09-05 16:06:54.414: V/AwesomePlayer(98): setAudioSink
09-05 16:06:54.414: V/AwesomePlayer(98): setDataSource (345, 44698204, 10042243)
09-05 16:06:54.414: I/AwesomePlayer(98): cancel player events
09-05 16:06:54.414: V/AwesomePlayer(98): mAudioTrackVector clear
09-05 16:06:54.414: D/DivXPlugin(97): DivXPlugin::onInitialize : 4865
09-05 16:06:54.414: D/DivXPlugin(97): DivXPlugin::onSetOnInfoListener : 4865
09-05 16:06:54.414: D/DivXPlugin(97): DivXPlugin::onTerminate : 4865
09-05 16:06:54.429: V/AwesomePlayer(98): track of type 'video/avc' does not publish bitrate
09-05 16:06:54.429: V/AwesomePlayer(98): mBitrate = -1 bits/sec
09-05 16:06:54.429: V/AwesomePlayer(98): current audio track (0)
09-05 16:06:54.429: V/AwesomePlayer(98): current audio track (0) is added to vector[0]
09-05 16:06:54.429: V/AwesomePlayer(98): setDataSource_l: Audio(1), Video(1)
09-05 16:06:54.429: V/AwesomePlayer(98): prepareAsync
09-05 16:06:54.429: V/AwesomePlayer(98): onPrepareAsyncEvent
09-05 16:06:54.429: V/AwesomePlayer(98): initVideoDecoder flags=0x0
09-05 16:06:54.437: I/OMXCodec(98): [OMX.TI.DUCATI1.VIDEO.DECODER] AVC profile = 66 (Baseline), level = 30
09-05 16:06:54.445: I/OMXCodec(98): [OMX.TI.DUCATI1.VIDEO.DECODER] video dimensions are 640 x 360
09-05 16:06:54.445: I/OMXCodec(98): [OMX.TI.DUCATI1.VIDEO.DECODER] Crop rect is 640 x 360 @ (0, 0)
09-05 16:06:54.445: W/(98): MetaData::findData() - return false
09-05 16:06:54.445: D/SensorManager(2904): unregisterListener:: disable all sensors for this listener,  name = BMA254 Acceleration Sensor listener = dtq@412f66d8
09-05 16:06:54.460: D/DOMX(98): ERROR: failed check:(eError == OMX_ErrorNone) || (eError == OMX_ErrorNoMore) - returning error: 0x80001018 - Error returned from OMX API in ducati
09-05 16:06:54.460: D/DOMX(98): ERROR: PROXY_UseBuffer in PROXY_AllocateBuffer failed with error -2147479528 (0x80001018)
09-05 16:06:54.460: E/OMXNodeInstance(98): OMX_AllocateBuffer failed with error -2147479528 (0x80001018)
09-05 16:06:54.460: E/OMXCodec(98): allocate_buffer_with_backup failed
09-05 16:06:54.460: W/AwesomePlayer(98): initVideoDecoder mVideoSource->start failed
09-05 16:06:54.460: W/AwesomePlayer(98): onPrepareAsyncEvent() initVideoDecoder error(-2147483648)
09-05 16:06:54.460: W/AwesomePlayer(98): abortPrepare() mIsAsyncPrepare (1), err (-2147483648)
09-05 16:06:54.460: V/AwesomePlayer(98): notifyListner_l() msg (100-MEDIA_ERROR), ext1 (1), ext2 (-2147483648)
09-05 16:06:54.460: E/OMXCodec(98): [OMX.TI.DUCATI1.VIDEO.DECODER] ERROR(0x80001000, 0)
09-05 16:06:54.460: E/ion(98): ioctl -1073460991 failed with code -1: Bad file number
09-05 16:06:54.460: E/ion(98): ioctl -1073460991 failed with code -1: Bad file number
09-05 16:06:54.460: V/AwesomePlayer(98): setSurfaceTexture
09-05 16:06:54.460: E/MediaPlayer(3790): error (1, -2147483648)
09-05 16:06:54.460: D/DOMX(98): ERROR: failed check:(eError == OMX_ErrorNone) || (eError == OMX_ErrorNoMore) - returning error: 0x80001000 - Error returned from OMX API in ducati
09-05 16:06:54.460: D/DOMX(98): ERROR: Error From ComponentDeInit..
09-05 16:06:54.460: W/libutils.threads(98): Thread (this=0x331e90): don't call join() from this Thread object's thread. It's a guaranteed deadlock!
09-05 16:06:54.468: E/MediaPlayer(3790): Error (1,-2147483648)
09-05 16:06:54.468: E/VuforiaMedia(3790): Error while opening the file. Unloading the media player
09-05 16:06:54.468: E/MediaPlayer(3790): stop called in state 0
09-05 16:06:54.468: E/MediaPlayer(3790): error (-38, 0)
09-05 16:06:54.468: I/AwesomePlayer(98): reset
09-05 16:06:54.468: I/AwesomePlayer(98): cancel player events
09-05 16:06:54.468: V/AwesomePlayer(98): mAudioTrackVector clear
09-05 16:06:54.476: I/AwesomePlayer(98): reset
09-05 16:06:54.476: I/AwesomePlayer(98): cancel player events
09-05 16:06:54.476: V/AwesomePlayer(98): mAudioTrackVector clear
09-05 16:06:54.476: V/AwesomePlayer(98): destructor
09-05 16:06:54.476: I/AwesomePlayer(98): reset
09-05 16:06:54.476: I/AwesomePlayer(98): cancel player events
09-05 16:06:54.476: V/AwesomePlayer(98): mAudioTrackVector clear
09-05 16:06:54.476: W/MediaPlayer(3790): mediaplayer went away with unhandled events
09-05 16:06:54.539: I/Unity(3790): Could not load video 'VuforiaSizzleReel_5.m4v' for media type ON_TEXTURE_FULLSCREEN
 
The same behaviour (but a different error log) on a Nexus 10:
09-05 16:12:33.703: I/Unity(13142): Trackable FrameMarker4 found
09-05 16:12:33.703: I/Unity(13142): UnityEngine.Debug:Internal_Log(Int32, String, Object)
09-05 16:12:33.703: I/Unity(13142): UnityEngine.Debug:Log(Object)
09-05 16:12:33.703: I/Unity(13142): TrackableEventHandler:OnTrackingFound() (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Scripts/TrackableEventHandler.cs:127)
09-05 16:12:33.703: I/Unity(13142): TrackableEventHandler:OnTrackableStateChanged(Status, Status) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Scripts/TrackableEventHandler.cs:94)
09-05 16:12:33.703: I/Unity(13142): TrackableBehaviour:OnTrackerUpdate(Status) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/TrackableBehaviour.cs:142)
09-05 16:12:33.703: I/Unity(13142): StateManagerImpl:UpdateTrackablePoses(Camera, TrackableResultData[], Int32, Int32) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/Internal/StateManagerImpl.cs:497)
09-05 16:12:33.703: I/Unity(13142): QCARManagerImpl:UpdateTrackers(FrameState) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/Internal/QCARManagerImpl.cs:485)
09-05 16:12:33.703: I/Unity(13142): QCARManagerImpl:Update(ScreenOrientation, CameraDeviceMode, VideoModeData&) (at /Users/andreas/VuforiaVideoMemoryTest/As
09-05 16:12:33.708: I/Unity(13142): VideoPlaybackBehaviour.Init
09-05 16:12:33.708: I/Unity(13142): UnityEngine.Debug:Internal_Log(Int32, String, Object)
09-05 16:12:33.708: I/Unity(13142): UnityEngine.Debug:Log(Object)
09-05 16:12:33.708: I/Unity(13142): VideoPlaybackBehaviour:Init() (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Vuforia Video Playback/Scripts/VideoPlaybackBehaviour.cs:338)
09-05 16:12:33.708: I/Unity(13142): TrackableEventHandler:OnTrackingFound() (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Scripts/TrackableEventHandler.cs:153)
09-05 16:12:33.708: I/Unity(13142): TrackableEventHandler:OnTrackableStateChanged(Status, Status) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Scripts/TrackableEventHandler.cs:94)
09-05 16:12:33.708: I/Unity(13142): TrackableBehaviour:OnTrackerUpdate(Status) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/TrackableBehaviour.cs:142)
09-05 16:12:33.708: I/Unity(13142): StateManagerImpl:UpdateTrackablePoses(Camera, TrackableResultData[], Int32, Int32) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/Internal/StateManagerImpl.cs:497)
09-05 16:12:33.708: I/Unity(13142): QCARManagerImpl:UpdateTrackers(FrameState) (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Qualcomm Augmented Reality/Scripts/Internal/QCAR
09-05 16:12:33.708: I/Unity(13142): VideoPlaybackBehaviour Update: Init
09-05 16:12:33.708: I/Unity(13142): UnityEngine.Debug:Internal_Log(Int32, String, Object)
09-05 16:12:33.708: I/Unity(13142): UnityEngine.Debug:Log(Object)
09-05 16:12:33.708: I/Unity(13142): VideoPlaybackBehaviour:Update() (at /Users/andreas/VuforiaVideoMemoryTest/Assets/Vuforia Video Playback/Scripts/VideoPlaybackBehaviour.cs:188)
09-05 16:12:33.708: I/Unity(13142):  
09-05 16:12:33.708: I/Unity(13142): (Filename: /Users/andreas/VuforiaVideoMemoryTest/Assets/Vuforia Video Playback/Scripts/VideoPlaybackBehaviour.cs Line: 188)
09-05 16:12:33.753: I/OMXCodec(122): [OMX.Exynos.AVC.Decoder] AVC profile = 66 (Baseline), level = 30
09-05 16:12:33.753: I/OMXCodec(122): [OMX.Exynos.AVC.Decoder] video dimensions are 640 x 360
09-05 16:12:33.773: E/EXYNOS_BASE_COMP(122): Exynos_OMX_ComponentStateSet:571
09-05 16:12:33.788: E/OMXCodec(122): [OMX.Exynos.AVC.Decoder] ERROR(0x80001000, 0)
09-05 16:12:33.788: E/AwesomePlayer(122): failed to start video source
09-05 16:12:33.793: E/MediaPlayer(13142): error (1, -2147483648)
09-05 16:12:33.793: E/MediaPlayer(13142): Error (1,-2147483648)
09-05 16:12:33.793: E/VuforiaMedia(13142): Error while opening the file. Unloading the media player
09-05 16:12:33.793: E/MediaPlayer(13142): stop called in state 0
09-05 16:12:33.793: E/MediaPlayer(13142): error (-38, 0)
09-05 16:12:33.793: W/MediaPlayer(13142): mediaplayer went away with unhandled events
09-05 16:12:33.828: I/Unity(13142): Could not load video 'VuforiaSizzleReel_5.m4v' for media type ON_TEXTURE_FULLSCREEN

 

AttachmentSize
PDF icon VuforiaFrameMarker_0-11.pdf316.3 KB

videoplayback loading 5 videos at time app crashing

September 5, 2013 - 7:13am #4

Hi netatti,

I tried your sample on an LG Optimus G and it works without problem;

however it is a known fact that loading and playing multiple videos will consume resources (memory and GPU), and depending on the device it will eventually lead to out-of-memory error (if the resource limit is reached in the Android system memory), or a gl_error if the resource limit is first reached on the GPU side.

 

videoplayback loading 5 videos at time app crashing

September 5, 2013 - 5:40am #3

hi nag, hi alessandro,

I'm also fighting with errors when I try to load/unload multiple videos, so I tried to isolate the issue by altering the standard Unity/Video example to contain 5 videos.

To get it running, start a new Unity project, import the VuforiaVideo package and then the package I attached. Open the "ManyVideos" scene and duplicate one of the videos in "StreamingAssets" a couple of times, so you end up with five of them named like that:

VuforiaSizzleReel_1.m4v
VuforiaSizzleReel_2.m4v
VuforiaSizzleReel_3.m4v
VuforiaSizzleReel_4.m4v
VuforiaSizzleReel_5.m4v

Running it, I experienced varying result, but it always ended in some kind of "out of memory" exception or glError under the hood. I would love to understand what am I doing wrong. Help would be much appreciated here.

Here's additional info:
Unity 4.2.1 (Mac)
Vuforia Video 2.6.7

Lets explain my background:

I maintain a commercial, already released app that uses similar video functionality (via another library). We now changed it to your Video lib, since it seemed to be the better option. Over the last months more and more videos had to be added. We didn't face any troubles on iOS and most Android devices, but some are very prone to errors and runs out of memory very soon (let's name the child, it's the Samsung Galaxy Tab 2 10.1 GT-P5110 running Android 4.0.3; Seems like a lot of guys have trouble with this particular piece of hardware). On a Nexus 10 for example it works fine.

In the original App this Error occurs:
09-05 14:42:12.659: E/SurfaceTexture(3998): [unnamed-3998-9] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
But there is no error state set and audio starts to play while the whole AR view gets stuck (freezes).
AttachmentSize
Package icon ManyVideosScene.unitypackage.zip20.61 KB

videoplayback loading 5 videos at time app crashing

August 9, 2013 - 6:45am #2

Hi, what you need to do is to dynamically unload the videos that are no longer used;

we don't have a sample code or tutorial that explains in detail how to achieve this, but you can look at the existing sample code in VideoPlayback sample, in particular the unload() method which is defined in the VideoPlayerHelper.java source file, and its usage in VideoPlayback.java

Also, a useful reading is the VideoPlayback sample code "walk-through" which you can find here:

https://developer.vuforia.com/resources/sample-apps/video-playback-sample-app

(see "Sample Specifci Notes")

Log in or register to post comments