forked from albertz/music-player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_ffmpeg_memleak.py
72 lines (53 loc) · 1.19 KB
/
test_ffmpeg_memleak.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import better_exchook
better_exchook.install()
import sys, os, gc
def step():
gc.collect()
os.system("ps up %i" % os.getpid())
#print "\npress enter to continue"
#sys.stdin.readline()
def progr():
sys.stdout.write(".")
sys.stdout.flush()
def getFileList(n):
from RandomFileQueue import RandomFileQueue
fileQueue = RandomFileQueue(
rootdir=os.path.expanduser("~/Music"),
fileexts=["mp3", "ogg", "flac", "wma"])
return [fileQueue.getNextFile() for i in xrange(n)]
N = 10
files = getFileList(N)
from pprint import pprint
pprint(files)
import ffmpeg
print "imported"
step()
for i in xrange(N):
ffmpeg.createPlayer()
print "after createPlayer"
step()
class Song:
def __init__(self, fn):
self.url = fn
self.f = open(fn)
def readPacket(self, bufSize):
s = self.f.read(bufSize)
return s
def seekRaw(self, offset, whence):
r = self.f.seek(offset, whence)
return self.f.tell()
for f in files:
ffmpeg.getMetadata(Song(f))
progr()
print "after getMetadata"
step()
for f in files:
ffmpeg.calcAcoustIdFingerprint(Song(f))
progr()
print "after calcAcoustIdFingerprint"
step()
for f in files:
ffmpeg.calcBitmapThumbnail(Song(f))
progr()
print "after calcBitmapThumbnail"
step()