Skip to content

Commit 6b4b558

Browse files
author
Clement Champetier
committed
pyTest: updated rewrap tests by checking process stats returned
1 parent 725cb4b commit 6b4b558

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

test/pyTest/testTranscoderRewrap.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ def checkStream(src_stream, dst_stream):
4545
continue
4646
assert_equals( src_propertiesMap[key], dst_propertiesMap[key] )
4747

48+
def checkVideoStat(src_videoStream, dst_videoStat):
49+
"""
50+
Check the values of the video process stats returned after a process.
51+
"""
52+
assert_equals(src_videoStream.getDuration(), dst_videoStat.getDuration())
53+
assert_equals(int(src_videoStream.getDuration() * src_videoStream.getFps()), dst_videoStat.getNbFrames())
54+
4855

4956
def testRewrapAudioStream():
5057
"""
@@ -63,7 +70,11 @@ def testRewrapAudioStream():
6370
transcoder = av.Transcoder( ouputFile )
6471
transcoder.add( inputFileName, 0 )
6572
progress = av.NoDisplayProgress()
66-
transcoder.process( progress )
73+
processStat = transcoder.process( progress )
74+
75+
# check process stat returned
76+
audioStat = processStat.getAudioStat(0)
77+
assert_equals(src_audioStream.getDuration(), audioStat.getDuration())
6778

6879
# get dst file of wrap
6980
dst_inputFile = av.InputFile( outputFileName )
@@ -94,7 +105,10 @@ def testRewrapAVIVideoStream():
94105
transcoder = av.Transcoder( ouputFile )
95106
transcoder.add( inputFileName, 0 )
96107
progress = av.NoDisplayProgress()
97-
transcoder.process( progress )
108+
processStat = transcoder.process( progress )
109+
110+
# check process stat returned
111+
checkVideoStat(src_videoStream, processStat.getVideoStat(0))
98112

99113
# get dst file of wrap
100114
dst_inputFile = av.InputFile( outputFileName )
@@ -125,7 +139,10 @@ def testRewrapMOVVideoStream():
125139
transcoder = av.Transcoder( ouputFile )
126140
transcoder.add( inputFileName, 1 )
127141
progress = av.NoDisplayProgress()
128-
transcoder.process( progress )
142+
processStat = transcoder.process( progress )
143+
144+
# check process stat returned
145+
checkVideoStat(src_videoStream, processStat.getVideoStat(0))
129146

130147
# get dst file of wrap
131148
dst_inputFile = av.InputFile( outputFileName )

0 commit comments

Comments
 (0)