lishengyin пре 3 година
родитељ
комит
07709f41a0

BIN
build/modules/CMakeFiles/modules.dir/inference/src/inference.cpp.o


BIN
build/modules/CMakeFiles/modules.dir/userApp/src/user_app.cpp.o


BIN
lib/libmodules.so


+ 17 - 19
modules/inference/src/inference.cpp

@@ -55,7 +55,7 @@ namespace VIA{
         list<std::string> DataList;
 
         DataList.push_back("file:///home/nvidia/work/VIA/data/video/sample_1080p_h264.mp4");
-        DataList.push_back("file:///home/nvidia/work/VIA/data/video/sample_1080p_h265.mp4");
+        DataList.push_back("file:///home/nvidia/work/VIA/data/video/2.mp4");
         // DataList.push_back("file:///home/nvidia/work/VIA/data/video/sample_1080p_h265.mp4");
 
         // init
@@ -158,8 +158,7 @@ namespace VIA{
         g_object_get (G_OBJECT (this->pgie), "batch-size", &(this->pgie_batch_size), NULL);
 
         if (this->pgie_batch_size != i) {
-            g_printerr("WARNING: Overriding infer-config batch-size (%d) with number of sources (%d)\n",
-                this->pgie_batch_size, i);
+            WarnL << "WARNING: Overriding infer-config batch-size:" << this->pgie_batch_size << "with number of sources ("<<  i << ")";
             g_object_set (G_OBJECT (this->pgie), "batch-size", i, NULL);
         }
 
@@ -285,7 +284,7 @@ namespace VIA{
         GMainLoop *loop = (GMainLoop *) data;
         switch (GST_MESSAGE_TYPE (msg)) {
             case GST_MESSAGE_EOS:
-                g_print ("End of stream\n");
+                InfoL << "End of stream";
                 g_main_loop_quit (loop);
                 break;
             case GST_MESSAGE_WARNING:
@@ -293,10 +292,9 @@ namespace VIA{
                 gchar *debug;
                 GError *error;
                 gst_message_parse_warning (msg, &error, &debug);
-                g_printerr ("WARNING from element %s: %s\n",
-                    GST_OBJECT_NAME (msg->src), error->message);
+                WarnL << "WARNING from element " << GST_OBJECT_NAME (msg->src) << ": " << error->message;
                 g_free (debug);
-                g_printerr ("Warning: %s\n", error->message);
+                ErrorL << "Warning: %s" << error->message;
                 g_error_free (error);
                 break;
             }
@@ -305,10 +303,9 @@ namespace VIA{
                 gchar *debug;
                 GError *error;
                 gst_message_parse_error (msg, &error, &debug);
-                g_printerr ("ERROR from element %s: %s\n",
-                    GST_OBJECT_NAME (msg->src), error->message);
+                ErrorL << "ERROR from element" << GST_OBJECT_NAME (msg->src) << ":" << error->message;
                 if (debug)
-                    g_printerr ("Error details: %s\n", debug);
+                    ErrorL << "Error details:" << debug;
                 g_free (debug);
                 g_error_free (error);
                 g_main_loop_quit (loop);
@@ -320,7 +317,7 @@ namespace VIA{
             if (gst_nvmessage_is_stream_eos (msg)) {
                 guint stream_id;
                 if (gst_nvmessage_parse_stream_eos (msg, &stream_id)) {
-                g_print ("Got EOS from stream %d\n", stream_id);
+                    InfoL << "Got EOS from stream " << stream_id;
                 }
             }
             break;
@@ -334,7 +331,7 @@ namespace VIA{
 
     void Inference::cb_newpad (GstElement * decodebin, GstPad * decoder_src_pad, gpointer data)
     {
-        g_print ("In cb_newpad\n");
+        InfoL << "In cb_newpad";
         GstCaps *caps = gst_pad_get_current_caps (decoder_src_pad);
         const GstStructure *str = gst_caps_get_structure (caps, 0);
         const gchar *name = gst_structure_get_name (str);
@@ -352,11 +349,11 @@ namespace VIA{
             GstPad *bin_ghost_pad = gst_element_get_static_pad (source_bin, "src");
             if (!gst_ghost_pad_set_target (GST_GHOST_PAD (bin_ghost_pad),
                     decoder_src_pad)) {
-                g_printerr ("Failed to link decoder src pad to source bin ghost pad\n");
+                ErrorL << "Failed to link decoder src pad to source bin ghost pad";
             }
             gst_object_unref (bin_ghost_pad);
             } else {
-            g_printerr ("Error: Decodebin did not pick nvidia decoder plugin.\n");
+                ErrorL << "Error: Decodebin did not pick nvidia decoder plugin.";
             }
         }
     }
@@ -364,7 +361,8 @@ namespace VIA{
     void Inference::decodebin_child_added (GstChildProxy * child_proxy, GObject * object,
         gchar * name, gpointer user_data)
     {
-        g_print ("Decodebin child added: %s\n", name);
+
+        InfoL << "Decodebin child added: " << name;
         if (g_strrstr (name, "decodebin") == name) {
             g_signal_connect (G_OBJECT (object), "child-added",
                 G_CALLBACK (decodebin_child_added), user_data);
@@ -387,8 +385,8 @@ namespace VIA{
         uri_decode_bin = gst_element_factory_make ("uridecodebin", "uri-decode-bin");
 
         if (!bin || !uri_decode_bin) {
-        g_printerr ("One element in source bin could not be created.\n");
-        return NULL;
+            ErrorL << "One element in source bin could not be created.";
+            return NULL;
         }
 
         /* We set the input uri to the source element */
@@ -410,8 +408,8 @@ namespace VIA{
         * src pad. */
         if (!gst_element_add_pad (bin, gst_ghost_pad_new_no_target ("src",
                 GST_PAD_SRC))) {
-        g_printerr ("Failed to add ghost pad in source bin\n");
-        return NULL;
+            ErrorL << "Failed to add ghost pad in source bin";
+            return NULL;
         }
         return bin;
     }

+ 2 - 9
modules/userApp/src/user_app.cpp

@@ -86,22 +86,15 @@ namespace VIA
     void UserApp::StartTask()
     {
         // 创建线程池
-        ThreadPool pool(2,ThreadPool::PRIORITY_HIGHEST, false);
-
+        ThreadPool pool(1,ThreadPool::PRIORITY_HIGHEST, false);
         // 挂起任务一
         pool.async([&](){
             m_Infer->StartTask();
         });
 
-        // 挂起任务二
-        pool.async([&](){
-            while(1){
-                InfoL << "11111";
-                usleep(10);
-            }
-        });
         // 启动任务
         pool.start();
+        
         InfoL << "Task started successfully!";
     }
 }