rtmp直播流程
2014年6月24日
下面是通过RTMP抓包所得,左侧是客户端Flash Media Live Encoder,右侧是服务器Flash Media Server
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
+--------------+ +--------------+ | Client(FMLE) | | Server (FMS) | +--------------+ +--------------+ | | | C0 C1 | |---------------------------------------------------> +---- | | | S0 S1 S2 | | <---------------------------------------------------| handshake | | | C2 | |---------------------------------------------------> +---- | | | connect('live_server') | |---------------------------------------------------> | | | | Windows Acknowledgement Size 2500000 | | <---------------------------------------------------| | | connect | Set Peer BandWith 2500000,Dynamic | | <---------------------------------------------------| | | | Set Chunk Size 1024 | | <---------------------------------------------------| | | | _result('NetConnection.Connect.Success') | | <---------------------------------------------------+---- | | | releaseStream('livestream') | |---------------------------------------------------> | | | | FCPulbic('livestream') | |---------------------------------------------------> | | | | createStream() | |---------------------------------------------------> | publish | | | _result() | | <---------------------------------------------------| | | | publish('livestream?videoKeyframeFrequency=5') | |---------------------------------------------------> | | | | Set Chunk Size 1024 | |---------------------------------------------------> | | | | onStatus('NetStream.Publish.Start') | | <---------------------------------------------------+---- | | | @setDataFrame() | |---------------------------------------------------> | | | | Video Data | |---------------------------------------------------> | | | | Set Chunk Size 418 | |---------------------------------------------------> | | | | Audio Data | |---------------------------------------------------> | | | av data | Audio Data | |---------------------------------------------------> | | | | Video Data | |---------------------------------------------------> | | | | Audio Data | |---------------------------------------------------> | | | | Audio Data | |---------------------------------------------------> | | | | Video Data | |---------------------------------------------------> | | | | FCUnpublish() | |---------------------------------------------------> +---- | | | closeStream() | |---------------------------------------------------> | | | close | onStatus('NetStream.Unpublish.Success') | | <---------------------------------------------------| | | | deleteStream() | |---------------------------------------------------> +---- | | | | |