forked from timvideos/gst-switch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_helpers.py
41 lines (32 loc) · 1000 Bytes
/
test_helpers.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
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(__file__, "../../../")))
from gstswitch.server import Server
from gstswitch.helpers import *
import time
from multiprocessing import Pool
PATH = '/home/hyades/gst/stage/bin/'
class TestTestSourcesPreviews(object):
NUM = 1
def new_video(self, x):
self.sources.new_test_video()
def sourcepreview(self, num, video_port):
self.sources = TestSources(video_port)
p = Pool(num)
p.map(self.new_video, range(num))
time.sleep(2)
self.sources.terminate_video()
def test_sources(self):
video_port = 3000
s = Server(PATH, video_port=video_port)
try:
s.run()
preview = PreviewSinks()
preview.run()
for i in range(self.NUM):
self.sourcepreview(i+10, video_port)
preview.terminate()
s.terminate()
finally:
if s.proc:
s.kill()