Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: yutopp/go-rtmp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.0.1
Choose a base ref
...
head repository: yutopp/go-rtmp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.0.2
Choose a head ref

Commits on Feb 16, 2021

  1. Use GitHub Actions

    yutopp committed Feb 16, 2021
    Copy the full SHA
    db455da View commit details
  2. Fix coverage name

    yutopp committed Feb 16, 2021
    Copy the full SHA
    b434f0d View commit details
  3. Use codecov

    yutopp committed Feb 16, 2021
    Copy the full SHA
    f7416ef View commit details
  4. Merge pull request #38 from yutopp/feature/github-actions

    Use GitHub Actions
    yutopp authored Feb 16, 2021
    Copy the full SHA
    f1224b8 View commit details
  5. Use CI badge on GHActions

    yutopp committed Feb 16, 2021
    Copy the full SHA
    672768b View commit details
  6. Copy the full SHA
    a6d22a3 View commit details
  7. Merge pull request #39 from yutopp/fix/badge

    Use CI badge on GHActions
    yutopp authored Feb 16, 2021
    Copy the full SHA
    338daba View commit details
  8. Merge pull request #40 from yutopp/fix/remove-circleci

    Remove config files for CircleCI
    yutopp authored Feb 16, 2021
    Copy the full SHA
    3bc589b View commit details
  9. Update go deps

    yutopp committed Feb 16, 2021
    Copy the full SHA
    2cd07cb View commit details
  10. Remove hack

    yutopp committed Feb 16, 2021
    Copy the full SHA
    d2b7c84 View commit details
  11. Copy the full SHA
    f922717 View commit details
  12. gofmt

    yutopp committed Feb 16, 2021
    Copy the full SHA
    1f171dc View commit details
  13. Add linter to CI

    yutopp committed Feb 16, 2021
    Copy the full SHA
    b4981d0 View commit details
  14. Fix env

    yutopp committed Feb 16, 2021
    Copy the full SHA
    d97e442 View commit details
  15. Merge pull request #37 from yutopp/feature/go-mod-update

    Feature/go mod update
    yutopp authored Feb 16, 2021
    Copy the full SHA
    ee40b09 View commit details
  16. Copy the full SHA
    2bc204e View commit details
  17. Merge pull request #41 from yutopp/feature/add_stream_context

    Add StreamContext to args for OnPlay/OnPublish
    yutopp authored Feb 16, 2021
    Copy the full SHA
    f729241 View commit details
  18. WIP: Add a relay example

    yutopp committed Feb 16, 2021
    Copy the full SHA
    e993bd6 View commit details
  19. WIP: Add a relay example

    yutopp committed Feb 16, 2021
    Copy the full SHA
    8535721 View commit details
  20. go mod tidy

    yutopp committed Feb 16, 2021
    Copy the full SHA
    7f3f749 View commit details
  21. Improve README. etc

    yutopp committed Feb 16, 2021
    Copy the full SHA
    8943d59 View commit details
  22. Clone all buffers

    yutopp committed Feb 16, 2021
    Copy the full SHA
    17b171d View commit details
  23. Update go.mod/sum

    yutopp committed Feb 16, 2021
    Copy the full SHA
    a914c6a View commit details
  24. Divide makefiles

    yutopp committed Feb 16, 2021
    Copy the full SHA
    61e7c7c View commit details
  25. Ignore errors

    yutopp committed Feb 16, 2021
    Copy the full SHA
    75961f5 View commit details
  26. Relay audio/script_data

    yutopp committed Feb 16, 2021
    Copy the full SHA
    b8525e6 View commit details
  27. Merge pull request #42 from yutopp/feature/add_relay_example

    Feature/add relay example
    yutopp authored Feb 16, 2021
    Copy the full SHA
    5bec34b View commit details

