mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
validate: tools: Cleanup the way we return code in position query
This commit is contained in:
parent
d000ca62a4
commit
d9386f7542
1 changed files with 13 additions and 5 deletions
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import urllib
|
import urllib
|
||||||
|
import loggable
|
||||||
import urlparse
|
import urlparse
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
@ -204,7 +205,7 @@ def _parse_position(p):
|
||||||
|
|
||||||
|
|
||||||
def _get_position(test):
|
def _get_position(test):
|
||||||
position = duration = 0
|
position = duration = -1
|
||||||
|
|
||||||
test.reporter.out.seek(0)
|
test.reporter.out.seek(0)
|
||||||
m = None
|
m = None
|
||||||
|
@ -215,6 +216,7 @@ def _get_position(test):
|
||||||
break
|
break
|
||||||
|
|
||||||
if m is None:
|
if m is None:
|
||||||
|
loggable.debug("utils", "Could not fine any positionning info")
|
||||||
return position, duration
|
return position, duration
|
||||||
|
|
||||||
for j in m.split("\r"):
|
for j in m.split("\r"):
|
||||||
|
@ -228,7 +230,8 @@ def get_current_position(test, max_passed_stop=0.5):
|
||||||
position, duration = _get_position(test)
|
position, duration = _get_position(test)
|
||||||
|
|
||||||
if position > duration + max_passed_stop:
|
if position > duration + max_passed_stop:
|
||||||
return 0
|
loggable.warning("utils", "Position > duration -> Returning -1")
|
||||||
|
return -1
|
||||||
|
|
||||||
return position
|
return position
|
||||||
|
|
||||||
|
@ -236,13 +239,17 @@ def get_current_position(test, max_passed_stop=0.5):
|
||||||
def get_current_size(test):
|
def get_current_size(test):
|
||||||
position = get_current_position(test)
|
position = get_current_position(test)
|
||||||
|
|
||||||
if position is Result.FAILED:
|
if position is -1:
|
||||||
return position
|
return -1
|
||||||
|
|
||||||
|
size = os.stat(urlparse.urlparse(test.dest_file).path).st_size
|
||||||
|
loggable.debug("utils", "Size: %s" % size)
|
||||||
|
return size
|
||||||
|
|
||||||
return os.stat(urlparse.urlparse(test.dest_file).path).st_size
|
|
||||||
|
|
||||||
def get_duration(media_file):
|
def get_duration(media_file):
|
||||||
duration = 0
|
duration = 0
|
||||||
|
|
||||||
def parse_gsttimeargs(time):
|
def parse_gsttimeargs(time):
|
||||||
stime = time.split(":")
|
stime = time.split(":")
|
||||||
sns = stime[2].split(".")
|
sns = stime[2].split(".")
|
||||||
|
@ -262,6 +269,7 @@ def get_duration(media_file):
|
||||||
|
|
||||||
return duration
|
return duration
|
||||||
|
|
||||||
|
|
||||||
def compare_rendered_with_original(orig_duration, dest_file, tolerance=DURATION_TOLERANCE):
|
def compare_rendered_with_original(orig_duration, dest_file, tolerance=DURATION_TOLERANCE):
|
||||||
duration = get_duration(dest_file)
|
duration = get_duration(dest_file)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue