mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-02 19:42:51 +08:00
fix(screen-share): use sender capabilities for codec preference
setCodecPreferences requires codecs from RTCRtpSender.getCapabilities; feeding it RTCRtpReceiver.getCapabilities throws InvalidModificationError in Chrome and the swallowed exception left VP8 as the negotiated codec. Switch the capability source so H264/AV1 preferences actually apply.
This commit is contained in:
1 parent
1c328995aa
commit
20bde72c8b
1 file changed
+1
-1
@@ -415,7 +415,7 @@ export function createScreenShareController(transport: ScreenShareTransport) {
|
||||
|
||||
function preferScreenShareCodecs(peer: RTCPeerConnection): void {
|
||||
const transceiver = peer.getTransceivers().find((candidate) => candidate.sender.track?.kind === "video" || candidate.receiver.track?.kind === "video");
|
||||
const capabilities = typeof RTCRtpReceiver !== "undefined" ? RTCRtpReceiver.getCapabilities?.("video") : null;
|
||||
const capabilities = typeof RTCRtpSender !== "undefined" ? RTCRtpSender.getCapabilities?.("video") : null;
|
||||
if (!transceiver?.setCodecPreferences || !capabilities?.codecs?.length) return;
|
||||
// Prefer H.264/AV1 for screen content: both compress text/UI far better
|
||||
// than VP8 at the bitrates typical of relayed screen shares. VP8 stays as
|
||||
|
||||
Reference in new issue
Block a user