| 337 | } |
| 338 | |
| 339 | void GStreamerStream::cleanup_pipe() { |
| 340 | m_console->debug("GStreamerStream::cleanup_pipe() begin"); |
| 341 | assert(m_gst_pipeline != nullptr); |
| 342 | // Drop the reference to the bitrate control element (if it exists) |
| 343 | if (m_bitrate_ctrl_element.has_value()) { |
| 344 | unref_bitrate_element(m_bitrate_ctrl_element.value()); |
| 345 | } |
| 346 | // As well as the appsink (always exists) |
| 347 | openhd::unref_appsink_element(m_app_sink_element); |
| 348 | // Jan 22: Confirmed this hangs quite a lot of pipeline(s) - removed for that |
| 349 | // reason |
| 350 | /*m_console->debug("send EOS begin"); |
| 351 | // according to @Alex W we need a EOS signal here to properly shut down the |
| 352 | pipeline if(!gst_element_send_event (m_gst_pipeline, gst_event_new_eos())){ |
| 353 | m_console->info("error gst_element_send_event eos"); // No idea what that |
| 354 | means }else{ m_console->info("success gst_element_send_event eos"); |
| 355 | }*/ |
| 356 | // TODO do we need to wait until the pipeline is actually in state NULL ? |
| 357 | openhd::gst_element_set_set_state_and_log_result(m_gst_pipeline, |
| 358 | GST_STATE_NULL); |
| 359 | gst_object_unref(m_gst_pipeline); |
| 360 | m_gst_pipeline = nullptr; |
| 361 | if (m_opt_curr_recording_filename) { |
| 362 | // make file read / writeable by everybody |
| 363 | OHDFilesystemUtil::make_file_read_write_everyone( |
| 364 | m_opt_curr_recording_filename.value()); |
| 365 | // we do not want empty files - this can happen rarely in case the file is |
| 366 | // created, but no video data is actually written to it actually, looks like |
| 367 | // it is possible the file might be empty until the gst pipeline is actually |
| 368 | // terminating - annoying gst crap ! why is there no way to properly |
| 369 | // terminate ! better leave the file there |
| 370 | /*if(OHDFilesystemUtil::get_file_size_bytes(m_opt_curr_recording_filename.value())==0){ |
| 371 | m_console->debug("Ground recording {} is |
| 372 | empty",m_opt_curr_recording_filename.value()); |
| 373 | OHDFilesystemUtil::remove_if_existing(m_opt_curr_recording_filename.value()); |
| 374 | }*/ |
| 375 | m_opt_curr_recording_filename = std::nullopt; |
| 376 | } |
| 377 | // start demuxing of (all) .mkv files unless the FC is currently armed ( we |
| 378 | // are in flight) this will of course also de-mux the new ground recording (if |
| 379 | // there is any) |
| 380 | // if(m_opt_action_handler && |
| 381 | // !m_opt_action_handler->arm_state.is_currently_armed()){ |
| 382 | // GstRecordingDemuxer::instance().demux_all_remaining_mkv_files_async(); |
| 383 | //} |
| 384 | m_console->debug("GStreamerStream::cleanup_pipe() end"); |
| 385 | } |
| 386 | |
| 387 | void GStreamerStream::request_restart() { m_request_restart = true; } |
| 388 |
nothing calls this directly
no test coverage detected