Index: webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/eval_scores_factory.py |
diff --git a/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/eval_scores_factory.py b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/eval_scores_factory.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b33d3f96b2036860d29b62ec1e0c0dbd41ed0d95 |
--- /dev/null |
+++ b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/eval_scores_factory.py |
@@ -0,0 +1,37 @@ |
+# Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
+# |
+# Use of this source code is governed by a BSD-style license |
+# that can be found in the LICENSE file in the root of the source |
+# tree. An additional intellectual property rights grant can be found |
+# in the file PATENTS. All contributing project authors may |
+# be found in the AUTHORS file in the root of the source tree. |
+ |
+"""EvaluationScore factory class. |
+""" |
+ |
+import logging |
+ |
+from . import eval_scores |
+ |
+ |
+class EvaluationScoreWorkerFactory(object): |
+ """Factory class used to instantiate evaluation score workers. |
+ |
+ It can be used by instanciating a factory, passing parameters to the |
+ constructor. These parameters are used to instantiate evaluation score |
+ workers. |
+ """ |
+ |
+ def __init__(self, polqa_tool_path): |
+ self._polqa_tool_path = polqa_tool_path |
+ |
+ def GetInstance(self, evaluation_score_class): |
+ """Creates an EvaluationScore instance given a class object. |
+ """ |
+ logging.debug( |
+ 'factory producing a %s evaluation score', evaluation_score_class) |
+ if evaluation_score_class == eval_scores.PolqaScore: |
+ return eval_scores.PolqaScore(self._polqa_tool_path) |
+ else: |
+ # By default, no arguments in the constructor. |
+ return evaluation_score_class() |