Commits on Feb 17, 2021

  1. Move references above notes

    tobyapi committed Feb 17, 2021
    Copy the full SHA
    395a41f View commit details
  2. Copy the full SHA
    4525680 View commit details
  3. Add pull_req triggers to CI

    yutopp committed Feb 17, 2021
    Copy the full SHA
    7e81221 View commit details
  4. Merge pull request #44 from yutopp/fix/ci-add-pr

    Add pull_req triggers to CI
    yutopp authored Feb 17, 2021
    Copy the full SHA
    84becc1 View commit details
  5. Merge pull request #43 from tobyapi/add-usage

    Update README.md
    yutopp authored Feb 17, 2021
    Copy the full SHA
    eedb42d View commit details
  6. Copy the full SHA
    365fa12 View commit details
  7. Add writing of SetDataFrame

    tobbee committed Feb 17, 2021
    Copy the full SHA
    f839058 View commit details
  8. Add releaseStream command

    tobbee committed Feb 17, 2021
    Copy the full SHA
    b1d374b View commit details
  9. Add FCPublish test

    tobbee committed Feb 17, 2021
    Copy the full SHA
    3e731a0 View commit details
  10. Make stream.Write public

    tobbee committed Feb 17, 2021
    Copy the full SHA
    65d01c6 View commit details
  11. Copy the full SHA
    2118165 View commit details
  12. Copy the full SHA
    4b2170e View commit details

Commits on Feb 18, 2021

  1. Apply suggestions from code review

    Co-authored-by: yutopp <yutopp@gmail.com>
    tobbee and yutopp authored Feb 18, 2021
    Copy the full SHA
    1a1e0a9 View commit details
  2. Merge pull request #45 from edgeware/add-push-operations

    Add operations relevant for push
    yutopp authored Feb 18, 2021
    Copy the full SHA
    ece2167 View commit details
Showing with 921 additions and 562 deletions.
  1. +0 −61 .circleci/config.yml
  2. +35 −0 .github/workflows/ci.yml
  3. +3 −2 .gitignore
  4. +30 −19 Makefile
  5. +10 −6 README.md
  6. +18 −17 chunk_header_test.go
  7. +3 −2 chunk_streamer.go
  8. +24 −23 chunk_streamer_test.go
  9. +2 −1 client.go
  10. +5 −4 client_conn.go
  11. +2 −1 client_test.go
  12. +4 −3 conn.go
  13. +2 −1 conn_test.go
  14. +12 −0 context.go
  15. +4 −3 default_handler.go
  16. +1 −0 error.go
  17. +1 −0 example/client_demo/.gitignore
  18. +3 −0 example/client_demo/Makefile
  19. +5 −1 example/client_demo/main.go
  20. +1 −0 example/server_demo/.gitignore
  21. +3 −0 example/server_demo/Makefile
  22. +6 −5 example/server_demo/handler.go
  23. +1 −0 example/server_relay_demo/.gitignore
  24. +3 −0 example/server_relay_demo/Makefile
  25. +23 −0 example/server_relay_demo/README.md
  26. +86 −0 example/server_relay_demo/callback.go
  27. +162 −0 example/server_relay_demo/handler.go
  28. +47 −0 example/server_relay_demo/main.go
  29. +171 −0 example/server_relay_demo/pubsub.go
  30. +59 −0 example/server_relay_demo/relay_service.go
  31. +6 −10 go.mod
  32. +13 −16 go.sum
  33. +0 −1 hack/.gitignore
  34. +0 −5 hack/go.mod
  35. +0 −312 hack/go.sum
  36. +0 −6 hack/hack.go
  37. +4 −3 handler.go
  38. +2 −1 handler_test.go
  39. +2 −1 handshake/handshake.go
  40. +2 −1 message/amf_convertible.go
  41. +2 −1 message/body_decoder.go
  42. +2 −1 message/body_decoder_test.go
  43. +9 −9 message/common_test.go
  44. +2 −1 message/decoder.go
  45. +2 −1 message/decoder_test.go
  46. +2 −1 message/encoder_test.go
  47. +2 −1 message/message_test.go
  48. +3 −1 message/net_connection.go
  49. +24 −3 message/net_stream.go
  50. +19 −2 message/net_stream_test.go
  51. +7 −7 message/user_control_event_common_test.go
  52. +2 −1 message/user_control_event_decoder.go
  53. +2 −1 message/user_control_event_decoder_test.go
  54. +2 −1 message/user_control_event_encoder.go
  55. +2 −1 message/user_control_event_encoder_test.go
  56. +2 −1 server.go
  57. +10 −5 server_client_test.go
  58. +1 −1 server_conn.go
  59. +8 −2 server_data_inactive_handler.go
  60. +2 −1 server_test.go
  61. +51 −10 stream.go
  62. +2 −1 stream_handler.go
  63. +2 −1 stream_handler_test.go
  64. +2 −1 streams.go
  65. +2 −1 streams_test.go
  66. +2 −1 transactions.go
61 changes: 0 additions & 61 deletions .circleci/config.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: ci
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
go: [ '1.14', '1.13' ]
name: ${{ matrix.go }}
steps:
- uses: actions/checkout@v2

