fix: Report a go2rtc backchannel offer error as a failure rather than a missing capability (#2710)
This commit is contained in:
@@ -252,13 +252,11 @@ export class Go2RTCBackchannel implements Backchannel {
|
|||||||
message: Go2RTCMessage,
|
message: Go2RTCMessage,
|
||||||
generation: number,
|
generation: number,
|
||||||
): void {
|
): void {
|
||||||
// go2rtc refuses a stream it cannot send audio to with an error frame
|
// The error frame go2rtc sends in place of an answer does not identify what
|
||||||
// rather than an answer.
|
// failed, so the reason can be no more specific than `failed`, with the
|
||||||
|
// server's text attached as the description.
|
||||||
if (isServerErrorForMode(message, 'webrtc')) {
|
if (isServerErrorForMode(message, 'webrtc')) {
|
||||||
this._failStart(
|
this._failStart(generation, new BackchannelError('failed', message.value));
|
||||||
generation,
|
|
||||||
new BackchannelError('no_two_way_audio', message.value),
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,18 +131,21 @@ describe('Go2RTCBackchannel', () => {
|
|||||||
).rejects.toMatchObject({ reason: 'failed', description: 'proxy' });
|
).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 { backchannel, websocket } = setup();
|
||||||
const started = backchannel.start(createStream().asMediaStream());
|
const started = backchannel.start(createStream().asMediaStream());
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
websocket.fireOpen();
|
websocket.fireOpen();
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
websocket.fireMessage(
|
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({
|
await expect(started).rejects.toMatchObject({
|
||||||
reason: 'no_two_way_audio',
|
reason: 'failed',
|
||||||
description: 'webrtc: no backchannel',
|
description: 'webrtc/offer: streams: wrong response on DESCRIBE',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user