MCPcopy Create free account
hub / github.com/apohl79/audiogridder / startCapturing

Method startCapturing

Server/Source/ProcessorWindow.cpp:138–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138void ProcessorWindow::startCapturing() {
139 traceScope();
140 if (auto srv = getApp()->getServer()) {
141 if (!srv->getScreenCapturingOff()) {
142 if (m_callbackNative) {
143 startTimer(50);
144 } else {
145 m_screenCaptureRect = getScreenCaptureRect();
146 if (!m_screenCaptureRect.isEmpty()) {
147 if (isFullyVisible()) {
148 if (auto rec = ScreenRecorder::getInstance()) {
149 if (rec->isRecording()) {
150 rec->stop();
151 }
152 rec->start(m_screenCaptureRect, m_callbackFFmpeg, [tid = m_tid](const String& err) {
153 if (auto onErr = getApp()->getWorkerErrorCallback(tid)) {
154 onErr("Screen capturing failed: " + err);
155 }
156 });
157 } else {
158 logln("error: no screen recorder");
159 }
160 } else {
161 if (auto onErr = getApp()->getWorkerErrorCallback(m_tid)) {
162 onErr("Screen capturing failed: The plugin window must be fully visible to be captured!");
163 }
164 logln("error: can't start capturing when plugin window not fully visible");
165 }
166 } else {
167 // when launching a plugin sandbox, it might take a little bit to ramp up the plugin editor, so we
168 // retry
169 bool retry = ++m_startCapturingRetry < 100;
170 logln("error: can't start screen capturing with empty rect ("
171 << (retry ? "retrying in 100ms" : "giving up") << ")");
172 if (retry) {
173 Timer::callAfterDelay(100, safeLambda([this] { startCapturing(); }));
174 }
175 }
176 }
177 }
178 }
179}
180
181void ProcessorWindow::stopCapturing() {
182 traceScope();

Callers

nothing calls this directly

Calls 6

getScreenCapturingOffMethod · 0.80
isRecordingMethod · 0.80
getServerMethod · 0.45
stopMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected