Skip to content

Commit

Permalink
mediaserver: Add stream keys for RTMP.
Browse files Browse the repository at this point in the history
  • Loading branch information
j0sh committed Dec 14, 2018
1 parent 0391a6e commit 4be8bcc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/mediaserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package server

import (
"context"
"encoding/hex"
"errors"
"fmt"
"math/big"
Expand Down Expand Up @@ -46,13 +47,14 @@ var ErrUnknownStream = errors.New("ErrUnknownStream")
const HLSWaitInterval = time.Second
const HLSBufferCap = uint(43200) //12 hrs assuming 1s segment
const HLSBufferWindow = uint(5)
const StreamKeyBytes = 6

const SegLen = 4 * time.Second
const BroadcastRetry = 15 * time.Second

var BroadcastPrice = big.NewInt(1)
var BroadcastJobVideoProfiles = []ffmpeg.VideoProfile{ffmpeg.P240p30fps4x3, ffmpeg.P360p30fps16x9}
var MinDepositSegmentCount = int64(75) // 5 mins assuming 4s segments
var MinDepositSegmentCount = int64(75) // 5 mins assuming 4s segments
var LastHLSStreamID core.StreamID
var LastManifestID core.ManifestID

Expand Down Expand Up @@ -167,7 +169,8 @@ func createRTMPStreamIDHandler(s *LivepeerServer) func(url *url.URL) (strmID str
}

// Generate RTMP part of StreamID
id, err := core.MakeStreamID(vid, "RTMP")
key := hex.EncodeToString(core.RandomIdGenerator(StreamKeyBytes))
id, err := core.MakeStreamID(vid, key)
if err != nil {
glog.Errorf("Error making stream ID")
return ""
Expand Down

0 comments on commit 4be8bcc

Please sign in to comment.