| 77 | } |
| 78 | |
| 79 | void thread_decode(std::shared_ptr<PythonModule> decoder_module2) { |
| 80 | // setenv("PYTHONPATH", |
| 81 | // "/Users/bytedance/Project/company/python3/bmf_python3/bmf/3rd_party/pyav:.:/Users/bytedance/Project/company/python2/bmf_master/bmf/bmf/c_engine/python_sdk", |
| 82 | // 1); |
| 83 | // Py_Initialize(); |
| 84 | PyGILState_STATE gstate; |
| 85 | gstate = PyGILState_Ensure(); |
| 86 | boost::python::object python_file = boost::python::import("timestamp"); |
| 87 | sleep(1); |
| 88 | // PyGILState_Release(gstate); |
| 89 | // sleep(10); |
| 90 | // gstate = PyGILState_Ensure(); |
| 91 | |
| 92 | std::string decoder_name; |
| 93 | std::string decoder_option; |
| 94 | std::string encoder_name; |
| 95 | std::string encoder_option; |
| 96 | JsonParam graph_config; |
| 97 | graph_config.load("../../files/graph.json"); |
| 98 | std::vector<JsonParam> node_jsons; |
| 99 | graph_config.get_object_list("nodes", node_jsons); |
| 100 | std::shared_ptr<PythonModule> decoder_module; |
| 101 | get_python_module_info(node_jsons[0], decoder_name, decoder_option); |
| 102 | get_python_module_info(node_jsons[1], encoder_name, encoder_option); |
| 103 | create_python_module_from_string(decoder_name, decoder_option, |
| 104 | decoder_module); |
| 105 | |
| 106 | bool decoder_finished = false; |
| 107 | // while (true) { |
| 108 | // |
| 109 | // Task task = Task(0, 0, 2); |
| 110 | // std::cout << "decoder_module start" << std::endl; |
| 111 | // if (not decoder_finished) { |
| 112 | // decoder_module->process(task); |
| 113 | // } |
| 114 | // std::cout << "decoder_module end" << std::endl; |
| 115 | // if (task.get_timestamp() == DONE) { |
| 116 | // decoder_finished = true; |
| 117 | // break; |
| 118 | // } |
| 119 | //// sleep(1); |
| 120 | // } |
| 121 | /* Release the thread. No Python API allowed beyond this point. */ |
| 122 | PyGILState_Release(gstate); |
| 123 | } |
| 124 | |
| 125 | void test() { |
| 126 | sleep(3); |
nothing calls this directly
no test coverage detected