Browse Source

modify pkg management method

pull/48/head
aggresss 7 years ago
parent
commit
a036f46453
  1. 1
      .gitignore
  2. 53
      Gopkg.lock
  3. 42
      Gopkg.toml
  4. 3
      container/flv/demuxer.go
  5. 17
      container/flv/muxer.go
  6. 3
      container/flv/tag.go
  7. 7
      container/ts/muxer.go
  8. 34
      container/ts/muxer_test.go
  9. 11
      livego.go
  10. 3
      parser/aac/parser.go
  11. 9
      parser/h264/parser_test.go
  12. 9
      parser/parser.go
  13. 6
      protocol/hls/hls.go
  14. 15
      protocol/hls/source.go
  15. 9
      protocol/httpflv/server.go
  16. 11
      protocol/httpflv/writer.go
  17. 9
      protocol/httpopera/http_opera.go
  18. 3
      protocol/rtmp/cache/cache.go
  19. 3
      protocol/rtmp/cache/gop.go
  20. 4
      protocol/rtmp/cache/special.go
  21. 8
      protocol/rtmp/core/chunk_stream.go
  22. 3
      protocol/rtmp/core/chunk_stream_test.go
  23. 7
      protocol/rtmp/core/conn.go
  24. 6
      protocol/rtmp/core/conn_client.go
  25. 6
      protocol/rtmp/core/conn_server.go
  26. 6
      protocol/rtmp/core/conn_test.go
  27. 9
      protocol/rtmp/core/handshake.go
  28. 15
      protocol/rtmp/rtmp.go
  29. 5
      protocol/rtmp/rtmprelay/rtmprelay.go
  30. 7
      protocol/rtmp/rtmprelay/staticrelay.go
  31. 10
      protocol/rtmp/stream.go
  32. 3
      utils/queue/queue.go
  33. 3
      utils/uid/uuid.go

1
.gitignore vendored

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
# Created by .ignore support plugin (hsz.mobi)
.idea
dist
vendor/

53
Gopkg.lock generated

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
name = "github.com/davecgh/go-spew"
packages = ["spew"]
pruneopts = "UT"
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
version = "v1.1.1"
[[projects]]
branch = "master"
digest = "1:f7aa53146bf79462509d4ce136826ebbd64907e4679e1b04e62758da6b68e589"
name = "github.com/orcaman/concurrent-map"
packages = ["."]
pruneopts = "UT"
revision = "b28018939af9022337862b94a463abb18abb3e0e"
[[projects]]
digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
name = "github.com/pmezard/go-difflib"
packages = ["difflib"]
pruneopts = "UT"
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0"
[[projects]]
digest = "1:274f67cb6fed9588ea2521ecdac05a6d62a8c51c074c1fccc6a49a40ba80e925"
name = "github.com/satori/go.uuid"
packages = ["."]
pruneopts = "UT"
revision = "f58768cc1a7a7e77a3bd49e98cdd21419399b6a3"
version = "v1.2.0"
[[projects]]
digest = "1:18752d0b95816a1b777505a97f71c7467a8445b8ffb55631a7bf779f6ba4fa83"
name = "github.com/stretchr/testify"
packages = ["assert"]
pruneopts = "UT"
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
version = "v1.2.2"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
input-imports = [
"github.com/orcaman/concurrent-map",
"github.com/satori/go.uuid",
"github.com/stretchr/testify/assert",
]
solver-name = "gps-cdcl"
solver-version = 1

42
Gopkg.toml

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[[constraint]]
branch = "master"
name = "github.com/orcaman/concurrent-map"
[[constraint]]
name = "github.com/satori/go.uuid"
version = "1.2.0"
[[constraint]]
name = "github.com/stretchr/testify"
version = "1.2.2"
[prune]
go-tests = true
unused-packages = true

3
container/flv/demuxer.go

