Comments (9)
It may not be the last one that locks it up. I'm guessing one of the instances may have returned an OMX_ErrorInsufficientResources. You may need to check the logs form all processes.
The display going black may well have been a memory bandwidth causing underflow to the composition engine.
You can mitigate that with "dispmanx_offline=1" in config.txt at some extra memory and processing cost.
But in reality you are pushing the Pi to the limit. While the intention is that everything fails gracefully, it is very difficult to guarantee that in all circumstances once memory is exhausted.
We can add a limit (e.g. to two video players) if that is desired.
from omxplayer.
Thanks for your response!
That's a good point about it not necessarily being the last process that's "crashed"; I'll see what I can do to log all of them. I'll also try adding the "dispmanx_offline=1" config line.
Mind you, would an ErrorInsufficientResources result in the VideoCore being inaccessible once this has happened, even after all omxplayer instances have been (gracefully) stopped? Or is it that something's crashed and so not being cleanly torn-down to a usable state?
Limits: I'm basically trying to get as many as 16 streams flowing. I didn't know exactly what/where the limits lie, so this is proving interesting finding out :) I must admit that I had (optimistically) hoped that since the Pi could decode a 1080p file OK, it'd be able to cope with several smaller resolution files, at lower frame-rates - though I appreciate there's overhead involved in multiple processing too.
I have had a look though the code to see if I could, in some way, push two decoders' output through one renderer as a way to reduce the number of "blocks" in the flow-diagram. Do you think this is even viable?
Thanks.
from omxplayer.
The way h.264 works is that each frame is stored as deltas (changes) compared to previous frames and/or following frames. The hardware h.264 decoder is thus storing a pipeline of multiple frames at once that may be in different stages of completeness of decoding - referencing other frames in the pipeline. That number of frames varies by the nature of the content and depends on many factors, including the GOP size (group of pictures) for the encoded stream. The way OMX works is as a pipeline of components - one component is the h.264 decoder and the last component being the renderer. The renderer would likely hold a relatively small number of completed frames waiting to be presented compared to everything else going on - so my guess is that even if you composited a bunch of those smaller frames onto a single large frame for rendering it wouldn't save a lot. You may get an extra stream or two, but you would also have more work compositing the output in software prior to rendering - so you could also get fewer streams. The final render is a trivial operation compared to decoding h.264.
from omxplayer.
It's the buffers rather than the components that use the memory, so I don't think trying to share a renderer would help much (or even work).
For your use case setting more than 256M (e.g. 384M) may be sensible. At least if that supports more components then it will prove it is gpu memory you are exceeding.
ErrorInsufficientResources means an allocation has failed and the host has been informed.
Shutting down from there should be safe, in theory.
However when really low on memory, you may find that the act of shutting down requires an allocation and then things can go wrong.
When running multiple instances you are more likely to still be trying to allocate when other components are shutting down and it's hard to protect against all possible failure conditions.
from omxplayer.
perrypoint: That's a fair point. My thought was that it might have been a sync'ing issue between the (too) many rendering pipelines - i.e. that decoding wasn't the problem, but that trying to get nine/more stream's frames into the video buffer was casuing locking contention/issues.
popcornmix: I had previously had 128MB before the 256MB, but will try 384MB. Is there any way to find out how much bufferspace has been allocated / is left? Woudl they all be allocated from the 'GPU slice'?
from omxplayer.
vcgencmd get_mem gpu shows the total. For current info:
sudo vcdbg reloc
sudo vcdbg malloc
shows info on gpu memory allocations (and what is free).
Be aware that these calls are purely for debug info, and unsafely parse the malloc/reloc lists through a non-cache coherent memory view. It will sometimes report that memory is corrupted or otherwise give an inconsistant state.
Running "vcgencmd cache_flush" beforehand will improve the chances of a successful read.
Two similar reads in a row should be fairly convincing.
from omxplayer.
Hello. Sorry for the radio-silence; Real Life getting in the way! ;)
I tried bumping the GPU allocation to 384MB as suggested. It's still crashed with nine feeds though.
If I run 'vcgencmd get_mem gpu' before launching omxplayer instances, I get the expected 'gpu=384M'; however, after I've luanched them, it fails with:
vc_gencmd_send returned -1
vchi_msg_dequeue -> -1(22)
'vcdbg reloc' ran OK (no errors reported) even with several runs; it seems to suggest there's a good chunk of RAM available:
Relocatable heap version 4 found at 0x8000000
total space allocated is 364M, with 362M relocatable, 2.3M legacy and 0 offline
1 legacy blocks of size 2359296
free list at 0x90e7ba0
269M free memory in 7 free block(s)
largest free block is 269M bytes
....
0xdc95360: free 269M
0x1e9c0000: legacy block 2.3M
small allocs not requested
I've only pasted the top and tail above, if you need more, please say; however, 1527 entries were along the lines of the following, mostly using 80K or 1.0K:
[1698] 0xd9a8060: used 80K (refcount 1 lock count 0, size 81920, align 32, data 0xd9a8080, d1ruAl) 'RIL buffer'
'vcdbg malloc' top and tail below, with the same number, 1527, of entries similar to '0x1f4ab080 = malloc(72) [RIL buffer header]'
Pool 0x9f2aefd8 (1ee3c140)
Malloc pool size=13M (pool=0x1f2aefd8-0x1ff7ff2c)
....
Malloced:3.7M Remaining:9.1M
So, if I'm reading this right, there's plenty of GPU-RAM available and I could probably easily scale the allocation back to 256MB or even 128MB...?
Interestingly, I left the processes running whilst composing this email and am seeing periodic batches of the following on the console:
smsc95xx 101.1:1.0: eth0: kevent 2 may have been dropped
Also, there's the occasional omxplayer.bin termination due to insufficient memory and often after blocking:
INFO: task omxplayer.bin:1769: blocked form more than 120 seconds.
omxplayer.bin D c03a0214 1849 1745 0x000000005
...
Killed proccess 1769 (omxplayer.bin) total-vm:104740kB, anon-rss:10332kB, file-rss:616kB.
from omxplayer.
As a quick follow-up: having decreased the GPU-allocation back down to 192MB, I've not seen either the kevent-2 nor omxplayer.bin out-of-memory errors.
from omxplayer.
@popcornmix I believe that this issue can be closed as a solution has been found.
from omxplayer.
Related Issues (20)
- Playing audio to individual HDMI HOT 2
- Volume control while playing HOT 3
- install in other arm machine HOT 1
- Cannot play audio over bluetooth after reboot HOT 1
- Omxplayer and bluealsa
- DBus.Error.ServiceUnknown HOT 1
- Omxplayer with Argon One v2 ir remote
- Package 'libssl1.0-dev' has no installation candidate HOT 1
- when i make -j$(nproc),there have an error HOT 5
- omxplayer doesn't play live stream, playing local mp4 video works though HOT 1
- Will omxplayer stop working eventually? HOT 2
- DBUS Name Control problem HOT 1
- pi and sound HOT 1
- Any plans to adapt for Raspberry Pi 4?
- Fixes #939
- libva1 deprecated HOT 1
- omxplayer has 20s delay on raspberry pi live stream HOT 4
- OMXplayer freezes when trying to seek
- E: Package 'omxplayer' has no installation candidate HOT 1
- Compiling on Raspberry Pi 5 running Debian 12 32bits? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from omxplayer.