zhangpeihao / gortmp

Implement RTMP protocol by golang
MIT License
523 stars 162 forks source link

demo里server无法接收ffmpeg的推流 #26

Closed zboya closed 7 years ago

zboya commented 7 years ago

运行demo的server后,执行命令ffmpeg -re -i test.mp4 -c copy -f flv rtmp://localhost/app 就一直停留在那,不会继续跑下去了?不知道为何,下面是log的信息:

2016/09/01 23:28:21 ######## Profiles #######
--- contention:
cycles/second=2261009062
goroutine profile: total 4
1 @ 0x55ce18 0x55cbf3 0x558484 0x4bbc3d 0x4bbab9 0x4bb2e4 0x4b9bc2 0x401a7b 0x4308b0 0x4601e1
#   0x55ce18    runtime/pprof.writeRuntimeProfile+0xb8          /home/bao/go/src/runtime/pprof/pprof.go:545
#   0x55cbf3    runtime/pprof.writeGoroutine+0x93           /home/bao/go/src/runtime/pprof/pprof.go:507
#   0x558484    runtime/pprof.(*Profile).WriteTo+0xd4           /home/bao/go/src/runtime/pprof/pprof.go:236
#   0x4bbc3d    github.com/zhangpeihao/log.(*Logger).DumpProf+0x13d /home/bao/gowork/src/github.com/zhangpeihao/log/log.go:146
#   0x4bbab9    github.com/zhangpeihao/log.(*Logger).DumpHeader+0x109   /home/bao/gowork/src/github.com/zhangpeihao/log/log.go:137
#   0x4bb2e4    github.com/zhangpeihao/log.NewLoggerWithHeader+0x1704   /home/bao/gowork/src/github.com/zhangpeihao/log/log.go:116
#   0x4b9bc2    github.com/zhangpeihao/log.NewLogger+0xa2       /home/bao/gowork/src/github.com/zhangpeihao/log/log.go:55
#   0x401a7b    main.main+0xab                      /home/bao/bao/program/go/gortmp-master/demo/server/server.go:95
#   0x4308b0    runtime.main+0x2b0                  /home/bao/go/src/runtime/proc.go:188

1 @ 0x4601e1

1 @ 0x41104e 0x443892 0x47ee78 0x4601e1
#   0x443892    os/signal.signal_recv+0x132 /home/bao/go/src/runtime/sigqueue.go:116
#   0x47ee78    os/signal.loop+0x18     /home/bao/go/src/os/signal/signal_unix.go:22

1 @ 0x430c93 0x43f767 0x43ecc2 0x4be721 0x4601e1
#   0x4be721    github.com/zhangpeihao/log.(*Logger).counterDump+0x1721 /home/bao/gowork/src/github.com/zhangpeihao/log/log.go:360

heap profile: 0: 0 [0: 0] @ heap/1048576

# runtime.MemStats
# Alloc = 155936
# TotalAlloc = 155936
# Sys = 1937408
# Lookups = 7
# Mallocs = 648
# Frees = 68
# HeapAlloc = 155936
# HeapSys = 688128
# HeapIdle = 98304
# HeapInuse = 589824
# HeapReleased = 0
# HeapObjects = 580
# Stack = 360448 / 360448
# MSpan = 8280 / 16384
# MCache = 4800 / 16384
# BuckHashSys = 2184
# NextGC = 4194304
# PauseNs = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
# NumGC = 0
# EnableGC = true
# DebugGC = false
threadcreate profile: total 8
8 @

######## Heap #######
heap profile: 0: 0 [0: 0] @ heap/1048576

# runtime.MemStats
# Alloc = 195664
# TotalAlloc = 195664
# Sys = 1937408
# Lookups = 7
# Mallocs = 742
# Frees = 98
# HeapAlloc = 195664
# HeapSys = 688128
# HeapIdle = 40960
# HeapInuse = 647168
# HeapReleased = 0
# HeapObjects = 644
# Stack = 360448 / 360448
# MSpan = 8640 / 16384
# MCache = 4800 / 16384
# BuckHashSys = 2184
# NextGC = 4194304
# PauseNs = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
# NumGC = 0
# EnableGC = true
# DebugGC = false
######## End #######
2016/09/01 23:28:21 Start listen...
2016/09/01 23:28:31 Handshake begin
2016/09/01 23:28:31 SHandshake() Flash player version is 9.0.124.2
2016/09/01 23:28:31 SHandshake() scheme = 0
2016/09/01 23:28:31 Buffer(SHandshake signatureResp):
b1 87 a0 e7 00 12 fc da  28 93 2b 6b a6 b9 c7 59 
5b 11 33 7d ce 58 f2 70  5a 91 f6 bd 4b b6 b8 f6 

