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.5
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.6
Choose a head ref
  • 4 commits
  • 3 files changed
  • 3 contributors

Commits on Jul 12, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f76554c View commit details

Commits on Jul 19, 2023

  1. Merge pull request #59 from jbreich/master

    Fix decoding of publish command, publishing type is optional
    yutopp authored Jul 19, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    darinpope Darin Pope
    Copy the full SHA
    2ae4e86 View commit details

Commits on Aug 30, 2023

  1. Get streamer

    kosidibe committed Aug 30, 2023
    Copy the full SHA
    6367d2f View commit details

Commits on Dec 12, 2023

  1. Merge pull request #61 from koriansidibe/feat/get_streamer_stats

    feat: Add get method for streamer
    yutopp authored Dec 12, 2023
    Copy the full SHA
    d42d059 View commit details
Showing with 29 additions and 1 deletion.
  1. +4 −0 conn.go
  2. +6 −1 message/body_decoder.go
  3. +19 −0 message/body_decoder_test.go
4 changes: 4 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
@@ -105,6 +105,10 @@ func newConn(rwc io.ReadWriteCloser, config *ConnConfig) *Conn {
return conn
}

func (c *Conn) GetChunkStreamer() *ChunkStreamer {
return c.streamer
}

func (c *Conn) Close() error {
c.m.Lock()
defer c.m.Unlock()
7 changes: 6 additions & 1 deletion message/body_decoder.go
Original file line number Diff line number Diff line change
@@ -200,7 +200,12 @@ func DecodeBodyPublish(_ io.Reader, d AMFDecoder, v *AMFConvertible) error {
}
var publishingType string
if err := d.Decode(&publishingType); err != nil {
return errors.Wrap(err, "Failed to decode 'publish' args[2]")
// value is optional
if errors.Is(err, io.EOF) {
publishingType = "live"
} else {
return errors.Wrap(err, "Failed to decode 'publish' args[2]")
}
}

var cmd NetStreamPublish
19 changes: 19 additions & 0 deletions message/body_decoder_test.go
Original file line number Diff line number Diff line change
@@ -112,6 +112,25 @@ func TestDecodeCmdMessagePublish(t *testing.T) {
}, v)
}

func TestDecodeCmdMessagePublishWithoutPublishingType(t *testing.T) {
bin := []byte{
// nil
0x05,
// string: abc
0x02, 0x00, 0x03, 0x61, 0x62, 0x63,
}
r := bytes.NewReader(bin)
d := amf0.NewDecoder(r)

var v AMFConvertible
err := CmdBodyDecoderFor("publish", 42)(r, d, &v)
require.Nil(t, err)
require.Equal(t, &NetStreamPublish{
PublishingName: "abc",
PublishingType: "live",
}, v)
}

func TestDecodeCmdMessagePlay(t *testing.T) {
bin := []byte{
// nil