mirror of
https://github.com/Monibuca/plugin-rtmp.git
synced 2025-10-05 23:47:04 +08:00
rtmp拉流播放时间戳问题修正
This commit is contained in:
13
netStream.go
13
netStream.go
@@ -152,6 +152,7 @@ func processRtmp(conn net.Conn) {
|
||||
err = nc.SendMessage(SEND_PLAY_RESPONSE_MESSAGE, newPlayResponseMessageData(nc.streamID, NetStream_Play_Reset, Level_Status))
|
||||
err = nc.SendMessage(SEND_PLAY_RESPONSE_MESSAGE, newPlayResponseMessageData(nc.streamID, NetStream_Play_Start, Level_Status))
|
||||
vt, at := subscriber.WaitVideoTrack(), subscriber.WaitAudioTrack()
|
||||
if vt != nil {
|
||||
var lastTimeStamp uint32
|
||||
var getDeltaTime func(uint32) uint32
|
||||
getDeltaTime = func(ts uint32) (t uint32) {
|
||||
@@ -163,7 +164,6 @@ func processRtmp(conn net.Conn) {
|
||||
}
|
||||
return
|
||||
}
|
||||
if vt != nil {
|
||||
err = nc.SendMessage(SEND_FULL_VDIEO_MESSAGE, &AVPack{Payload: vt.ExtraData.Payload})
|
||||
subscriber.OnVideo = func(pack engine.VideoPack) {
|
||||
err = nc.SendMessage(SEND_FULL_VDIEO_MESSAGE, &AVPack{Timestamp: 0, Payload: pack.Payload})
|
||||
@@ -173,6 +173,17 @@ func processRtmp(conn net.Conn) {
|
||||
}
|
||||
}
|
||||
if at != nil {
|
||||
var lastTimeStamp uint32
|
||||
var getDeltaTime func(uint32) uint32
|
||||
getDeltaTime = func(ts uint32) (t uint32) {
|
||||
lastTimeStamp = ts
|
||||
getDeltaTime = func(ts uint32) (t uint32) {
|
||||
t = ts - lastTimeStamp
|
||||
lastTimeStamp = ts
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
subscriber.OnAudio = func(pack engine.AudioPack) {
|
||||
if at.CodecID == 10 {
|
||||
err = nc.SendMessage(SEND_FULL_AUDIO_MESSAGE, &AVPack{Payload: at.ExtraData})
|
||||
|
Reference in New Issue
Block a user