deepch / vdk

A set of libraries for building streaming services. RTSP RTMP MP4 WS TS DASH WEBRTC MP4f
MIT License
395 stars 163 forks source link

format/rtmp ReadPacket not setting Duration. #29

Open tubzby opened 3 years ago

tubzby commented 3 years ago

AVPacket can't write to WebRTC directly because of this.

test code

func TestRTMPConnect(t *testing.T) {
    assert := assert.New(t)
    conn, err := rtmpUtil.Dial("some url")
    assert.NoError(err)

    _, err = conn.Streams()
    assert.NoError(err)

    for i := 0; i < 10; i++ {
        pkt, err := conn.ReadPacket()
        assert.NoError(err)
                 // break here
        assert.NotEqual(time.Duration(0), pkt.Duration)
    }
}

Nice project to stream rtsp/rtmp to a browser!

deepch commented 3 years ago

rtmp to a browser?

beter

https://github.com/deepch/RTSPtoWeb

tubzby commented 3 years ago

@deepch In fact I have already checked the project, but it seems to lack support of RTMP yet?

deepch commented 3 years ago

im add duration, but you can calculate it yourself, this is the difference between the current and the previous packets of the stream.