From 543e5d0fcf395e07d283430a4774226358608dd0 Mon Sep 17 00:00:00 2001 From: Dermot Duffy Date: Sun, 23 Aug 2026 21:54:20 -0700 Subject: [PATCH] fix: Report a go2rtc backchannel offer error as a failure rather than a missing capability (#2710) --- src/components-lib/live/backchannel/go2rtc.ts | 10 ++++------ tests/components-lib/live/backchannel/go2rtc.test.ts | 11 +++++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components-lib/live/backchannel/go2rtc.ts b/src/components-lib/live/backchannel/go2rtc.ts index 46b05313..d692d277 100644 --- a/src/components-lib/live/backchannel/go2rtc.ts +++ b/src/components-lib/live/backchannel/go2rtc.ts @@ -252,13 +252,11 @@ export class Go2RTCBackchannel implements Backchannel { message: Go2RTCMessage, generation: number, ): void { - // go2rtc refuses a stream it cannot send audio to with an error frame - // rather than an answer. + // The error frame go2rtc sends in place of an answer does not identify what + // failed, so the reason can be no more specific than `failed`, with the + // server's text attached as the description. if (isServerErrorForMode(message, 'webrtc')) { - this._failStart( - generation, - new BackchannelError('no_two_way_audio', message.value), - ); + this._failStart(generation, new BackchannelError('failed', message.value)); return; } diff --git a/tests/components-lib/live/backchannel/go2rtc.test.ts b/tests/components-lib/live/backchannel/go2rtc.test.ts index 2060cd87..c1a397fc 100644 --- a/tests/components-lib/live/backchannel/go2rtc.test.ts +++ b/tests/components-lib/live/backchannel/go2rtc.test.ts @@ -131,18 +131,21 @@ describe('Go2RTCBackchannel', () => { ).rejects.toMatchObject({ reason: 'failed', description: 'proxy' }); }); - it('should reject when the server reports the stream cannot take audio', async () => { + it('should reject with the server error when the offer is refused', async () => { const { backchannel, websocket } = setup(); const started = backchannel.start(createStream().asMediaStream()); await flushPromises(); websocket.fireOpen(); await flushPromises(); websocket.fireMessage( - JSON.stringify({ type: 'error', value: 'webrtc: no backchannel' }), + JSON.stringify({ + type: 'error', + value: 'webrtc/offer: streams: wrong response on DESCRIBE', + }), ); await expect(started).rejects.toMatchObject({ - reason: 'no_two_way_audio', - description: 'webrtc: no backchannel', + reason: 'failed', + description: 'webrtc/offer: streams: wrong response on DESCRIBE', }); });