Compare commits

..

17 Commits

Author SHA1 Message Date
5c80277851 Update server/plugins/mediasoup-router.ts
All checks were successful
Deploy / deploy (push) Successful in 39s
2026-06-04 10:28:29 +00:00
e862703c6c server enable rtx...
All checks were successful
Deploy / deploy (push) Successful in 37s
2026-05-29 05:39:58 +06:00
81fbe447fe server log consumer rtp
All checks were successful
Deploy / deploy (push) Successful in 44s
2026-05-29 05:12:30 +06:00
f0abaaff6a server log consumer rtp
All checks were successful
Deploy / deploy (push) Successful in 41s
2026-05-29 05:04:42 +06:00
9a71f7c903 server trace
All checks were successful
Deploy / deploy (push) Successful in 43s
2026-05-29 04:43:26 +06:00
87a1f348be new stun server 2026-05-24 16:29:54 +06:00
ecb1cbbb91 opus
All checks were successful
Deploy / deploy (push) Successful in 35s
2026-05-12 00:33:17 +06:00
c3bb544c6a secrets
All checks were successful
Deploy / deploy (push) Successful in 32s
2026-05-12 00:21:39 +06:00
a4ed795769 secrets
All checks were successful
Deploy / deploy (push) Successful in 29s
2026-05-12 00:20:36 +06:00
047fce207f secrets
Some checks failed
Deploy / deploy (push) Has been cancelled
2026-05-12 00:20:27 +06:00
8410234a4e secrets
Some checks failed
Deploy / deploy (push) Failing after 6s
2026-05-12 00:19:59 +06:00
f76543fe0c кодехс
Some checks failed
Deploy / deploy (push) Has been cancelled
2026-05-12 00:18:37 +06:00
b9693be5de кодехс
All checks were successful
Deploy / deploy (push) Successful in 32s
2026-05-12 00:16:53 +06:00
78135a4b36 кодехс 2026-05-12 00:05:01 +06:00
dfb9941b86 av1 test
All checks were successful
Deploy / deploy (push) Successful in 35s
2026-05-11 23:22:17 +06:00
b8c5f68972 av1 test
All checks were successful
Deploy / deploy (push) Successful in 33s
2026-05-11 23:19:30 +06:00
564707f4d6 codec
All checks were successful
Deploy / deploy (push) Successful in 34s
2026-05-09 17:50:01 +06:00
7 changed files with 91 additions and 49 deletions

View File

@@ -17,6 +17,12 @@ jobs:
run: | run: |
ssh-keyscan git.koptilnya.xyz >> ~/.ssh/known_hosts ssh-keyscan git.koptilnya.xyz >> ~/.ssh/known_hosts
- name: Set up secret file
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
run: |
echo "${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}" | sed 's/./& /g'
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:

Binary file not shown.

View File

