Offer the codecs every TeamSpeak client decodes before H.264
The official client could not show a Voelin stream: its decoder was libwebrtc's NullVideoDecoder. Its log says why. On a machine with a hardware H.264 encoder our offer put H.264 first, with every H.264 variant str0m knows; the client answered H.264 42e01f, then had no decoder for it, because it decodes H.264 only with an OpenH264 library it downloads at start-up, and that download failed (HTTP 403). Its SDP capabilities list H.264 either way. VP8, VP9 and AV1 it always decodes: FFmpeg's decoders, dav1d and libaom are built into it. - The hardware encoder order, the automatic stream codec (`preferred_codec`) and the offer (`offer_codecs`) now put the codecs every client decodes (`decoded_everywhere`: AV1, VP9, VP8) before H.264, HEVC last. A viewer answers with the first codec of the offer it lists, so official clients take one they can decode; H.264 stays offered for peers that want it, and `stream.codec` can still choose it (its description now says what that means for official clients). - A streamer offers H.264 only as it encodes it (Constrained High, packetization mode 1), not str0m's other variants, which let a viewer answer a profile, or packetization mode 0, we never send. Viewers still accept every variant. Tests: `crates/voelin-core/tests/browser_codecs.rs` (VOELIN_INTEROP=1) streams the test pattern through every encoder this machine has, VA-API also from DMA-BUFs, to headless Chromium's libwebrtc: VA-API H.264 and AV1, libvpx VP8 and VP9, x264, SVT-AV1 and libaom all decode at 1280x720. A second test makes the offer a share makes here ([AV1, VP8, H264, H265]) and checks the browser picks and decodes a codec every client decodes. The browser driver now takes playwright-core with a system Chromium (VOELIN_CHROMIUM), which decodes H.264, and the interop tests accept Chromium 152's name for the SRTP cipher. The official client itself could not be run here (its beta needs a myTeamSpeak sign-in on first start). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a9a12bb4db
commit
630ff848b2
13 files changed
+431
-116
No files matched your search
@@ -10,14 +10,22 @@
|
||||
// candidates candidates gathered so far -> {candidates: [{candidate, sdpMid, sdpMLineIndex}]}
|
||||
// accept {sdp} apply the answer to our offer
|
||||
// candidate {candidate, sdpMid, sdpMLineIndex} add a remote candidate
|
||||
// stats connection state, inbound/outbound RTP counters,
|
||||
// stats connection state, inbound/outbound RTP counters
|
||||
// (incl. the decoder and decoded frame size),
|
||||
// frames shown by a <video> element, the DTLS/SRTP
|
||||
// parameters of the transport
|
||||
// quit
|
||||
'use strict';
|
||||
|
||||
const readline = require('node:readline');
|
||||
const { chromium } = require('playwright');
|
||||
// Playwright, or playwright-core driving a browser it did not download
|
||||
// (`VOELIN_CHROMIUM`, e.g. a system Chromium that decodes H.264).
|
||||
let chromium;
|
||||
try {
|
||||
({ chromium } = require('playwright'));
|
||||
} catch {
|
||||
({ chromium } = require('playwright-core'));
|
||||
}
|
||||
|
||||
// Runs in the page.
|
||||
const PAGE_SCRIPT = `
|
||||
@@ -151,7 +159,7 @@ window.peer = {
|
||||
out.transport = {};
|
||||
['dtlsState', 'dtlsRole', 'tlsVersion', 'dtlsCipher', 'srtpCipher'].forEach((k) => (out.transport[k] = transport[k]));
|
||||
for (const k in inbound) {
|
||||
out.inbound[k] = pick(inbound[k], ['packetsReceived', 'bytesReceived', 'packetsLost', 'framesReceived', 'framesDecoded', 'keyFramesDecoded', 'pliCount', 'totalSamplesReceived']);
|
||||
out.inbound[k] = pick(inbound[k], ['packetsReceived', 'bytesReceived', 'packetsLost', 'framesReceived', 'framesDecoded', 'keyFramesDecoded', 'framesDropped', 'frameWidth', 'frameHeight', 'decoderImplementation', 'freezeCount', 'pliCount', 'totalSamplesReceived']);
|
||||
}
|
||||
for (const k in outbound) {
|
||||
out.outbound[k] = pick(outbound[k], ['packetsSent', 'bytesSent', 'framesEncoded', 'keyFramesEncoded', 'pliCount']);
|
||||
@@ -169,6 +177,7 @@ window.peer = {
|
||||
async function main() {
|
||||
const browser = await chromium.launch({
|
||||
headless: true,
|
||||
executablePath: process.env.VOELIN_CHROMIUM || undefined,
|
||||
args: [
|
||||
// Real host candidates instead of mDNS names (no getUserMedia permission here).
|
||||
'--disable-features=WebRtcHideLocalIpsWithMdns',
|
||||
|
||||
Reference in new issue
Block a user