leon před 4 týdny
rodič
revize
7128db0ab0

+ 10 - 2
src/infer/trt/yolo/yolo.cu

@@ -562,8 +562,16 @@ Infer *loadraw(const std::string &engine_file, ModelType model_type, const std::
 
 std::shared_ptr<Infer> load_yolo(const std::string &engine_file, ModelType model_type, const std::vector<std::string>& names, int gpu_id, float confidence_threshold, float nms_threshold) 
 {
-    checkRuntime(cudaSetDevice(gpu_id));
-    return std::shared_ptr<YoloModelImpl>((YoloModelImpl *)loadraw(engine_file, model_type, names, confidence_threshold, nms_threshold));
+    try
+    {
+        checkRuntime(cudaSetDevice(gpu_id));
+        return std::shared_ptr<YoloModelImpl>((YoloModelImpl *)loadraw(engine_file, model_type, names, confidence_threshold, nms_threshold));
+    }
+    catch (const std::exception& ex) 
+    {
+        return nullptr;
+    }
+    
 }
 
 }

+ 3 - 8
src/nodes/stream/streamNode.cpp

@@ -197,18 +197,12 @@ void StreamNode::process_stream_cpu()
         metaData->from = name_;
         // metaData->timestamp = getCurrentTimestamp(); // Add timestamp if useful
 
-        bool pushed = false;
         for (auto& output_buffer : output_buffers_)
         {
             if (output_buffer.second) { // Check if buffer pointer is valid
                  output_buffer.second->push(metaData);
-                 pushed = true;
             }
         }
-         // Optional: Log if data wasn't pushed anywhere
-        // if (!pushed) {
-        //     printf("StreamNode [%s]: Warning - Frame %d processed but not pushed to any output buffer.\n", name_.c_str(), frame_count_);
-        // }
     }
      printf("StreamNode [%s]: Exiting CPU processing loop (Running: %s, Status: %d).\n",
             name_.c_str(), running_ ? "true" : "false", static_cast<int>(status_));
@@ -228,7 +222,7 @@ void StreamNode::process_stream_gpu()
     int64_t pts = 0;
 
     // Send extradata once (important for some codecs)
-    demuxer_->get_extra_data(&packet_data, &packet_size)
+    demuxer_->get_extra_data(&packet_data, &packet_size);
     if (packet_size > 0) {
         printf("StreamNode [%s]: Sending %d bytes of extradata to decoder.\n", name_.c_str(), packet_size);
         decoder_->decode(packet_data, packet_size);
@@ -290,7 +284,8 @@ void StreamNode::process_stream_gpu()
                  // Pass pointers to get the actual index and PTS for the current frame
                 frame_data = decoder_->get_frame(&frame_pts, &frame_index);
             } 
-            catch (const std::exception& ex) { // Catch potential exceptions from get_frame implementation
+            catch (const std::exception& ex) 
+            {
                  fprintf(stderr, "StreamNode [%s] Error: Exception during decoder_->get_frame(): %s\n", name_.c_str(), ex.what());
                  status_ = StreamStatus::ERROR;
                  ndecoded_frame = 0; // Stop processing frames from this packet

+ 1 - 1
src/nodes/stream/streamNode.hpp

@@ -37,7 +37,7 @@ public:
           decode_type_(type),
           retry_delay_ms_(retry_delay_ms)
     {
-        printf("StreamNode [%s] created for URL: %s (Decode: %s)\n",
+        printf("StreamNode [%s]: Created for URL: %s (Decode: %s)\n",
                name_.c_str(), stream_url_.c_str(), (decode_type_ == DecodeType::GPU ? "GPU" : "CPU"));
         open_stream();
     }