Chromium Code Reviews

Unified Diff: webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/eval_scores_factory.py

Issue 2715233003: APM Quality Generator, noise generator and evaluation score workers factory + echo noise generator (Closed)
Patch Set: Noise generation and evaluation score workers now instantiated through factory objects, class decor… Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
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..0f0639140eda48d0ca08d8d5bd441febda147660
--- /dev/null
+++ b/webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/eval_scores_factory.py
@@ -0,0 +1,31 @@
+# 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.
+
+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):
+ 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()

Powered by Google App Engine