Compare commits

..

4 commits

3 changed files with 10 additions and 2 deletions

View file

@ -8,6 +8,8 @@ Uses the std lib http server implementation for the http serving side.
**Not intended for actual use**. The stream key use is not secure and is used to handle directories without a user db system, than to provide auth. Same goes for the SRT passphrase. Also just accepts connections so will get DDOS'd immediately. **Not intended for actual use**. The stream key use is not secure and is used to handle directories without a user db system, than to provide auth. Same goes for the SRT passphrase. Also just accepts connections so will get DDOS'd immediately.
**Update**: main branch has been tested over a network. RTMP should now work fine, SRT "works" with a few modifications. The RTT ping log-buffer slice must be extended depending on network latency (try ~2x latency/10ms, could adjust automatically, but eh). Also will inevitably crash on poor connections due to the lack of DROPSEQ handling, but will work perfectly fine during the initial 3-10s you get.
Limits to a single stream at a time, mostly for the lack of db to handle connections and user information rather than concurrency problems. Limits to a single stream at a time, mostly for the lack of db to handle connections and user information rather than concurrency problems.
Currently always transcodes to vp9 + opus, segments to fragmented mp4. Creates one segment playlist, no manifest. Uses ffmpeg Currently always transcodes to vp9 + opus, segments to fragmented mp4. Creates one segment playlist, no manifest. Uses ffmpeg

View file

@ -1,6 +1,7 @@
package rtmp package rtmp
import ( import (
"io"
"net" "net"
"time" "time"
"encoding/binary" "encoding/binary"
@ -225,7 +226,7 @@ func read_chunk_data(conn net.Conn, msg_ptr *Message, chnk_size uint32) (uint32,
} else { } else {
buffer_end = chnk_size + msg_ptr.curr_bytes_read buffer_end = chnk_size + msg_ptr.curr_bytes_read
} }
n, err := conn.Read(msg_ptr.data[msg_ptr.curr_bytes_read:buffer_end]) n, err := io.ReadFull(conn, msg_ptr.data[msg_ptr.curr_bytes_read:buffer_end])
if err != nil { if err != nil {
return 0, err return 0, err
} }

View file

@ -147,7 +147,12 @@ func (agent *SRTManager) process_conclusion(packet *Packet) (*Packet) {
resp_packet := agent.create_conclusion_resp() resp_packet := agent.create_conclusion_resp()
if packet.packet_type == HANDSHAKE { if packet.packet_type == HANDSHAKE {
hs_cif := packet.cif.(*HandshakeCIF) hs_cif := packet.cif.(*HandshakeCIF)
if hs_cif.hs_type == 0xffffffff && hs_cif.syn_cookie == agent.syn_cookie {
// allow previous shotgunned induction requests to dissipate
if hs_cif.hs_type != 0xffffffff {
return nil
}
if hs_cif.syn_cookie == agent.syn_cookie {
for _, v := range hs_cif.hs_extensions { for _, v := range hs_cif.hs_extensions {
// force client to add a stream_id for output location // force client to add a stream_id for output location
// to do: add encryption handling // to do: add encryption handling