- name: Setup go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}

- run: make download-ci-tools

- env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make lint-ci

- run: make test

- run: make vet

- uses: codecov/codecov-action@v1
with:
files: ./coverage.txt
flags: unittests
name: codecov-umbrella-${{ matrix.go }}
fail_ci_if_error: true
verbose: true
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/
vendor/
bin/

coverage.txt
49 changes: 30 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,45 @@
REVISION = $(shell git rev-parse --short HEAD)
GOLANGCI_LINT=hack/bin/golangci-lint
GO111MODULE=on
FMT_DIRS:=$(shell go list -f {{.Dir}} ./...)

all: pre test
.PHONY: all
all: check test

pre: fmt lint vet
.PHONY: check
check: fmt lint vet

.PHONY: download-ci-tools
download-ci-tools:
go get -u golang.org/x/tools/cmd/goimports
wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.36.0
wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s v0.11.0

.PHONY: fmt
fmt:
go fmt ./...
@gofmt -l -w -s $(FMT_DIRS)
@goimports -w $(FMT_DIRS)

.PHONY: lint
lint:
./bin/golangci-lint run ./...

lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT) run ./...
.PHONY: lint-ci
lint-ci:
./bin/golangci-lint run ./... | \
./bin/reviewdog -f=golangci-lint -reporter=github-pr-review -filter-mode=nofilter

.PHONY: vet
vet:
go vet $$(go list ./... | grep -v /vendor/)

.PHONY: test
test:
go test -cover -v -race -timeout 10s ./...
go test -cover -coverprofile=coverage.txt -covermode=atomic -v -race -timeout 10s ./...

.PHONY: bench
bench:
go test -bench . -benchmem -gcflags="-m -m -l" ./...

.PHONY: example
example:
go build -i -v -o dist/server_demo ./example/server_demo/...
go build -i -v -o dist/client_demo ./example/client_demo/...

$(GOLANGCI_LINT):
cd ./hack; \
go build -v \
-o ./bin/golangci-lint \
github.com/golangci/golangci-lint/cmd/golangci-lint

.PHONY: all pre fmt lint vet test bench example
make -C example/server_demo
make -C example/server_relay_demo
make -C example/client_demo
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# go-rtmp

