From ccc1df936d55c32c8f33d0770eb5ba55a0ab23cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Thu, 12 Jan 2023 20:53:36 +0100 Subject: [PATCH] fix stereo for chormium browsers. --- client/src/neko/base.ts | 4 ++++ docs/changelog.md | 1 + server/internal/types/codec/codecs.go | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/client/src/neko/base.ts b/client/src/neko/base.ts index 31ec8ad..dbee55d 100644 --- a/client/src/neko/base.ts +++ b/client/src/neko/base.ts @@ -286,6 +286,10 @@ export abstract class BaseClient extends EventEmitter { try { const d = await this._peer.createAnswer() + + // add stereo=1 to answer sdp to enable stereo audio for chromium + d.sdp = d.sdp?.replace(/(stereo=1;)?useinbandfec=1/, 'useinbandfec=1;stereo=1') + this._peer!.setLocalDescription(d) this._ws!.send( diff --git a/docs/changelog.md b/docs/changelog.md index fe877ca..e8a632d 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,7 @@ ### Bugs - Fixed TCP mux occasional freeze by adding write buffer to it. +- Fixed stereo problem in chromium-based browsers, where it was only as mono by adding `stereo=1` to opus SDP to clients answer. ## [n.eko v2.7](https://github.com/m1k1o/neko/releases/tag/v2.7) diff --git a/server/internal/types/codec/codecs.go b/server/internal/types/codec/codecs.go index 623088c..2c87da1 100644 --- a/server/internal/types/codec/codecs.go +++ b/server/internal/types/codec/codecs.go @@ -118,7 +118,7 @@ func Opus() RTPCodec { MimeType: webrtc.MimeTypeOpus, ClockRate: 48000, Channels: 2, - SDPFmtpLine: "useinbandfec=1", + SDPFmtpLine: "useinbandfec=1;stereo=1", RTCPFeedback: []webrtc.RTCPFeedback{}, }, }