Browse Source

remove workaround for creating keys

pull/83/head
DKing 6 years ago
parent
commit
7dca40f9e6
  1. 10
      configure/channel.go
  2. 4
      protocol/httpopera/http_opera.go
  3. 1
      protocol/rtmp/rtmp.go

10
configure/channel.go

@ -2,16 +2,18 @@ package configure @@ -2,16 +2,18 @@ package configure
import (
"encoding/json"
"flag"
"io/ioutil"
"log"
"math/rand"
"sync"
"time"
)
var (
roomKeySaveFile = flag.String("keyFile", "room_keys.json", "path to save room keys")
)
const roomKeySaveFile = "room_keys.json"
var RoomKeys = LoadRoomKey(roomKeySaveFile)
var RoomKeys = LoadRoomKey(*roomKeySaveFile)
var roomUpdated = false
@ -21,7 +23,7 @@ func init() { @@ -21,7 +23,7 @@ func init() {
for {
time.Sleep(15 * time.Second)
if roomUpdated {
RoomKeys.Save(roomKeySaveFile)
RoomKeys.Save(*roomKeySaveFile)
roomUpdated = false
}
}

4
protocol/httpopera/http_opera.go

@ -89,7 +89,7 @@ func (s *Server) Serve(l net.Listener) error { @@ -89,7 +89,7 @@ func (s *Server) Serve(l net.Listener) error {
type stream struct {
Key string `json:"key"`
Url string `json:"url"`
StreamId uint32 `json:"stream_id"`
StreamId uint32 `json:"-"` // hide
VideoTotalBytes uint64 `json:"video_total_bytes"`
VideoSpeed uint64 `json:"video_speed"`
AudioTotalBytes uint64 `json:"audio_total_bytes"`
@ -98,7 +98,7 @@ type stream struct { @@ -98,7 +98,7 @@ type stream struct {
type streams struct {
Publishers []stream `json:"publishers"`
Players []stream `json:"players"`
Players []stream `json:"-"` // hide
}
//http://127.0.0.1:8090/stat/livestat

1
protocol/rtmp/rtmp.go

@ -146,7 +146,6 @@ func (s *Server) handleConn(conn *core.Conn) error { @@ -146,7 +146,6 @@ func (s *Server) handleConn(conn *core.Conn) error {
flvWriter := new(flv.FlvDvr)
s.handler.HandleWriter(flvWriter.GetWriter(reader.Info()))
} else {
configure.RoomKeys.GetKey(name) // set new key if this channel not exists
writer := NewVirWriter(connServer)
log.Printf("new player: %+v", writer.Info())
s.handler.HandleWriter(writer)

Loading…
Cancel
Save