changeset 1762:110f853c3149 by-id

Deleted-model checks, & debug output
author Chris Cannam
date Mon, 15 Jul 2019 14:12:37 +0100
parents ee7fd2c01d87
children d1e2062cbdec
files transform/FeatureExtractionModelTransformer.cpp
diffstat 1 files changed, 33 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/transform/FeatureExtractionModelTransformer.cpp	Fri Jul 12 13:57:42 2019 +0100
+++ b/transform/FeatureExtractionModelTransformer.cpp	Mon Jul 15 14:12:37 2019 +0100
@@ -770,10 +770,35 @@
                 ((((blockFrame - contextStart) / stepSize) * 99) /
                  (contextDuration / stepSize + 1));
 
+            bool haveAllModels = true;
             if (!ModelById::get(inputId)) {
+#ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
+                SVDEBUG << "FeatureExtractionModelTransformer::run: Input model " << inputId << " no longer exists" << endl;
+#endif
+                haveAllModels = false;
+            } else {
+                SVDEBUG << "Input model " << inputId << " still exists" << endl;
+            }
+            for (auto mid: m_outputs) {
+                if (!ModelById::get(mid)) {
+#ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
+                    SVDEBUG << "FeatureExtractionModelTransformer::run: Output model " << mid << " no longer exists" << endl;
+#endif
+                    haveAllModels = false;
+                } else {
+#ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
+                    SVDEBUG << "Output model " << mid << " still exists" << endl;
+#endif
+                }
+            }
+            if (!haveAllModels) {
                 abandon();
-                return;
+                break;
             }
+            
+#ifdef DEBUG_FEATURE_EXTRACTION_TRANSFORMER_RUN
+            SVDEBUG << "FeatureExtractionModelTransformer::run: All models still exist" << endl;
+#endif
 
             // channelCount is either input->channelCount or 1
 
@@ -838,6 +863,9 @@
                 for (int fi = 0; in_range_for(features[m_outputNos[j]], fi); ++fi) {
                     auto feature = features[m_outputNos[j]][fi];
                     addFeature(j, blockFrame, feature);
+                    if (m_abandoned) {
+                        break;
+                    }
                 }
             }
         }
@@ -1109,9 +1137,11 @@
         } else {
             model->setColumn(int(frame / model->getResolution()), values);
         }
+    } else {
+        
+        SVDEBUG << "FeatureExtractionModelTransformer::addFeature: Unknown output model type - possibly a deleted model" << endl;
+        abandon();
     }
-
-    SVDEBUG << "FeatureExtractionModelTransformer::addFeature: Unknown output model type!" << endl;
 }
 
 void