2016/09/01 23:28:31 New stream 1 csi: 3, fmt: 0
2016/09/01 23:28:31 New stream 2 csi: 3, fmt: 0, header: &{Fmt:0 ChunkStreamID:3 Timestamp:0 MessageLength:137 MessageTypeID:20 MessageStreamID:0 ExtendedTimestamp:0}
2016/09/01 23:28:31 Unfinish message(remain: 137, chunksize: 128)
2016/09/01 23:28:31 Message(<<<){CID: 3, Type: 20, Timestamp: 0, Size: 137, StreamID: 0, IsInbound: true, AbsoluteTimestamp: 0}
2016/09/01 23:28:31 conn::invokeCommand()
2016/09/01 23:28:31 Command{IsFlex: false, Name: connect, TransactionID: 1, Objects: [map[app:app type:nonprivate flashVer:FMLE/3.0 (compatible; Lavf57.48.101) tcUrl:rtmp://localhost:1935/app]]}
2016/09/01 23:28:31 inboundConn::onConnect
2016/09/01 23:28:31 conn::SetWindowAcknowledgementSize
2016/09/01 23:28:31 conn::SetPeerBandwidth
2016/09/01 23:28:31 conn::SetChunkSize(size: 4096)
2016/09/01 23:28:31 Message(sendConnectResult){CID: 3, Type: 20, Timestamp: 0, Size: 165, StreamID: 0, IsInbound: false, AbsoluteTimestamp: 0}
2016/09/01 23:28:31 OutboundChunkStream::NewOutboundHeader() header: &{Fmt:0 ChunkStreamID:2 Timestamp:0 MessageLength:4 MessageTypeID:5 MessageStreamID:0 ExtendedTimestamp:0}
2016/09/01 23:28:31 OutboundChunkStream::NewOutboundHeader() header: &{Fmt:1 ChunkStreamID:2 Timestamp:0 MessageLength:5 MessageTypeID:6 MessageStreamID:0 ExtendedTimestamp:0}
2016/09/01 23:28:31 OutboundChunkStream::NewOutboundHeader() header: &{Fmt:1 ChunkStreamID:2 Timestamp:0 MessageLength:4 MessageTypeID:1 MessageStreamID:0 ExtendedTimestamp:0}
2016/09/01 23:28:31 OutboundChunkStream::NewOutboundHeader() header: &{Fmt:0 ChunkStreamID:3 Timestamp:0 MessageLength:165 MessageTypeID:20 MessageStreamID:0 ExtendedTimestamp:0}
2016/09/01 23:28:31 New stream 1 csi: 2, fmt: 0
2016/09/01 23:28:31 New stream 2 csi: 2, fmt: 0, header: &{Fmt:0 ChunkStreamID:2 Timestamp:0 MessageLength:4 MessageTypeID:1 MessageStreamID:0 ExtendedTimestamp:0}
2016/09/01 23:28:31 Message(<<<){CID: 2, Type: 1, Timestamp: 0, Size: 4, StreamID: 0, IsInbound: true, AbsoluteTimestamp: 0}
2016/09/01 23:28:31 conn::invokeSetChunkSize() conn.inChunkSize = 4096
2016/09/01 23:28:31 Message(<<<){CID: 3, Type: 20, Timestamp: 0, Size: 29, StreamID: 0, IsInbound: true, AbsoluteTimestamp: 0}
2016/09/01 23:28:31 conn::invokeCommand()
2016/09/01 23:28:31 Command{IsFlex: false, Name: releaseStream, TransactionID: 2, Objects: [<nil> ]}
2016/09/01 23:28:31 inboundConn::ReceivedRtmpCommand: &{IsFlex:false Name:releaseStream TransactionID:2 Objects:[<nil> ]}
2016/09/01 23:28:31 Message(<<<){CID: 3, Type: 20, Timestamp: 0, Size: 25, StreamID: 0, IsInbound: true, AbsoluteTimestamp: 0}
2016/09/01 23:28:31 conn::invokeCommand()
2016/09/01 23:28:31 Command{IsFlex: false, Name: FCPublish, TransactionID: 3, Objects: [<nil> ]}
2016/09/01 23:28:31 inboundConn::ReceivedRtmpCommand: &{IsFlex:false Name:FCPublish TransactionID:3 Objects:[<nil> ]}
2016/09/01 23:28:31 Message(<<<){CID: 3, Type: 20, Timestamp: 0, Size: 25, StreamID: 0, IsInbound: true, AbsoluteTimestamp: 0}
2016/09/01 23:28:31 conn::invokeCommand()
2016/09/01 23:28:31 Command{IsFlex: false, Name: createStream, TransactionID: 4, Objects: [<nil>]}
2016/09/01 23:28:31 inboundConn::onCreateStream
2016/09/01 23:28:31 index: 0, newChunkStreamID: 8
2016/09/01 23:28:31 Message(sendCreateStreamSuccessResult){CID: 3, Type: 20, Timestamp: 0, Size: 29, StreamID: 0, IsInbound: false, AbsoluteTimestamp: 0}
2016/09/01 23:28:31 OutboundChunkStream::NewOutboundHeader() header: &{Fmt:1 ChunkStreamID:3 Timestamp:0 MessageLength:29 MessageTypeID:20 MessageStreamID:0 ExtendedTimestamp:0}
2016/09/01 23:28:31 New stream 1 csi: 8, fmt: 0
2016/09/01 23:28:31 New stream 2 csi: 8, fmt: 0, header: &{Fmt:0 ChunkStreamID:8 Timestamp:0 MessageLength:30 MessageTypeID:20 MessageStreamID:1 ExtendedTimestamp:0}
2016/09/01 23:28:31 Message(<<<){CID: 8, Type: 20, Timestamp: 0, Size: 30, StreamID: 1, IsInbound: true, AbsoluteTimestamp: 0}
zboya commented 7 years ago

查看了一下源码,是在server端接收到publish命令后,并没有做任何处理

zhangpeihao commented 7 years ago

没有源吧。

zboya commented 7 years ago

@zhangpeihao 不是,你的代码没处理 publish 命令,需要返回onStatus 状态。

nifflin commented 7 years ago

用和题主相同的命令,最新版demo server,貌似还是无法推流上去,ffmpeg不打印滚动fps信息。

zhangpeihao commented 7 years ago

推流地址可以发我,我测试一下