[![CircleCI](https://circleci.com/gh/yutopp/go-rtmp.svg?style=svg)](https://circleci.com/gh/yutopp/go-rtmp)
[![Coverage Status](https://coveralls.io/repos/github/yutopp/go-rtmp/badge.svg)](https://coveralls.io/github/yutopp/go-rtmp)
[![ci](https://github.com/yutopp/go-rtmp/workflows/ci/badge.svg)](https://github.com/yutopp/go-rtmp/actions?query=workflow%3Aci)
[![codecov](https://codecov.io/gh/yutopp/go-rtmp/branch/master/graph/badge.svg?token=KXgQ1x8BQP)](https://codecov.io/gh/yutopp/go-rtmp)
[![GoDoc](https://godoc.org/github.com/yutopp/go-rtmp?status.svg)](http://godoc.org/github.com/yutopp/go-rtmp)
[![Go Report Card](https://goreportcard.com/badge/github.com/yutopp/go-rtmp)](https://goreportcard.com/report/github.com/yutopp/go-rtmp)
[![license](https://img.shields.io/github/license/yutopp/go-rtmp.svg)](https://github.com/yutopp/go-rtmp/blob/master/LICENSE_1_0.txt)
@@ -16,6 +16,14 @@ RTMP 1.0 server/client library written in Go.
go get github.com/yutopp/go-rtmp
```

See also [server_demo](https://github.com/yutopp/go-rtmp/tree/master/example/server_demo) and [client_demo](https://github.com/yutopp/go-rtmp/blob/master/example/client_demo/main.go).

## Documentation

- [GoDoc](https://pkg.go.dev/github.com/yutopp/go-rtmp)
- [REAL-TIME MESSAGING PROTOCOL (RTMP) SPECIFICATION](https://www.adobe.com/devnet/rtmp.html)


## NOTES

### How to limit bitrates or set timeouts
@@ -25,7 +33,3 @@ go get github.com/yutopp/go-rtmp
## License

[Boost Software License - Version 1.0](./LICENSE_1_0.txt)

## References

- [spec](https://wwwimages2.adobe.com/www.adobe.com/content/dam/acom/en/devnet/rtmp/pdf/rtmp_specification_1.0.pdf)
35 changes: 18 additions & 17 deletions chunk_header_test.go
Original file line number Diff line number Diff line change
@@ -9,8 +9,9 @@ package rtmp

import (
"bytes"
"github.com/stretchr/testify/assert"
"testing"

"github.com/stretchr/testify/assert"
)

func TestChunkBasicHeader(t *testing.T) {
@@ -20,7 +21,7 @@ func TestChunkBasicHeader(t *testing.T) {
binary []byte
}
testCases := []testCase{
testCase{
{
name: "cs normal 1",
value: &chunkBasicHeader{
fmt: 1,
@@ -32,7 +33,7 @@ func TestChunkBasicHeader(t *testing.T) {
0x42,
},
},
testCase{
{
name: "cs normal 2",
value: &chunkBasicHeader{
fmt: 2,
@@ -45,7 +46,7 @@ func TestChunkBasicHeader(t *testing.T) {
},
},

testCase{
{
name: "cs medium 1",
value: &chunkBasicHeader{
fmt: 0,
@@ -60,7 +61,7 @@ func TestChunkBasicHeader(t *testing.T) {
0x00,
},
},
testCase{
{
name: "cs medium 2",
value: &chunkBasicHeader{
fmt: 1,
@@ -75,7 +76,7 @@ func TestChunkBasicHeader(t *testing.T) {
},
},

testCase{
{
name: "cs large 1",
value: &chunkBasicHeader{
fmt: 3,
@@ -90,7 +91,7 @@ func TestChunkBasicHeader(t *testing.T) {
0x00, 0x01,
},
},
testCase{
{
name: "cs large 2",
value: &chunkBasicHeader{
fmt: 0,
@@ -190,7 +191,7 @@ func TestChunkMessageHeader(t *testing.T) {
binary []byte
}
testCases := []testCase{
testCase{
{
name: "basic fmt 0",
fmt: 0,
value: &chunkMessageHeader{
@@ -210,7 +211,7 @@ func TestChunkMessageHeader(t *testing.T) {
0x0a, 0x00, 0x00, 0x00,
},
},
testCase{
{
name: "basic fmt 1",
fmt: 1,
value: &chunkMessageHeader{
@@ -227,7 +228,7 @@ func TestChunkMessageHeader(t *testing.T) {
0x0a,
},
},
testCase{
{
name: "basic fmt 2",
fmt: 2,
value: &chunkMessageHeader{
@@ -239,7 +240,7 @@ func TestChunkMessageHeader(t *testing.T) {
},
},

testCase{
{
name: "extended boundary fmt 0",
fmt: 0,
value: &chunkMessageHeader{
@@ -261,7 +262,7 @@ func TestChunkMessageHeader(t *testing.T) {
0x00, 0xff, 0xff, 0xff,
},
},
testCase{
{
name: "extended boundary fmt 1",
fmt: 1,
value: &chunkMessageHeader{
@@ -280,7 +281,7 @@ func TestChunkMessageHeader(t *testing.T) {
0x00, 0xff, 0xff, 0xff,
},
},
testCase{
{
name: "extended boundary fmt 2",
fmt: 2,
value: &chunkMessageHeader{
@@ -294,7 +295,7 @@ func TestChunkMessageHeader(t *testing.T) {
},
},

testCase{
{
name: "extended fmt 0",
fmt: 0,
value: &chunkMessageHeader{
@@ -316,7 +317,7 @@ func TestChunkMessageHeader(t *testing.T) {
0x01, 0x00, 0x00, 0x00,
},
},
testCase{
{
name: "extended fmt 1",
fmt: 1,
value: &chunkMessageHeader{
@@ -335,7 +336,7 @@ func TestChunkMessageHeader(t *testing.T) {
0x01, 0x00, 0x00, 0x00,
},
},
testCase{
{
name: "extended fmt 2",
fmt: 2,
value: &chunkMessageHeader{
@@ -349,7 +350,7 @@ func TestChunkMessageHeader(t *testing.T) {
},
},

testCase{
{
name: "fmt 3",
fmt: 3,
value: &chunkMessageHeader{},
5 changes: 3 additions & 2 deletions chunk_streamer.go
Original file line number Diff line number Diff line change
@@ -9,13 +9,14 @@ package rtmp

import (
"context"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"io"
"math"
"sync"
"time"

"github.com/pkg/errors"
"github.com/sirupsen/logrus"

"github.com/yutopp/go-rtmp/message"
)

Loading