debug: add IPC logging from capture window to main process

Capture window logs now forwarded to main process via IPC to diagnose
why video tracks are missing from the WebRTC answer SDP.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Administrator 2026-03-12 08:46:18 +01:00
parent 6b47181572
commit 82b597506b
4 changed files with 37 additions and 17 deletions

View File

@ -16,5 +16,8 @@ contextBridge.exposeInMainWorld('capture', {
sendInput: (data) => ipcRenderer.send('remote:input-event', data), sendInput: (data) => ipcRenderer.send('remote:input-event', data),
// Notify main process of client connection/disconnection // Notify main process of client connection/disconnection
notifyClientCount: (count) => ipcRenderer.send('remote:client-count', count) notifyClientCount: (count) => ipcRenderer.send('remote:client-count', count),
// Debug logging to main process
log: (...args) => ipcRenderer.send('remote:capture-log', args.join(' '))
}); });

View File

@ -12,8 +12,10 @@ async function getCaptureStream() {
// desktopCapturer runs in main process (Electron 33+), we get the source ID via IPC // desktopCapturer runs in main process (Electron 33+), we get the source ID via IPC
const sourceId = await window.capture.getSourceId(); const sourceId = await window.capture.getSourceId();
window.capture.log('getSourceId returned:', sourceId || 'NULL');
if (!sourceId) throw new Error('No capture source ID from main process'); if (!sourceId) throw new Error('No capture source ID from main process');
try {
captureStream = await navigator.mediaDevices.getUserMedia({ captureStream = await navigator.mediaDevices.getUserMedia({
audio: false, audio: false,
video: { video: {
@ -28,10 +30,17 @@ async function getCaptureStream() {
} }
} }
}); });
const tracks = captureStream.getTracks();
window.capture.log('getUserMedia OK, tracks:', tracks.length, tracks.map(t => `${t.kind}:${t.readyState}`).join(','));
return captureStream; return captureStream;
} catch (err) {
window.capture.log('getUserMedia FAILED:', err.message);
throw err;
}
} }
async function handleOffer(clientId, offer, role) { async function handleOffer(clientId, offer, role) {
window.capture.log('handleOffer called for', clientId);
const stream = await getCaptureStream(); const stream = await getCaptureStream();
const pc = new RTCPeerConnection({ const pc = new RTCPeerConnection({
@ -40,9 +49,12 @@ async function handleOffer(clientId, offer, role) {
clients.set(clientId, { pc, role }); clients.set(clientId, { pc, role });
// Add video tracks // Add video tracks
for (const track of stream.getTracks()) { const tracks = stream.getTracks();
window.capture.log('Adding', tracks.length, 'tracks to peer connection');
for (const track of tracks) {
pc.addTrack(track, stream); pc.addTrack(track, stream);
} }
window.capture.log('Senders after addTrack:', pc.getSenders().length);
// Handle DataChannel from dashboard (dashboard creates it as offerer) // Handle DataChannel from dashboard (dashboard creates it as offerer)
pc.ondatachannel = (event) => { pc.ondatachannel = (event) => {

View File

@ -1009,6 +1009,11 @@ ipcMain.on('remote:signaling-from-capture', (_event, data) => {
} }
}); });
// IPC: Debug logging from capture window
ipcMain.on('remote:capture-log', (_event, msg) => {
debugLog('remote-capture:', msg);
});
// IPC: Input events from capture window // IPC: Input events from capture window
ipcMain.on('remote:input-event', (_event, data) => { ipcMain.on('remote:input-event', (_event, data) => {
if (!mainWindow || mainWindow.isDestroyed()) return; if (!mainWindow || mainWindow.isDestroyed()) return;

View File

@ -1,6 +1,6 @@
{ {
"name": "multi-hoster-uploader", "name": "multi-hoster-uploader",
"version": "2.1.4", "version": "2.1.5",
"description": "Upload files to doodstream, voe, vidmoly, byse simultaneously", "description": "Upload files to doodstream, voe, vidmoly, byse simultaneously",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {