Compare commits

..

20 Commits

Author SHA1 Message Date
95931c6976 bump 2026-07-25 16:58:25 +06:00
8c883d5481 настройки демонстрации экрана 2026-07-25 16:58:02 +06:00
fa1985c99c плавность пришла? 2026-07-25 01:43:47 +06:00
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
13 changed files with 248 additions and 86 deletions

View File

@@ -17,6 +17,12 @@ jobs:
run: |
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
uses: actions/checkout@v4
with:

Binary file not shown.

View File

@@ -4,6 +4,7 @@
</NuxtLayout>
<PrimeToast position="bottom-center" />
<PrimeDynamicDialog />
</template>
<script setup lang="ts">

View File

@@ -14,7 +14,9 @@ declare module 'vue' {
PrimeButtonGroup: typeof import('primevue/buttongroup')['default']
PrimeCard: typeof import('primevue/card')['default']
PrimeDivider: typeof import('primevue/divider')['default']
PrimeDynamicDialog: typeof import('primevue/dynamicdialog')['default']
PrimeFloatLabel: typeof import('primevue/floatlabel')['default']
PrimeIftaLabel: typeof import('primevue/iftalabel')['default']
PrimeInputGroup: typeof import('primevue/inputgroup')['default']
PrimeInputText: typeof import('primevue/inputtext')['default']
PrimePassword: typeof import('primevue/password')['default']

View File

@@ -0,0 +1,139 @@
<template>
<div>
<PrimeFloatLabel class="mb-1">
Resolution
</PrimeFloatLabel>
<PrimeSelectButton
v-model="resolution"
:options="resolutionOptions"
fluid
option-label="label"
option-value="value"
:allow-empty="false"
/>
</div>
<div class="mt-4">
<PrimeFloatLabel class="mb-1">
FPS
</PrimeFloatLabel>
<PrimeSelectButton
v-model="fps"
:options="fpsOptions"
fluid
option-label="label"
option-value="value"
:allow-empty="false"
/>
</div>
<div class="mt-4">
<PrimeFloatLabel class="mb-1">
Codec
</PrimeFloatLabel>
<PrimeSelect
v-model="codecPayloadType"
:options="videoCodecs"
fluid
option-label="mimeType"
option-value="preferredPayloadType"
placeholder="Select codec"
>
<template #option="{ option }">
<div class="w-full whitespace-normal">
<p>{{ option.mimeType }}</p>
<p class="text-muted-color text-xs break-words">
{{ option.parameters }}
</p>
</div>
</template>
</PrimeSelect>
</div>
<div class="text-right mt-8">
<PrimeButton severity="success" @click="share">
Share screen
</PrimeButton>
</div>
</template>
<script setup lang="ts">
import type { RtpCodecCapability } from 'mediasoup-client/types'
import { StorageSerializers, useLocalStorage } from '@vueuse/core'
export interface ShareSettings {
resolution: number
fps: number
codec?: RtpCodecCapability
}
const emit = defineEmits<{
share: [ShareSettings]
}>()
const mediasoup = useMediasoup()
const resolutionOptions = [
{
label: '720p',
value: 720,
},
{
label: '1080p',
value: 1080,
},
{
label: '1440p',
value: 1440,
},
]
const fpsOptions = [5, 30, 60].map((value) => {
return {
label: value.toString(),
value,
}
})
const videoCodecs = computed(() => {
return (mediasoup.rtpCapabilities.value?.codecs ?? []).filter((codec) => {
return codec.kind === 'video' && codec.mimeType !== 'video/rtx'
})
})
const fps = useLocalStorage<number>(
'SHARE_FPS',
30,
{
serializer: StorageSerializers.number,
},
)
const resolution = useLocalStorage<number>(
'SHARE_RESOLUTION',
1080,
{
serializer: StorageSerializers.number,
},
)
const codecPayloadType = useLocalStorage<number>(
'SHARE_CODEC_PAYLOAD_TYPE',
(videoCodecs.value.find(codec => codec.mimeType === 'video/H264') ?? videoCodecs.value[0])?.preferredPayloadType ?? -1,
{
serializer: StorageSerializers.number,
},
)
function share() {
emit('share', {
resolution: resolution.value,
fps: fps.value,
codec: videoCodecs.value.find(codec => codec.preferredPayloadType === codecPayloadType.value),
})
}
</script>
<style lang="scss">
</style>

View File

@@ -1,3 +1,5 @@
import type { ShareSettings } from '~/components/ShareScreenDialog.vue'
import { ShareScreenDialog } from '#components'
import { getVersion } from '@tauri-apps/api/app'
import { openUrl as tauriOpenUrl } from '@tauri-apps/plugin-opener'
import { computedAsync, createGlobalState } from '@vueuse/core'
@@ -8,6 +10,7 @@ export const useApp = createGlobalState(() => {
const mediasoup = useMediasoup()
const signaling = useSignaling()
const { emit } = useEventBus()
const dialog = useDialog()
const ready = ref(false)
const isTauri = computed(() => '__TAURI_INTERNALS__' in window)
@@ -125,8 +128,25 @@ export const useApp = createGlobalState(() => {
async function toggleShare() {
if (!mediasoup.shareProducer.value) {
await mediasoup.enableShare()
const { close } = dialog.open(ShareScreenDialog, {
props: {
header: 'Share settings',
modal: true,
draggable: false,
closable: false,
dismissableMask: true,
style: {
width: '440px',
},
},
emits: {
onShare: async (settings: ShareSettings) => {
await mediasoup.enableShare(settings)
emit('share:enabled')
close()
},
},
})
}
else {
await mediasoup.disableProducer(mediasoup.shareProducer.value)

View File

@@ -9,11 +9,11 @@ export const useDevices = createGlobalState(() => {
audioOutputs,
} = useDevicesList()
async function getShareStream(fps = 30) {
async function getShareStream(fps = 30, resolution = 1080) {
return navigator.mediaDevices.getDisplayMedia({
audio: false,
video: {
height: { max: 1440 },
height: { max: resolution },
displaySurface: 'monitor',
frameRate: { ideal: fps, max: fps },
},

View File

@@ -1,5 +1,6 @@
import type { ChadClient, Consumer, Producer } from '#shared/types'
import type { MediaKind, ProducerOptions } from 'mediasoup-client/types'
import type { ShareSettings } from '~/components/ShareScreenDialog.vue'
import { createSharedComposable } from '@vueuse/core'
import * as mediasoupClient from 'mediasoup-client'
import { shallowRef } from 'vue'
@@ -13,6 +14,7 @@ interface SpeakingClient {
}
const ICE_SERVERS: RTCIceServer[] = [
{ urls: 'stun:stunserver2025.stunprotocol.org:3478' },
{ urls: 'stun:stun.l.google.com:19302' },
{ urls: 'stun:stun.l.google.com:5349' },
{ urls: 'stun:stun1.l.google.com:3478' },
@@ -84,9 +86,11 @@ export const useMediasoup = createSharedComposable(() => {
return
device.value = new mediasoupClient.Device()
rtpCapabilities.value = await signaling.socket.value.emitWithAck('getRtpCapabilities')
const routerRtpCapabilities = await signaling.socket.value.emitWithAck('getRtpCapabilities')
await device.value.load({ routerRtpCapabilities: rtpCapabilities.value! })
await device.value.load({ routerRtpCapabilities })
rtpCapabilities.value = device.value.rtpCapabilities
// Send transport
{
@@ -343,6 +347,8 @@ export const useMediasoup = createSharedComposable(() => {
producer.on('trackended', () => {
disableProducer(producers.value[producer.id]!)
})
return producer
}
async function disableProducer(producer: Producer) {
@@ -381,13 +387,17 @@ export const useMediasoup = createSharedComposable(() => {
if (!track)
return
track.contentHint = 'speech'
await createProducer({
track,
streamId: 'mic-video',
codecOptions: {
opusStereo: true,
opusDtx: true, // Меньше пакетов летит когда тишина
opusFec: false, // Фиксит пакет лос
opusMaxPlaybackRate: 48000,
opusMaxAverageBitrate: 192000,
opusDtx: false,
opusFec: false,
},
appData: {
source: 'mic-video',
@@ -423,6 +433,8 @@ export const useMediasoup = createSharedComposable(() => {
if (!track)
return
track.contentHint = 'detail'
await createProducer({
track,
streamId: 'mic-video',
@@ -438,40 +450,38 @@ export const useMediasoup = createSharedComposable(() => {
})
}
async function enableShare() {
async function enableShare(settings: ShareSettings) {
if (shareProducer.value)
return
if (!device.value)
return
const stream = await getShareStream(preferences.shareFps.value)
const stream = await getShareStream(settings.fps)
const track = stream.getVideoTracks()[0]
if (!track)
return
console.log('codec', device.value.sendRtpCapabilities.codecs)
track.contentHint = 'motion'
await createProducer({
track,
streamId: 'share',
codec: device.value.sendRtpCapabilities.codecs?.find(
c => c.mimeType.toLowerCase() === 'video/vp9' && c.parameters?.['profile-id'] === 0,
),
codec: settings.codec,
encodings: [
{
maxBitrate: 12_000_000, // 8 Mbps — для 1080p60 достаточно
maxFramerate: 60,
scalabilityMode: 'L1T1', // Без SVC слоёв (стабильнее)
// maxBitrate: 120_000_000,
maxFramerate: settings.fps,
scalabilityMode: 'L1T1',
networkPriority: 'high',
},
],
codecOptions: {
videoGoogleStartBitrate: 2000, // Стартуем с 2 Mbps сразу
videoGoogleMaxBitrate: 12000,
videoGoogleMinBitrate: 500,
// videoGoogleStartBitrate: 8000,
// videoGoogleMaxBitrate: 120000,
// videoGoogleMinBitrate: 2000,
},
zeroRtpOnPause: true,
appData: {

View File

@@ -20,8 +20,6 @@ export const usePreferences = createGlobalState(() => {
const noiseSuppression = useLocalStorage('NOISE_SUPPRESSION', true)
const echoCancellation = useLocalStorage('ECHO_CANCELLATION', true)
const shareFps = useLocalStorage('SHARE_FPS', 30)
const toggleInputHotkey = ref<SyncedPreferences['toggleInputHotkey']>('')
const toggleOutputHotkey = ref<SyncedPreferences['toggleOutputHotkey']>('')
@@ -65,7 +63,6 @@ export const usePreferences = createGlobalState(() => {
autoGainControl,
noiseSuppression,
echoCancellation,
shareFps,
toggleInputHotkey,
toggleOutputHotkey,
inputDeviceExist,

View File

@@ -66,24 +66,6 @@
<label for="inputDevice">Input device</label>
</PrimeFloatLabel>
<PrimeDivider align="left">
Screen sharing
</PrimeDivider>
<div>
<p class="text-sm mb-2 text-center">
FPS
</p>
<PrimeSelectButton
v-model="shareFps"
:options="shareFpsOptions"
fluid
size="small"
option-label="label"
option-value="value"
/>
</div>
<template v-if="isTauri">
<PrimeDivider align="left">
Hotkeys
@@ -156,16 +138,8 @@ const {
inputDeviceExist,
outputDeviceExist,
videoDeviceExist,
shareFps,
} = usePreferences()
const shareFpsOptions = [5, 30, 60].map((value) => {
return {
label: value.toString(),
value,
}
})
const setupToggleInputHotkey = (event: KeyboardEvent) => setupHotkey(event, toggleInputHotkey)
const setupToggleOutputHotkey = (event: KeyboardEvent) => setupHotkey(event, toggleOutputHotkey)

View File

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

View File

@@ -23,14 +23,56 @@ export const autoConfig: mediasoup.types.RouterOptions = {
mimeType: 'audio/opus',
clockRate: 48000,
channels: 2,
parameters: { useinbandfec: 1, stereo: 1 },
parameters: { useinbandfec: 0, stereo: 1 },
},
{
kind: 'video',
mimeType: 'video/VP8',
mimeType: 'video/AV1',
clockRate: 90000,
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',
mimeType: 'video/VP9',
mimeType: 'video/VP8',
clockRate: 90000,
parameters: {
'profile-id': 2,
'x-google-start-bitrate': 1000,
'x-google-start-bitrate': 2000,
},
},
{
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 { Transport } from 'mediasoup/types'
import type { Server as SocketServer } from 'socket.io'
import type {
ChadClient,
@@ -196,7 +197,7 @@ export default async function (io: SocketServer, router: types.Router) {
}
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)
@@ -404,7 +405,6 @@ export default async function (io: SocketServer, router: types.Router) {
{
producerId: producer.id,
rtpCapabilities: consumerSocket.data.rtpCapabilities,
// Enable NACK for OPUS.
enableRtx: true,
paused: true,
ignoreDtx: true,