https://bitbucket.org/hudson/magic-lantern
Revision 6896814002e2b5331a03b198672e09794e074c96 authored by alex@thinkpad on 12 February 2017, 19:51:02 UTC, committed by alex@thinkpad on 12 February 2017, 19:51:02 UTC
When H.264 stops, Canon code appears to wait for all the memory resources to be freed (including ours).
During this process, LiveView is frozen (visible without ML as well).
If this process takes "too long", the camera locks up and requires battery out (some tasks may or may not continue to run).
Allocating a smaller amount of memory (rather than all available memory) doesn't seem to help.
Workaround: do not save the remaining frames, just free the resources ASAP.
TODO: figure out what actually causes this and how to prevent the hard lockups (hard, dm-spy logging might help).
1 parent 7b1740e
Raw File
Tip revision: 6896814002e2b5331a03b198672e09794e074c96 authored by alex@thinkpad on 12 February 2017, 19:51:02 UTC
mlv_lite: attempt to fix lockup when the H.264 stream stops automatically
Tip revision: 6896814
features.py
#!/usr/bin/python
# make a table with what features are enabled on what camera
import os, sys, string, re
import commands

def run(cmd):
    return commands.getstatusoutput(cmd)[1]

cams = []

for c in os.listdir("../platform"):
    if os.path.isdir(os.path.join("../platform", c)):
        if "_" not in c and "all" not in c and "MASTER" not in c:
            cams.append(c)

cams = sorted(cams)
#~ print len(cams), cams

FD = {}
AF = []
N = {}

for c in cams:
    cmd = "cpp -I../platform/%s -I../src ../src/config-defines.h -dM | grep FEATURE" % c
    F = run(cmd)
    for f in F.split('\n'):
        f = f.replace("#define", "").strip()
        #~ print c,f
        FD[c,f] = True
        AF.append(f)
        N[c] = N.get(c, 0) + 1

AF = list(set(AF))
AF.sort()

def cam_shortname(c):
    c = c.split(".")[0]
    return c.center(5)

# let's see in which menu we have these features
menus = []
current_menu = "Other"
MN_DICT = {}
MN_COUNT = {}
af = open("../src/all_features.h").read()
for l in af.split("\n"):
    m = re.match("/\*\* ([a-zA-Z]+) menu \*\*/", l)
    if m:
        current_menu = m.groups()[0]
        menus.append(current_menu)
        continue
    m = re.search("FEATURE_([A-Z0-9_]+)", l)
    if m:
        f = m.groups()[0]
        MN_DICT[f] = current_menu

for f in AF:
    mn = MN_DICT.get(f[8:], "Other")
    MN_COUNT[mn] = MN_COUNT.get(mn,0) + 1

menus.append("Other")


for mn in menus:
    if MN_COUNT.get(mn,0) == 0:
        continue
    print ""
    print mn
    print ""
    print "%30s" % "",
    for c in cams:
        print "%5s" % cam_shortname(c),
    print ""

    for f in AF:
        if MN_DICT.get(f[8:], "Other") != mn:
            continue
        print "%30s" % f[:30],
        for c in cams:
            if FD.get((c,f)):
                print "  *  ",
            else:
                print "     ",
        print ""

print ""
print "Total"
print ""

print "%30s" % "",
for c in cams:
    print ("%d" % (100 * N[c] / len(AF))).center(5),
print ""
back to top