@@ -13,7 +13,8 @@ export const useDevices = createGlobalState(() => {
return navigator.mediaDevices.getDisplayMedia({ return navigator.mediaDevices.getDisplayMedia({
audio: false, audio: false,
video: { video: {
height: { max: 1440 }, width: { max: 2560 },
height: { max: 1080 },
displaySurface: 'monitor', displaySurface: 'monitor',
frameRate: { ideal: fps, max: fps }, frameRate: { ideal: fps, max: fps },
}, },

View File

@@ -13,6 +13,7 @@ interface SpeakingClient {
} }
const ICE_SERVERS: RTCIceServer[] = [ const ICE_SERVERS: RTCIceServer[] = [
{ urls: 'stun:stunserver2025.stunprotocol.org:3478' },
{ urls: 'stun:stun.l.google.com:19302' }, { urls: 'stun:stun.l.google.com:19302' },
{ urls: 'stun:stun.l.google.com:5349' }, { urls: 'stun:stun.l.google.com:5349' },
{ urls: 'stun:stun1.l.google.com:3478' }, { urls: 'stun:stun1.l.google.com:3478' },
@@ -343,6 +344,8 @@ export const useMediasoup = createSharedComposable(() => {
producer.on('trackended', () => { producer.on('trackended', () => {
disableProducer(producers.value[producer.id]!) disableProducer(producers.value[producer.id]!)
}) })
return producer
} }
async function disableProducer(producer: Producer) { async function disableProducer(producer: Producer) {
@@ -386,8 +389,10 @@ export const useMediasoup = createSharedComposable(() => {
streamId: 'mic-video', streamId: 'mic-video',
codecOptions: { codecOptions: {
opusStereo: true, opusStereo: true,
opusDtx: true, // Меньше пакетов летит когда тишина opusMaxPlaybackRate: 48000,
opusFec: false, // Фиксит пакет лос opusMaxAverageBitrate: 192000,
opusDtx: false,
opusFec: false,
}, },
appData: { appData: {
source: 'mic-video', source: 'mic-video',
@@ -449,29 +454,46 @@ export const useMediasoup = createSharedComposable(() => {
const track = stream.getVideoTracks()[0] const track = stream.getVideoTracks()[0]
console.log('settings', track.getSettings())
if (!track) if (!track)
return return
console.log('codec', device.value.sendRtpCapabilities.codecs)
await createProducer({ await createProducer({
track, track,
streamId: 'share', streamId: 'share',
codec: device.value.sendRtpCapabilities.codecs?.find( codec: device.value.rtpCapabilities.codecs?.find(
c => c.mimeType.toLowerCase() === 'video/vp9' && c.parameters?.['profile-id'] === 0, c => c.mimeType.toLowerCase() === 'video/h264',
), ),
// codec: device.value.rtpCapabilities.codecs?.find(
// c => c.mimeType.toLowerCase() === 'video/av1',
// ),
// codec: device.value.rtpCapabilities.codecs?.find(
// c => c.mimeType.toLowerCase() === 'video/vp9',
// ),
// codec: {
// kind: 'video',
// mimeType: 'video/AV1',
// clockRate: 90000,
// parameters: {
// 'level-idx': 13, // Level 4.1 — 1080p60
// 'profile': 0, // Main Profile
// 'tier': 0, // Main tier (0) vs High tier (1)
// 'x-google-start-bitrate': 8000,
// },
// },
encodings: [ encodings: [
{ {
maxBitrate: 12_000_000, // 8 Mbps — для 1080p60 достаточно maxBitrate: 120_000_000,
maxFramerate: 60, maxFramerate: 60,
scalabilityMode: 'L1T1', // Без SVC слоёв (стабильнее) scalabilityMode: 'L1T1',
networkPriority: 'high', networkPriority: 'high',
}, },
], ],
codecOptions: { codecOptions: {
videoGoogleStartBitrate: 2000, // Стартуем с 2 Mbps сразу // videoGoogleStartBitrate: 8000,
videoGoogleMaxBitrate: 12000, videoGoogleMaxBitrate: 120000,
videoGoogleMinBitrate: 500, videoGoogleMinBitrate: 2000,
}, },
zeroRtpOnPause: true, zeroRtpOnPause: true,
appData: { appData: {

View File

@@ -1,7 +1,7 @@
{ {
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "Chad", "productName": "Chad",
"version": "0.3.0-rc.3", "version": "0.3.0-rc.6",
"identifier": "xyz.koptilnya.chad", "identifier": "xyz.koptilnya.chad",
"build": { "build": {
"frontendDist": "../.output/public", "frontendDist": "../.output/public",

View File

@@ -23,14 +23,56 @@ export const autoConfig: mediasoup.types.RouterOptions = {
mimeType: 'audio/opus', mimeType: 'audio/opus',
clockRate: 48000, clockRate: 48000,
channels: 2, channels: 2,
parameters: { useinbandfec: 1, stereo: 1 }, parameters: { useinbandfec: 0, stereo: 1 },
}, },
{ {
kind: 'video', kind: 'video',
mimeType: 'video/VP8', mimeType: 'video/AV1',
clockRate: 90000, clockRate: 90000,
parameters: { parameters: {
'x-google-start-bitrate': 1000, 'level-idx': 13, // Level 4.1 — 1080p60
'profile': 0, // Main Profile
'tier': 0, // Main tier (0) vs High tier (1)
'x-google-start-bitrate': 8000,
},
},
{
kind: 'video',
mimeType: 'video/AV1',
clockRate: 90000,
parameters: {},
},
// {
// kind: 'video',
// mimeType: 'video/h264',
// clockRate: 90000,
// parameters: {
// 'packetization-mode': 1,
// 'profile-level-id': '640032',
// 'level-asymmetry-allowed': 1,
// 'x-google-start-bitrate': 12000,
// },
// },
{
kind: 'video',
mimeType: 'video/h264',
clockRate: 90000,
parameters: {
'packetization-mode': 1,
'profile-level-id': '4d0032',
'level-asymmetry-allowed': 1,
'x-google-start-bitrate': 8000,
},
},
{
kind: 'video',
mimeType: 'video/h264',
clockRate: 90000,
parameters: {
'packetization-mode': 1,
'profile-level-id': '42e01f',
'level-asymmetry-allowed': 1,
'x-google-start-bitrate': 8000,
}, },
}, },
{ {
@@ -44,40 +86,11 @@ export const autoConfig: mediasoup.types.RouterOptions = {
}, },
{ {
kind: 'video', kind: 'video',
mimeType: 'video/VP9', mimeType: 'video/VP8',
clockRate: 90000, clockRate: 90000,
parameters: { parameters: {
'profile-id': 2, 'x-google-start-bitrate': 2000,
'x-google-start-bitrate': 1000,
}, },
}, },
{
kind: 'video',
mimeType: 'video/h264',
clockRate: 90000,
parameters: {
'packetization-mode': 1,
'profile-level-id': '4d0032',
'level-asymmetry-allowed': 1,
'x-google-start-bitrate': 1000,
},
},
{
kind: 'video',
mimeType: 'video/h264',
clockRate: 90000,
parameters: {
'packetization-mode': 1,
'profile-level-id': '42e01f',
'level-asymmetry-allowed': 1,
'x-google-start-bitrate': 1000,
},
},
{
kind: 'video',
mimeType: 'video/AV1',
clockRate: 90000,
parameters: {},
},
], ],
} }

View File

@@ -1,4 +1,5 @@
import type { types } from 'mediasoup' import type { types } from 'mediasoup'
import type { Transport } from 'mediasoup/types'
import type { Server as SocketServer } from 'socket.io' import type { Server as SocketServer } from 'socket.io'
import type { import type {
ChadClient, ChadClient,
@@ -196,7 +197,7 @@ export default async function (io: SocketServer, router: types.Router) {
} }
try { try {
const producer = await transport.produce({ kind, rtpParameters, appData: { ...appData, socketId: socket.id } }) const producer = await (transport as Transport).produce({ kind, rtpParameters, appData: { ...appData, socketId: socket.id } })
socket.data.producers.set(producer.id, producer) socket.data.producers.set(producer.id, producer)
@@ -404,7 +405,6 @@ export default async function (io: SocketServer, router: types.Router) {
{ {
producerId: producer.id, producerId: producer.id,
rtpCapabilities: consumerSocket.data.rtpCapabilities, rtpCapabilities: consumerSocket.data.rtpCapabilities,
// Enable NACK for OPUS.
enableRtx: true, enableRtx: true,
paused: true, paused: true,
ignoreDtx: true, ignoreDtx: true,