@ -2,7 +2,8 @@ package flv @@ -2,7 +2,8 @@ package flv
import (
"errors"
"github.com/gwuhaolin/livego/av"
"livego/av"
)
var (

17
container/flv/muxer.go

@ -1,15 +1,16 @@ @@ -1,15 +1,16 @@
package flv
import (
"strings"
"time"
"flag"
"os"
"log"
"github.com/gwuhaolin/livego/utils/uid"
"github.com/gwuhaolin/livego/protocol/amf"
"github.com/gwuhaolin/livego/av"
"github.com/gwuhaolin/livego/utils/pio"
"os"
"strings"
"time"
"livego/av"
"livego/protocol/amf"
"livego/utils/pio"
"livego/utils/uid"
)
var (
@ -45,7 +46,7 @@ const ( @@ -45,7 +46,7 @@ const (
)
type FLVWriter struct {
Uid string
Uid string
av.RWBaser
app, title, url string
buf []byte

3
container/flv/tag.go

@ -2,7 +2,8 @@ package flv @@ -2,7 +2,8 @@ package flv
import (
"fmt"
"github.com/gwuhaolin/livego/av"
"livego/av"
)
type flvTag struct {

7
container/ts/muxer.go

@ -2,7 +2,8 @@ package ts @@ -2,7 +2,8 @@ package ts
import (
"io"
"github.com/gwuhaolin/livego/av"
"livego/av"
)
const (
@ -207,7 +208,7 @@ func (muxer *Muxer) PMT(soundFormat byte, hasVideo bool) []byte { @@ -207,7 +208,7 @@ func (muxer *Muxer) PMT(soundFormat byte, hasVideo bool) []byte {
progInfo = []byte{0x0f, 0xe1, 0x01, 0xf0, 0x00}
} else {
progInfo = []byte{0x1b, 0xe1, 0x00, 0xf0, 0x00, //h264 or h265*
0x0f, 0xe1, 0x01, 0xf0, 0x00, //mp3 or aac
0x0f, 0xe1, 0x01, 0xf0, 0x00, //mp3 or aac
}
}
pmtHeader[2] = byte(len(progInfo) + 9 + 4)
@ -236,7 +237,7 @@ func (muxer *Muxer) PMT(soundFormat byte, hasVideo bool) []byte { @@ -236,7 +237,7 @@ func (muxer *Muxer) PMT(soundFormat byte, hasVideo bool) []byte {
copy(muxer.pmt[i:], progInfo[0:])
i += len(progInfo)
crc32Value := GenCrc32(muxer.pmt[5: 5+len(pmtHeader)+len(progInfo)])
crc32Value := GenCrc32(muxer.pmt[5 : 5+len(pmtHeader)+len(progInfo)])
muxer.pmt[i] = byte(crc32Value >> 24)
i++
muxer.pmt[i] = byte(crc32Value >> 16)

34
container/ts/muxer_test.go

@ -2,7 +2,9 @@ package ts @@ -2,7 +2,9 @@ package ts
import (
"testing"
"github.com/gwuhaolin/livego/av"
"livego/av"
"github.com/stretchr/testify/assert"
)
@ -24,8 +26,8 @@ func TestTSEncoder(t *testing.T) { @@ -24,8 +26,8 @@ func TestTSEncoder(t *testing.T) {
w := &TestWriter{}
data := []byte{0xaf, 0x01, 0x21, 0x19, 0xd3, 0x40, 0x7d, 0x0b, 0x6d, 0x44, 0xae, 0x81,
0x08, 0x00, 0x89, 0xa0, 0x3e, 0x85, 0xb6, 0x92, 0x57, 0x04, 0x80, 0x00, 0x5b, 0xb7,
0x78, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x30, 0x00, 0x06, 0x00, 0x38,
0x08, 0x00, 0x89, 0xa0, 0x3e, 0x85, 0xb6, 0x92, 0x57, 0x04, 0x80, 0x00, 0x5b, 0xb7,
0x78, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x30, 0x00, 0x06, 0x00, 0x38,
}
p := av.Packet{
IsVideo: false,
@ -35,17 +37,17 @@ func TestTSEncoder(t *testing.T) { @@ -35,17 +37,17 @@ func TestTSEncoder(t *testing.T) {
at.Equal(err, nil)
at.Equal(w.count, 1)
at.Equal(w.buf, []byte{0x47, 0x41, 0x01, 0x31, 0x81, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x30,
0x80, 0x80, 0x05, 0x21, 0x00, 0x01, 0x00, 0x01, 0xaf, 0x01, 0x21, 0x19, 0xd3, 0x40, 0x7d,
0x0b, 0x6d, 0x44, 0xae, 0x81, 0x08, 0x00, 0x89, 0xa0, 0x3e, 0x85, 0xb6, 0x92, 0x57, 0x04,
0x80, 0x00, 0x5b, 0xb7, 0x78, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x30, 0x00,
0x06, 0x00, 0x38})
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x30,
0x80, 0x80, 0x05, 0x21, 0x00, 0x01, 0x00, 0x01, 0xaf, 0x01, 0x21, 0x19, 0xd3, 0x40, 0x7d,
0x0b, 0x6d, 0x44, 0xae, 0x81, 0x08, 0x00, 0x89, 0xa0, 0x3e, 0x85, 0xb6, 0x92, 0x57, 0x04,
0x80, 0x00, 0x5b, 0xb7, 0x78, 0x00, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x30, 0x00,
0x06, 0x00, 0x38})
}

11
livego.go

@ -2,14 +2,15 @@ package main @@ -2,14 +2,15 @@ package main
import (
"flag"
"github.com/gwuhaolin/livego/configure"
"github.com/gwuhaolin/livego/protocol/hls"
"github.com/gwuhaolin/livego/protocol/httpflv"
"github.com/gwuhaolin/livego/protocol/httpopera"
"github.com/gwuhaolin/livego/protocol/rtmp"
"log"
"net"
"time"
"livego/configure"
"livego/protocol/hls"
"livego/protocol/httpflv"
"livego/protocol/httpopera"
"livego/protocol/rtmp"
)
var (

3
parser/aac/parser.go

@ -3,7 +3,8 @@ package aac @@ -3,7 +3,8 @@ package aac
import (
"errors"
"io"
"github.com/gwuhaolin/livego/av"
"livego/av"
)
type mpegExtension struct {

9
parser/h264/parser_test.go

@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
"bytes"
"errors"
"testing"
"github.com/stretchr/testify/assert"
)
@ -20,8 +21,8 @@ func TestH264SeqDemux(t *testing.T) { @@ -20,8 +21,8 @@ func TestH264SeqDemux(t *testing.T) {
err := d.Parse(seq, true, w)
at.Equal(err, nil)
at.Equal(d.specificInfo, []byte{0x00, 0x00, 0x00, 0x01, 0x67, 0x4d, 0x00,
0x1e, 0xab, 0x40, 0x5a, 0x12, 0x6c, 0x09, 0x28, 0x28, 0x28, 0x2f,
0x80, 0x00, 0x01, 0xf4, 0x00, 0x00, 0x61, 0xa8, 0x4a, 0x00, 0x00, 0x00, 0x01, 0x68, 0xde, 0x31, 0x12})
0x1e, 0xab, 0x40, 0x5a, 0x12, 0x6c, 0x09, 0x28, 0x28, 0x28, 0x2f,
0x80, 0x00, 0x01, 0xf4, 0x00, 0x00, 0x61, 0xa8, 0x4a, 0x00, 0x00, 0x00, 0x01, 0x68, 0xde, 0x31, 0x12})
}
func TestH264AnnexbDemux(t *testing.T) {
@ -62,8 +63,8 @@ func TestH264Mp4Demux(t *testing.T) { @@ -62,8 +63,8 @@ func TestH264Mp4Demux(t *testing.T) {
at.Equal(err, nil)
at.Equal(w.Len(), 47)
at.Equal(w.Bytes(), []byte{0x00, 0x00, 0x00, 0x01, 0x09, 0xf0, 0x00, 0x00, 0x00, 0x01, 0x67, 0x4d, 0x00, 0x1e, 0xab, 0x40, 0x5a, 0x12, 0x6c, 0x09, 0x28, 0x28,
0x28, 0x2f, 0x80, 0x00, 0x01, 0xf4, 0x00, 0x00, 0x61, 0xa8, 0x4a, 0x00, 0x00, 0x00, 0x01, 0x68,
0xde, 0x31, 0x12, 0x00, 0x00, 0x00, 0x01, 0x65, 0x23})
0x28, 0x2f, 0x80, 0x00, 0x01, 0xf4, 0x00, 0x00, 0x61, 0xa8, 0x4a, 0x00, 0x00, 0x00, 0x01, 0x68,
0xde, 0x31, 0x12, 0x00, 0x00, 0x00, 0x01, 0x65, 0x23})
}
func TestH264Mp4DemuxException1(t *testing.T) {

9
parser/parser.go

@ -3,10 +3,11 @@ package parser @@ -3,10 +3,11 @@ package parser
import (
"errors"
"io"
"github.com/gwuhaolin/livego/parser/mp3"
"github.com/gwuhaolin/livego/parser/aac"
"github.com/gwuhaolin/livego/av"
"github.com/gwuhaolin/livego/parser/h264"
"livego/av"
"livego/parser/aac"
"livego/parser/h264"
"livego/parser/mp3"
)
var (

6
protocol/hls/hls.go

@ -3,14 +3,16 @@ package hls @@ -3,14 +3,16 @@ package hls
import (
"errors"
"fmt"
"log"
"net"
"net/http"
"path"
"strconv"
"strings"
"time"
"log"
"github.com/gwuhaolin/livego/av"
"livego/av"
"github.com/orcaman/concurrent-map"
)

15
protocol/hls/source.go

@ -1,15 +1,16 @@ @@ -1,15 +1,16 @@
package hls
import (
"fmt"
"time"
"bytes"
"log"
"errors"
"github.com/gwuhaolin/livego/parser"
"github.com/gwuhaolin/livego/av"
"github.com/gwuhaolin/livego/container/flv"
"github.com/gwuhaolin/livego/container/ts"
"fmt"
"log"
"time"
"livego/av"
"livego/container/flv"
"livego/container/ts"
"livego/parser"
)
const (

9
protocol/httpflv/server.go

@ -2,12 +2,13 @@ package httpflv @@ -2,12 +2,13 @@ package httpflv
import (
"encoding/json"
"strings"
"log"
"net"
"net/http"
"log"
"github.com/gwuhaolin/livego/av"
"github.com/gwuhaolin/livego/protocol/rtmp"
"strings"
"livego/av"
"livego/protocol/rtmp"
)
type Server struct {

11
protocol/httpflv/writer.go

@ -1,15 +1,16 @@ @@ -1,15 +1,16 @@
package httpflv
import (
"time"
"errors"
"fmt"
"log"
"net/http"
"github.com/gwuhaolin/livego/utils/uid"
"github.com/gwuhaolin/livego/protocol/amf"
"github.com/gwuhaolin/livego/av"
"github.com/gwuhaolin/livego/utils/pio"
"time"
"livego/av"
"livego/protocol/amf"
"livego/utils/pio"
"livego/utils/uid"
)
const (

9
protocol/httpopera/http_opera.go

@ -3,13 +3,14 @@ package httpopera @@ -3,13 +3,14 @@ package httpopera
import (
"encoding/json"
"fmt"
"github.com/gwuhaolin/livego/protocol/rtmp/rtmprelay"
"io"
"log"
"net"
"net/http"
"log"
"github.com/gwuhaolin/livego/av"
"github.com/gwuhaolin/livego/protocol/rtmp"
"livego/av"
"livego/protocol/rtmp"
"livego/protocol/rtmp/rtmprelay"
)
type Response struct {

3
protocol/rtmp/cache/cache.go vendored

@ -2,7 +2,8 @@ package cache @@ -2,7 +2,8 @@ package cache
import (
"flag"
"github.com/gwuhaolin/livego/av"
"livego/av"
)
var (

3
protocol/rtmp/cache/gop.go vendored

@ -2,7 +2,8 @@ package cache @@ -2,7 +2,8 @@ package cache
import (
"errors"
"github.com/gwuhaolin/livego/av"
"livego/av"
)
var (

4
protocol/rtmp/cache/special.go vendored

@ -4,8 +4,8 @@ import ( @@ -4,8 +4,8 @@ import (
"bytes"
"log"
"github.com/gwuhaolin/livego/protocol/amf"
"github.com/gwuhaolin/livego/av"
"livego/av"
"livego/protocol/amf"
)
const (

8
protocol/rtmp/core/chunk_stream.go

@ -4,8 +4,8 @@ import ( @@ -4,8 +4,8 @@ import (
"encoding/binary"
"fmt"
"github.com/gwuhaolin/livego/av"
"github.com/gwuhaolin/livego/utils/pool"
"livego/av"
"livego/utils/pool"
)
type ChunkStream struct {
@ -73,7 +73,7 @@ func (chunkStream *ChunkStream) writeHeader(w *ReadWriter) error { @@ -73,7 +73,7 @@ func (chunkStream *ChunkStream) writeHeader(w *ReadWriter) error {
}
w.WriteUintLE(chunkStream.StreamID, 4)
END:
//Extended Timestamp
//Extended Timestamp
if ts >= 0xffffff {
w.WriteUintBE(chunkStream.Timestamp, 4)
}
@ -211,7 +211,7 @@ func (chunkStream *ChunkStream) readChunk(r *ReadWriter, chunkSize uint32, pool @@ -211,7 +211,7 @@ func (chunkStream *ChunkStream) readChunk(r *ReadWriter, chunkSize uint32, pool
size = int(chunkSize)
}
buf := chunkStream.Data[chunkStream.index: chunkStream.index+uint32(size)]
buf := chunkStream.Data[chunkStream.index : chunkStream.index+uint32(size)]
if _, err := r.Read(buf); err != nil {
return err
}

3
protocol/rtmp/core/chunk_stream_test.go

@ -4,8 +4,9 @@ import ( @@ -4,8 +4,9 @@ import (
"bytes"
"testing"
"livego/utils/pool"
"github.com/stretchr/testify/assert"
"github.com/gwuhaolin/livego/utils/pool"
)
func TestChunkRead1(t *testing.T) {

7
protocol/rtmp/core/conn.go

@ -4,12 +4,13 @@ import ( @@ -4,12 +4,13 @@ import (
"encoding/binary"
"net"
"time"
"github.com/gwuhaolin/livego/utils/pool"
"github.com/gwuhaolin/livego/utils/pio"
"livego/utils/pio"
"livego/utils/pool"
)
const (
_ = iota
_ = iota
idSetChunkSize
idAbortMessage
idAck

6
protocol/rtmp/core/conn_client.go

@ -5,14 +5,14 @@ import ( @@ -5,14 +5,14 @@ import (
"errors"
"fmt"
"io"
"log"
"math/rand"
"net"
neturl "net/url"
"strings"
"github.com/gwuhaolin/livego/protocol/amf"
"github.com/gwuhaolin/livego/av"
"log"
"livego/av"
"livego/protocol/amf"
)
var (

6
protocol/rtmp/core/conn_server.go

@ -4,10 +4,10 @@ import ( @@ -4,10 +4,10 @@ import (
"bytes"
"errors"
"io"
"github.com/gwuhaolin/livego/protocol/amf"
"github.com/gwuhaolin/livego/av"
"log"
"livego/av"
"livego/protocol/amf"
)
var (

6
protocol/rtmp/core/conn_test.go

@ -4,8 +4,10 @@ import ( @@ -4,8 +4,10 @@ import (
"bytes"
"io"
"testing"
"livego/utils/pool"
"github.com/stretchr/testify/assert"
"github.com/gwuhaolin/livego/utils/pool"
)
func TestConnReadNormal(t *testing.T) {
@ -176,7 +178,7 @@ func TestSetChunksize(t *testing.T) { @@ -176,7 +178,7 @@ func TestSetChunksize(t *testing.T) {
//设置chunksize
chunkBuf := []byte{0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x96}
0x00, 0x00, 0x00, 0x96}
conn.rw = NewReadWriter(bytes.NewBuffer(chunkBuf), 1024)
err = conn.Read(&c)
at.Equal(err, nil)

9
protocol/rtmp/core/handshake.go

@ -7,10 +7,9 @@ import ( @@ -7,10 +7,9 @@ import (
"crypto/sha256"
"fmt"
"io"
"time"
"github.com/gwuhaolin/livego/utils/pio"
"livego/utils/pio"
)
var (
@ -124,7 +123,7 @@ func (conn *Conn) HandshakeClient() (err error) { @@ -124,7 +123,7 @@ func (conn *Conn) HandshakeClient() (err error) {
return
}
S1 := S0S1S2[1: 1536+1]
S1 := S0S1S2[1 : 1536+1]
if ver := pio.U32BE(S1[4:8]); ver != 0 {
C2 = S1
} else {
@ -145,13 +144,13 @@ func (conn *Conn) HandshakeServer() (err error) { @@ -145,13 +144,13 @@ func (conn *Conn) HandshakeServer() (err error) {
C0C1C2 := random[:1536*2+1]
C0 := C0C1C2[:1]
C1 := C0C1C2[1: 1536+1]
C1 := C0C1C2[1 : 1536+1]
C0C1 := C0C1C2[:1536+1]
C2 := C0C1C2[1536+1:]
S0S1S2 := random[1536*2+1:]
S0 := S0S1S2[:1]
S1 := S0S1S2[1: 1536+1]
S1 := S0S1S2[1 : 1536+1]
S0S1 := S0S1S2[:1536+1]
S2 := S0S1S2[1536+1:]

15
protocol/rtmp/rtmp.go

@ -4,17 +4,18 @@ import ( @@ -4,17 +4,18 @@ import (
"errors"
"flag"
"fmt"
"github.com/gwuhaolin/livego/av"
"github.com/gwuhaolin/livego/configure"
"github.com/gwuhaolin/livego/container/flv"
"github.com/gwuhaolin/livego/protocol/rtmp/core"
"github.com/gwuhaolin/livego/utils/uid"
"log"
"net"
"net/url"
"reflect"
"strings"
"time"
"livego/av"
"livego/configure"
"livego/container/flv"
"livego/protocol/rtmp/core"
"livego/utils/uid"
)
const (
@ -284,7 +285,7 @@ func (v *VirWriter) Write(p *av.Packet) (err error) { @@ -284,7 +285,7 @@ func (v *VirWriter) Write(p *av.Packet) (err error) {
}
func (v *VirWriter) SendPacket() error {
Flush := reflect.ValueOf(v.conn).MethodByName("Flush");
Flush := reflect.ValueOf(v.conn).MethodByName("Flush")
var cs core.ChunkStream
for {
p, ok := <-v.packetQueue
@ -313,7 +314,7 @@ func (v *VirWriter) SendPacket() error { @@ -313,7 +314,7 @@ func (v *VirWriter) SendPacket() error {
v.closed = true
return err
}
Flush.Call(nil);
Flush.Call(nil)
} else {
return errors.New("closed")
}

5
protocol/rtmp/rtmprelay/rtmprelay.go

@ -4,10 +4,11 @@ import ( @@ -4,10 +4,11 @@ import (
"bytes"
"errors"
"fmt"
"github.com/gwuhaolin/livego/protocol/amf"
"github.com/gwuhaolin/livego/protocol/rtmp/core"
"io"
"log"
"livego/protocol/amf"
"livego/protocol/rtmp/core"
)
var (

7
protocol/rtmp/rtmprelay/staticrelay.go

@ -3,11 +3,12 @@ package rtmprelay @@ -3,11 +3,12 @@ package rtmprelay
import (
"errors"
"fmt"
"github.com/gwuhaolin/livego/av"
"github.com/gwuhaolin/livego/configure"
"github.com/gwuhaolin/livego/protocol/rtmp/core"
"log"
"sync"
"livego/av"
"livego/configure"
"livego/protocol/rtmp/core"
)
type StaticPush struct {

10
protocol/rtmp/stream.go

@ -2,13 +2,15 @@ package rtmp @@ -2,13 +2,15 @@ package rtmp
import (
"errors"
"github.com/gwuhaolin/livego/av"
"github.com/gwuhaolin/livego/protocol/rtmp/cache"
"github.com/gwuhaolin/livego/protocol/rtmp/rtmprelay"
"github.com/orcaman/concurrent-map"
"log"
"strings"
"time"
"livego/av"
"livego/protocol/rtmp/cache"
"livego/protocol/rtmp/rtmprelay"
"github.com/orcaman/concurrent-map"
)
var (

3
utils/queue/queue.go

@ -2,7 +2,8 @@ package queue @@ -2,7 +2,8 @@ package queue
import (
"sync"
"github.com/gwuhaolin/livego/av"
"livego/av"
)
// Queue is a basic FIFO queue for Messages.

3
utils/uid/uuid.go

@ -2,11 +2,12 @@ package uid @@ -2,11 +2,12 @@ package uid
import (
"encoding/base64"
"github.com/satori/go.uuid"
)
func NewId() string {
id, _ := uuid.NewV4()
id := uuid.NewV4()
b64 := base64.URLEncoding.EncodeToString(id.Bytes()[:12])
return b64
}

Loading…
Cancel
Save