srs/trunk/conf/srt.conf
Winlin ac868852e4
SRT: Support configurable default_streamid option. v6.0.180 (#4515)
Add a new default_streamid configuration option for the SRT server to
allow customization of the default streamid used when SRT clients
connect without setting the SRTO_STREAMID socket option.

When SRT clients (like VLC) connect without properly setting the
SRTO_STREAMID socket option, SRS previously used a hardcoded default
value of "#!::r=live/livestream,m=publish". This caused conflicts when:

1. A publisher connects without setting streamid (uses default publish
mode)
2. A player tries to connect without setting streamid (also uses default
publish mode)
3. The player gets a "Stream already exists or busy" error because both
are trying to publish

Start SRS with default stream id as viewer:

```bash
./objs/srs -c conf/srt.vlc.conf
```

Publish SRT stream by FFmpeg:

```bash
ffmpeg -re -i ./doc/source.flv -c copy -pes_payload_size 0 -f mpegts \
  'srt://127.0.0.1:10080?streamid=#!::r=live/livestream,m=publish'
```

Play SRT stream by ffplay:

```bash
ffplay 'srt://127.0.0.1:10080?streamid=#!::r=live/livestream,m=request'
```

Play SRT stream by VLC:

```
 Correct - Use simple URL without streamid parameter:
srt://127.0.0.1:10080

 Wrong - VLC doesn't support streamid parameter:
srt://127.0.0.1:10080?streamid=#!::r=live/livestream,m=request
```

---
Co-authored-by: OSSRS-AI <winlinam@gmail.com>
2025-10-01 21:25:39 -04:00

55 lines
960 B
Plaintext

# SRT config.
listen 1935;
max_connections 1000;
daemon off;
srs_log_tank console;
http_api {
enabled on;
listen 1985;
}
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
srt_server {
enabled on;
listen 10080;
maxbw 1000000000;
connect_timeout 4000;
peerlatency 0;
recvlatency 0;
latency 0;
tsbpdmode off;
tlpktdrop off;
sendbuf 2000000;
recvbuf 2000000;
default_streamid "#!::r=live/livestream,m=publish";
}
# @doc https://github.com/ossrs/srs/issues/1147#issuecomment-577607026
vhost __defaultVhost__ {
srt {
enabled on;
srt_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
}
# For SRT to use vhost.
vhost srs.srt.com.cn {
}
stats {
network 0;
disk sda sdb xvda xvdb;
}