| 51 | } |
| 52 | |
| 53 | void CaptureController::start() { |
| 54 | if (!available_ || isRecording()) { |
| 55 | return; |
| 56 | } |
| 57 | |
| 58 | lastRenderTime_ = std::chrono::steady_clock::now(); |
| 59 | renderFrameCount_ = 0; |
| 60 | renderFpsAccum_ = 0.0; |
| 61 | measuredRenderFps_ = 0; |
| 62 | |
| 63 | std::error_code fsError; |
| 64 | std::filesystem::create_directories(outputDirectory_, fsError); |
| 65 | if (fsError) { |
| 66 | std::cerr << "Failed to create capture directory '" << outputDirectory_.string() << "': " << fsError.message() << "\n"; |
| 67 | return; |
| 68 | } |
| 69 | const std::filesystem::path outputPath = makeCaptureOutputPath(); |
| 70 | const char* pixFmt = capture_utils::toInputPixelFormat(activeFormat_); |
| 71 | |
| 72 | if (!streamer_.start(activeWidth_, activeHeight_, pixFmt, settings_, outputPath)) { |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | producer_.startVideoCapture(&streamer_, settings_); |
| 77 | resetSessionStats(); |
| 78 | } |
| 79 | |
| 80 | void CaptureController::stop() { |
| 81 | if (!isRecording()) { |
nothing calls this directly
no test coverage detected